当前位置: 首页>>代码示例>>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;未经允许,请勿转载。