本文整理汇总了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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}