当前位置: 首页>>代码示例>>Java>>正文


Java Block.SoundType方法代码示例

本文整理汇总了Java中net.minecraft.block.Block.SoundType方法的典型用法代码示例。如果您正苦于以下问题:Java Block.SoundType方法的具体用法?Java Block.SoundType怎么用?Java Block.SoundType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.block.Block的用法示例。


在下文中一共展示了Block.SoundType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fall

import net.minecraft.block.Block; //导入方法依赖的package包/类
public void fall(float distance, float damageMultiplier)
{
    super.fall(distance, damageMultiplier);
    PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump);
    float f = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F;
    int i = MathHelper.ceiling_float_int((distance - 3.0F - f) * damageMultiplier);

    if (i > 0)
    {
        this.playSound(this.getFallSoundString(i), 1.0F, 1.0F);
        this.attackEntityFrom(DamageSource.fall, (float)i);
        int j = MathHelper.floor_double(this.posX);
        int k = MathHelper.floor_double(this.posY - 0.20000000298023224D);
        int l = MathHelper.floor_double(this.posZ);
        Block block = this.worldObj.getBlockState(new BlockPos(j, k, l)).getBlock();

        if (block.getMaterial() != Material.air)
        {
            Block.SoundType block$soundtype = block.stepSound;
            this.playSound(block$soundtype.getStepSound(), block$soundtype.getVolume() * 0.5F, block$soundtype.getFrequency() * 0.75F);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:24,代码来源:EntityLivingBase.java

示例2: playStepSound

import net.minecraft.block.Block; //导入方法依赖的package包/类
protected void playStepSound(BlockPos pos, Block blockIn)
{
    Block.SoundType block$soundtype = blockIn.stepSound;

    if (this.worldObj.getBlockState(pos.up()).getBlock() == Blocks.snow_layer)
    {
        block$soundtype = Blocks.snow_layer.stepSound;
        this.playSound(block$soundtype.getStepSound(), block$soundtype.getVolume() * 0.15F, block$soundtype.getFrequency());
    }
    else if (!blockIn.getMaterial().isLiquid())
    {
        this.playSound(block$soundtype.getStepSound(), block$soundtype.getVolume() * 0.15F, block$soundtype.getFrequency());
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:15,代码来源:Entity.java

示例3: fall

import net.minecraft.block.Block; //导入方法依赖的package包/类
public void fall(float distance, float damageMultiplier)
{
    if (distance > 1.0F)
    {
        this.playSound("mob.horse.land", 0.4F, 1.0F);
    }

    int i = MathHelper.ceiling_float_int((distance * 0.5F - 3.0F) * damageMultiplier);

    if (i > 0)
    {
        this.attackEntityFrom(DamageSource.fall, (float)i);

        if (this.riddenByEntity != null)
        {
            this.riddenByEntity.attackEntityFrom(DamageSource.fall, (float)i);
        }

        Block block = this.worldObj.getBlockState(new BlockPos(this.posX, this.posY - 0.2D - (double)this.prevRotationYaw, this.posZ)).getBlock();

        if (block.getMaterial() != Material.air && !this.isSilent())
        {
            Block.SoundType block$soundtype = block.stepSound;
            this.worldObj.playSoundAtEntity(this, block$soundtype.getStepSound(), block$soundtype.getVolume() * 0.5F, block$soundtype.getFrequency() * 0.75F);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:28,代码来源:EntityHorse.java

示例4: playStepSound

import net.minecraft.block.Block; //导入方法依赖的package包/类
protected void playStepSound(BlockPos pos, Block blockIn)
{
    Block.SoundType block$soundtype = blockIn.stepSound;

    if (this.worldObj.getBlockState(pos.up()).getBlock() == Blocks.snow_layer)
    {
        block$soundtype = Blocks.snow_layer.stepSound;
    }

    if (!blockIn.getMaterial().isLiquid())
    {
        int i = this.getHorseType();

        if (this.riddenByEntity != null && i != 1 && i != 2)
        {
            ++this.gallopTime;

            if (this.gallopTime > 5 && this.gallopTime % 3 == 0)
            {
                this.playSound("mob.horse.gallop", block$soundtype.getVolume() * 0.15F, block$soundtype.getFrequency());

                if (i == 0 && this.rand.nextInt(10) == 0)
                {
                    this.playSound("mob.horse.breathe", block$soundtype.getVolume() * 0.6F, block$soundtype.getFrequency());
                }
            }
            else if (this.gallopTime <= 5)
            {
                this.playSound("mob.horse.wood", block$soundtype.getVolume() * 0.15F, block$soundtype.getFrequency());
            }
        }
        else if (block$soundtype == Block.soundTypeWood)
        {
            this.playSound("mob.horse.wood", block$soundtype.getVolume() * 0.15F, block$soundtype.getFrequency());
        }
        else
        {
            this.playSound("mob.horse.soft", block$soundtype.getVolume() * 0.15F, block$soundtype.getFrequency());
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:42,代码来源:EntityHorse.java


注:本文中的net.minecraft.block.Block.SoundType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。