diff options
Diffstat (limited to 'patches/unapplied/server/0097-Optional-TNT-doesn-t-move-in-water.patch')
-rw-r--r-- | patches/unapplied/server/0097-Optional-TNT-doesn-t-move-in-water.patch | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/patches/unapplied/server/0097-Optional-TNT-doesn-t-move-in-water.patch b/patches/unapplied/server/0097-Optional-TNT-doesn-t-move-in-water.patch new file mode 100644 index 0000000000..4c44ca39c9 --- /dev/null +++ b/patches/unapplied/server/0097-Optional-TNT-doesn-t-move-in-water.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zach Brown <[email protected]> +Date: Sun, 22 May 2016 20:20:55 -0500 +Subject: [PATCH] Optional TNT doesn't move in water + + +diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +index 3d489fdc14b3e29bab63f330d5edbbc1d354382a..45c224198135e48f94dc72312c805bf451bf7b0e 100644 +--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java ++++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +@@ -135,6 +135,27 @@ public class PrimedTnt extends Entity implements TraceableEntity { + } + } + ++ // Paper start - Option to prevent TNT from moving in water ++ if (!this.isRemoved() && this.wasTouchingWater && this.level().paperConfig().fixes.preventTntFromMovingInWater) { ++ /* ++ * Author: Jedediah Smith <[email protected]> ++ */ ++ // Send position and velocity updates to nearby players on every tick while the TNT is in water. ++ // This does pretty well at keeping their clients in sync with the server. ++ net.minecraft.server.level.ChunkMap.TrackedEntity ete = ((net.minecraft.server.level.ServerLevel) this.level()).getChunkSource().chunkMap.entityMap.get(this.getId()); ++ if (ete != null) { ++ net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket velocityPacket = new net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket(this); ++ net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket positionPacket = net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket.teleport(this.getId(), net.minecraft.world.entity.PositionMoveRotation.of(this), java.util.Set.of(), this.onGround); ++ ++ ete.seenBy.stream() ++ .filter(viewer -> (viewer.getPlayer().getX() - this.getX()) * (viewer.getPlayer().getY() - this.getY()) * (viewer.getPlayer().getZ() - this.getZ()) < 16 * 16) ++ .forEach(viewer -> { ++ viewer.send(velocityPacket); ++ viewer.send(positionPacket); ++ }); ++ } ++ } ++ // Paper end - Option to prevent TNT from moving in water + } + + private void explode() { +@@ -221,4 +242,11 @@ public class PrimedTnt extends Entity implements TraceableEntity { + public final boolean hurtServer(ServerLevel world, DamageSource source, float amount) { + return false; + } ++ ++ // Paper start - Option to prevent TNT from moving in water ++ @Override ++ public boolean isPushedByFluid() { ++ return !level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid(); ++ } ++ // Paper end - Option to prevent TNT from moving in water + } |