2021-06-12 07:20:08 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
|
|
|
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
|
2024-04-24 03:25:14 +02:00
|
|
|
index f127cac376cf4d0e585d12cd5976a3aee567403a..4772e7978858263702312669f400d3da9c486730 100644
|
2021-06-12 07:20:08 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -107,6 +107,27 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
2021-06-12 07:20:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-23 14:34:17 +01:00
|
|
|
+ // Paper start - Option to prevent TNT from moving in water
|
2023-06-08 00:28:06 +02:00
|
|
|
+ if (!this.isRemoved() && this.wasTouchingWater && this.level().paperConfig().fixes.preventTntFromMovingInWater) {
|
2021-06-12 07:20:08 +02:00
|
|
|
+ /*
|
|
|
|
+ * Author: Jedediah Smith <jedediah@silencegreys.com>
|
|
|
|
+ */
|
|
|
|
+ // 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.
|
2023-06-08 00:28:06 +02:00
|
|
|
+ net.minecraft.server.level.ChunkMap.TrackedEntity ete = ((net.minecraft.server.level.ServerLevel)this.level()).getChunkSource().chunkMap.entityMap.get(this.getId());
|
2021-06-12 07:20:08 +02:00
|
|
|
+ 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 = new net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket(this);
|
|
|
|
+
|
|
|
|
+ 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);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
2024-01-23 14:34:17 +01:00
|
|
|
+ // Paper end - Option to prevent TNT from moving in water
|
2021-06-12 07:20:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void explode() {
|
2024-04-24 03:25:14 +02:00
|
|
|
@@ -165,4 +186,11 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
2023-12-05 22:20:44 +01:00
|
|
|
public BlockState getBlockState() {
|
|
|
|
return (BlockState) this.entityData.get(PrimedTnt.DATA_BLOCK_STATE_ID);
|
2021-06-12 07:20:08 +02:00
|
|
|
}
|
|
|
|
+
|
2024-01-23 14:34:17 +01:00
|
|
|
+ // Paper start - Option to prevent TNT from moving in water
|
2021-06-12 07:20:08 +02:00
|
|
|
+ @Override
|
|
|
|
+ public boolean isPushedByFluid() {
|
2023-06-08 01:21:20 +02:00
|
|
|
+ return !level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid();
|
2021-06-12 07:20:08 +02:00
|
|
|
+ }
|
2024-01-23 14:34:17 +01:00
|
|
|
+ // Paper end - Option to prevent TNT from moving in water
|
2021-06-12 07:20:08 +02:00
|
|
|
}
|