當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。