diff --git a/paper-server/nms-patches/net/minecraft/world/entity/vehicle/EntityMinecartTNT.patch b/paper-server/nms-patches/net/minecraft/world/entity/vehicle/EntityMinecartTNT.patch index 6a20eeb483..dc5e82ae5b 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/vehicle/EntityMinecartTNT.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/vehicle/EntityMinecartTNT.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java +++ b/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java -@@ -23,6 +23,10 @@ +@@ -23,10 +23,14 @@ import net.minecraft.world.level.block.state.IBlockData; import net.minecraft.world.level.material.Fluid; @@ -11,6 +11,20 @@ public class EntityMinecartTNT extends EntityMinecartAbstract { private static final byte EVENT_PRIME = 10; +- private int fuse = -1; ++ public int fuse = -1; + + public EntityMinecartTNT(EntityTypes entitytypes, World world) { + super(entitytypes, world); +@@ -103,7 +107,7 @@ + return Items.TNT_MINECART; + } + +- protected void explode(double d0) { ++ public void explode(double d0) { + this.explode((DamageSource) null, d0); + } + @@ -115,7 +119,15 @@ d1 = 5.0D; } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java index db99de07de..31f49b64be 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java @@ -1,5 +1,6 @@ package org.bukkit.craftbukkit.entity; +import com.google.common.base.Preconditions; import net.minecraft.world.entity.vehicle.EntityMinecartTNT; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; @@ -10,6 +11,43 @@ final class CraftMinecartTNT extends CraftMinecart implements ExplosiveMinecart super(server, entity); } + @Override + public void setFuseTicks(int ticks) { + getHandle().fuse = ticks; + } + + @Override + public int getFuseTicks() { + return getHandle().getFuse(); + } + + @Override + public void ignite() { + getHandle().primeFuse(); + } + + @Override + public boolean isIgnited() { + return getHandle().isPrimed(); + } + + @Override + public void explode() { + getHandle().explode(getHandle().getDeltaMovement().horizontalDistanceSqr()); + } + + @Override + public void explode(double power) { + Preconditions.checkArgument(0 <= power && power <= 5, "Power must be in range [0, 5] (got %s)", power); + + getHandle().explode(power); + } + + @Override + public EntityMinecartTNT getHandle() { + return (EntityMinecartTNT) super.getHandle(); + } + @Override public String toString() { return "CraftMinecartTNT";