本文整理匯總了Java中net.minecraft.util.DamageSource.fallingBlock方法的典型用法代碼示例。如果您正苦於以下問題:Java DamageSource.fallingBlock方法的具體用法?Java DamageSource.fallingBlock怎麽用?Java DamageSource.fallingBlock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.DamageSource
的用法示例。
在下文中一共展示了DamageSource.fallingBlock方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleLivingEntityDamageEvent
import net.minecraft.util.DamageSource; //導入方法依賴的package包/類
public static EntityDamageEvent handleLivingEntityDamageEvent(Entity damagee, DamageSource source, double rawDamage, double hardHatModifier, double blockingModifier, double armorModifier, double resistanceModifier, double magicModifier, double absorptionModifier, Function<Double, Double> hardHat, Function<Double, Double> blocking, Function<Double, Double> armor, Function<Double, Double> resistance, Function<Double, Double> magic, Function<Double, Double> absorption) {
Map<DamageModifier, Double> modifiers = new EnumMap<DamageModifier, Double>(DamageModifier.class);
Map<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<DamageModifier, Function<? super Double, Double>>(DamageModifier.class);
modifiers.put(DamageModifier.BASE, rawDamage);
modifierFunctions.put(DamageModifier.BASE, ZERO);
if (source == DamageSource.fallingBlock || source == DamageSource.anvil) {
modifiers.put(DamageModifier.HARD_HAT, hardHatModifier);
modifierFunctions.put(DamageModifier.HARD_HAT, hardHat);
}
if (damagee instanceof EntityPlayer) {
modifiers.put(DamageModifier.BLOCKING, blockingModifier);
modifierFunctions.put(DamageModifier.BLOCKING, blocking);
}
modifiers.put(DamageModifier.ARMOR, armorModifier);
modifierFunctions.put(DamageModifier.ARMOR, armor);
modifiers.put(DamageModifier.RESISTANCE, resistanceModifier);
modifierFunctions.put(DamageModifier.RESISTANCE, resistance);
modifiers.put(DamageModifier.MAGIC, magicModifier);
modifierFunctions.put(DamageModifier.MAGIC, magic);
modifiers.put(DamageModifier.ABSORPTION, absorptionModifier);
modifierFunctions.put(DamageModifier.ABSORPTION, absorption);
return handleEntityDamageEvent(damagee, source, modifiers, modifierFunctions);
}
示例2: fall
import net.minecraft.util.DamageSource; //導入方法依賴的package包/類
public void fall(float distance, float damageMultiplier)
{
Block block = this.fallTile.getBlock();
if (this.hurtEntities)
{
int i = MathHelper.ceiling_float_int(distance - 1.0F);
if (i > 0)
{
List<Entity> list = Lists.newArrayList(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox()));
boolean flag = block == Blocks.anvil;
DamageSource damagesource = flag ? DamageSource.anvil : DamageSource.fallingBlock;
for (Entity entity : list)
{
entity.attackEntityFrom(damagesource, (float)Math.min(MathHelper.floor_float((float)i * this.fallHurtAmount), this.fallHurtMax));
}
if (flag && (double)this.rand.nextFloat() < 0.05000000074505806D + (double)i * 0.05D)
{
int j = ((Integer)this.fallTile.getValue(BlockAnvil.DAMAGE)).intValue();
++j;
if (j > 2)
{
this.canSetAsBlock = true;
}
else
{
this.fallTile = this.fallTile.withProperty(BlockAnvil.DAMAGE, Integer.valueOf(j));
}
}
}
}
}
示例3: fall
import net.minecraft.util.DamageSource; //導入方法依賴的package包/類
public void fall(float distance, float damageMultiplier)
{
Block block = this.fallTile.getBlock();
if (this.hurtEntities)
{
int i = MathHelper.ceil(distance - 1.0F);
if (i > 0)
{
List<Entity> list = Lists.newArrayList(this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox()));
boolean flag = block == Blocks.ANVIL;
DamageSource damagesource = flag ? DamageSource.anvil : DamageSource.fallingBlock;
for (Entity entity : list)
{
entity.attackEntityFrom(damagesource, (float)Math.min(MathHelper.floor((float)i * this.fallHurtAmount), this.fallHurtMax));
}
if (flag && (double)this.rand.nextFloat() < 0.05000000074505806D + (double)i * 0.05D)
{
int j = ((Integer)this.fallTile.getValue(BlockAnvil.DAMAGE)).intValue();
++j;
if (j > 2)
{
this.canSetAsBlock = true;
}
else
{
this.fallTile = this.fallTile.withProperty(BlockAnvil.DAMAGE, Integer.valueOf(j));
}
}
}
}
}
示例4: fall
import net.minecraft.util.DamageSource; //導入方法依賴的package包/類
public void fall(float distance, float damageMultiplier)
{
Block block = this.fallTile.getBlock();
if (this.hurtEntities)
{
int i = MathHelper.ceiling_float_int(distance - 1.0F);
if (i > 0)
{
List<Entity> list = Lists.newArrayList(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox()));
boolean flag = block == Blocks.ANVIL;
DamageSource damagesource = flag ? DamageSource.anvil : DamageSource.fallingBlock;
for (Entity entity : list)
{
entity.attackEntityFrom(damagesource, (float)Math.min(MathHelper.floor_float((float)i * this.fallHurtAmount), this.fallHurtMax));
}
if (flag && (double)this.rand.nextFloat() < 0.05000000074505806D + (double)i * 0.05D)
{
int j = ((Integer)this.fallTile.getValue(BlockAnvil.DAMAGE)).intValue();
++j;
if (j > 2)
{
this.canSetAsBlock = true;
}
else
{
this.fallTile = this.fallTile.withProperty(BlockAnvil.DAMAGE, Integer.valueOf(j));
}
}
}
}
}