use of net.minecraft.entity.damage.DamageSource in project Paradise-Lost by devs-immortal.
the class FloatingBlockEntity method handleFallDamage.
@Override
public boolean handleFallDamage(float distance, float damageMultiplier) {
if (this.hurtEntities) {
int i = MathHelper.ceil(distance - 1.0F);
if (i > 0) {
List<Entity> list = Lists.newArrayList(this.world.getOtherEntities(this, this.getBoundingBox()));
boolean flag = this.blockState.isIn(BlockTags.ANVIL);
DamageSource damagesource = flag ? DamageSource.ANVIL : DamageSource.FALLING_BLOCK;
for (Entity entity : list) entity.damage(damagesource, Math.min(MathHelper.floor(i * this.floatHurtAmount), this.floatHurtMax));
if (flag && this.random.nextFloat() < 0.05F + i * 0.05F) {
BlockState blockstate = AnvilBlock.getLandingState(this.blockState);
if (blockstate == null)
this.destroyedOnLanding = true;
else
this.blockState = blockstate;
}
}
}
return false;
}
Aggregations