當前位置: 首頁>>代碼示例>>Java>>正文


Java ForgeHooks.onLivingFall方法代碼示例

本文整理匯總了Java中net.minecraftforge.common.ForgeHooks.onLivingFall方法的典型用法代碼示例。如果您正苦於以下問題:Java ForgeHooks.onLivingFall方法的具體用法?Java ForgeHooks.onLivingFall怎麽用?Java ForgeHooks.onLivingFall使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.common.ForgeHooks的用法示例。


在下文中一共展示了ForgeHooks.onLivingFall方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fall

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
protected void fall(float p_70069_1_)
{
    p_70069_1_ = ForgeHooks.onLivingFall(this, p_70069_1_);
    if (p_70069_1_ <= 0) return;
    super.fall(p_70069_1_);
    PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump);
    float f1 = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F;
    int i = MathHelper.ceiling_float_int(p_70069_1_ - 3.0F - f1);

    if (i > 0)
    {
        this.playSound(this.func_146067_o(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 - (double)this.yOffset);
        int l = MathHelper.floor_double(this.posZ);
        Block block = this.worldObj.getBlock(j, k, l);

        if (block.getMaterial() != Material.air)
        {
            Block.SoundType soundtype = block.stepSound;
            this.playSound(soundtype.getStepResourcePath(), soundtype.getVolume() * 0.5F, soundtype.getPitch() * 0.75F);
        }
    }
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:26,代碼來源:EntityLivingBase.java

示例2: fall

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
protected void fall(float p_70069_1_) {
	p_70069_1_ = ForgeHooks.onLivingFall(this, p_70069_1_);

	if (p_70069_1_ <= 0.0F) {
		return;
	}
	super.fall(p_70069_1_);
	PotionEffect potioneffect = getActivePotionEffect(Potion.jump);
	float f1 = potioneffect != null ? potioneffect.getAmplifier() + 1
			: 0.0F;
	int i = MathHelper.ceiling_float_int(p_70069_1_ - 3.0F - f1);
	if (i > 0) {
		playSound(func_146067_o(i), 1.0F, 1.0F);
		attackEntityFrom(DamageSource.fall, i);
		int j = MathHelper.floor_double(this.posX);
		int k = MathHelper.floor_double(this.posY - 0.2000000029802322D
				- this.yOffset);
		int l = MathHelper.floor_double(this.posZ);
		Block block = this.worldObj.getBlock(j, k, l);
		if (block.getMaterial() != Material.air) {
			Block.SoundType soundtype = block.stepSound;
			playSound(soundtype.getStepResourcePath(),
					soundtype.getVolume() * 0.5F,
					soundtype.getPitch() * 0.75F);
		}
	}
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:28,代碼來源:EntityLivingBase.java

示例3: fall

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
protected void fall(float p_70069_1_)
{
    p_70069_1_ = ForgeHooks.onLivingFall(this, p_70069_1_);
    if (p_70069_1_ <= 0) return;
    super.fall(p_70069_1_);
    PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump);
    float f1 = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F;
    int i = MathHelper.ceiling_float_int(p_70069_1_ - 3.0F - f1);

    if (i > 0)
    {
    // CraftBukkit start
        if (!this.attackEntityFrom(DamageSource.fall, (float) i)) 
        {
            return;
        }
    }
    // CraftBukkit end
    if (i > 0)
    {
        this.playSound(this.func_146067_o(i), 1.0F, 1.0F);
        // this.attackEntityFrom(DamageSource.fall, (float)i); // CraftBukkit - moved up
        int j = MathHelper.floor_double(this.posX);
        int k = MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset);
        int l = MathHelper.floor_double(this.posZ);
        Block block = this.worldObj.getBlock(j, k, l);

        if (block.getMaterial() != Material.air)
        {
            Block.SoundType soundtype = block.stepSound;
            this.playSound(soundtype.getStepResourcePath(), soundtype.getVolume() * 0.5F, soundtype.getPitch() * 0.75F);
        }
    }
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:35,代碼來源:EntityLivingBase.java

示例4: fall

import net.minecraftforge.common.ForgeHooks; //導入方法依賴的package包/類
/**
 * Called when the mob is falling. Calculates and applies fall damage.
 */
protected void fall(float par1)
{
    par1 = ForgeHooks.onLivingFall(this, par1);
    if (par1 <= 0) return;
    super.fall(par1);
    PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump);
    float f1 = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F;
    int i = MathHelper.ceiling_float_int(par1 - 3.0F - f1);

    if (i > 0)
    {
        if (i > 4)
        {
            this.playSound("damage.fallbig", 1.0F, 1.0F);
        }
        else
        {
            this.playSound("damage.fallsmall", 1.0F, 1.0F);
        }

        this.attackEntityFrom(DamageSource.fall, (float)i);
        int j = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset), MathHelper.floor_double(this.posZ));

        if (j > 0)
        {
            StepSound stepsound = Block.blocksList[j].stepSound;
            this.playSound(stepsound.getStepSound(), stepsound.getVolume() * 0.5F, stepsound.getPitch() * 0.75F);
        }
    }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:34,代碼來源:EntityLivingBase.java


注:本文中的net.minecraftforge.common.ForgeHooks.onLivingFall方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。