diff --git a/paper-server/nms-patches/net/minecraft/world/entity/item/EntityFallingBlock.patch b/paper-server/nms-patches/net/minecraft/world/entity/item/EntityFallingBlock.patch index 1944e092e1..06950aa924 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/item/EntityFallingBlock.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/item/EntityFallingBlock.patch @@ -9,6 +9,17 @@ public class EntityFallingBlock extends Entity { private static final Logger LOGGER = LogUtils.getLogger(); +@@ -57,8 +59,8 @@ + public boolean dropItem; + private boolean cancelDrop; + public boolean hurtEntities; +- private int fallDamageMax; +- private float fallDamagePerDistance; ++ public int fallDamageMax; ++ public float fallDamagePerDistance; + @Nullable + public NBTTagCompound blockData; + protected static final DataWatcherObject DATA_START_POS = DataWatcher.defineId(EntityFallingBlock.class, DataWatcherRegistry.BLOCK_POS); @@ -83,10 +85,17 @@ } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java index a1e5d5a8e3..c78c13e2f0 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java @@ -1,5 +1,6 @@ package org.bukkit.craftbukkit.entity; +import com.google.common.base.Preconditions; import net.minecraft.world.entity.item.EntityFallingBlock; import org.bukkit.Material; import org.bukkit.block.data.BlockData; @@ -66,4 +67,34 @@ public class CraftFallingBlock extends CraftEntity implements FallingBlock { // Second field for EntityFallingBlock getHandle().time = value; } + + @Override + public float getDamagePerBlock() { + return getHandle().fallDamagePerDistance; + } + + @Override + public void setDamagePerBlock(float damage) { + Preconditions.checkArgument(damage >= 0.0, "damage must be >= 0.0, given %s", damage); + + getHandle().fallDamagePerDistance = damage; + if (damage > 0.0) { + this.setHurtEntities(true); + } + } + + @Override + public int getMaxDamage() { + return getHandle().fallDamageMax; + } + + @Override + public void setMaxDamage(int damage) { + Preconditions.checkArgument(damage >= 0, "damage must be >= 0, given %s", damage); + + getHandle().fallDamageMax = damage; + if (damage > 0) { + this.setHurtEntities(true); + } + } }