diff options
author | Jake Potrebic <[email protected]> | 2022-06-02 21:26:56 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2022-06-02 21:26:56 -0700 |
commit | a3ad72074951c5f2fd27f41f7cb9b8ae46241d30 (patch) | |
tree | fc581399172f25af5368022e36323f8ae4f57034 /patches/server/0095-Optional-TNT-doesn-t-move-in-water.patch | |
parent | 2033dba4fa16d2f9081c5c6aff54255b3b4717a8 (diff) | |
download | Paper-a3ad72074951c5f2fd27f41f7cb9b8ae46241d30.tar.gz Paper-a3ad72074951c5f2fd27f41f7cb9b8ae46241d30.zip |
Remove ChatColor usages (#7543)
Diffstat (limited to 'patches/server/0095-Optional-TNT-doesn-t-move-in-water.patch')
-rw-r--r-- | patches/server/0095-Optional-TNT-doesn-t-move-in-water.patch | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/patches/server/0095-Optional-TNT-doesn-t-move-in-water.patch b/patches/server/0095-Optional-TNT-doesn-t-move-in-water.patch new file mode 100644 index 0000000000..747bb69d9a --- /dev/null +++ b/patches/server/0095-Optional-TNT-doesn-t-move-in-water.patch @@ -0,0 +1,82 @@ +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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 929a9b775ddb10397929c2c5ce25cf03eaec4b1a..97b02b5a4808fc0b7fd2d2a88817716cba61054b 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -342,4 +342,14 @@ public class PaperWorldConfig { + ); + } + } ++ ++ public boolean preventTntFromMovingInWater; ++ private void preventTntFromMovingInWater() { ++ if (PaperConfig.version < 13) { ++ boolean oldVal = getBoolean("enable-old-tnt-cannon-behaviors", false); ++ set("prevent-tnt-from-moving-in-water", oldVal); ++ } ++ preventTntFromMovingInWater = getBoolean("prevent-tnt-from-moving-in-water", false); ++ log("Prevent TNT from moving in water: " + preventTntFromMovingInWater); ++ } + } +diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java +index c9cc096183753d61d9f53ceca05af07c04bbff3b..861f3790179e18f6192ac8b2fb5d2ecbc54484ad 100644 +--- a/src/main/java/net/minecraft/server/level/ServerEntity.java ++++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +@@ -67,7 +67,7 @@ public class ServerEntity { + private boolean wasRiding; + private boolean wasOnGround; + // CraftBukkit start +- private final Set<ServerPlayerConnection> trackedPlayers; ++ final Set<ServerPlayerConnection> trackedPlayers; // Paper - private -> package + + public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<ServerPlayerConnection> trackedPlayers) { + this.trackedPlayers = trackedPlayers; +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 dfcca1fac06de7a4be9be3c238a738a0599fcd24..445d9d1ec6f02f32d819d8555ceddb8e1ada7acd 100644 +--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java ++++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +@@ -97,6 +97,27 @@ public class PrimedTnt extends Entity { + } + } + ++ // Paper start - Optional prevent TNT from moving in water ++ if (!this.isRemoved() && this.wasTouchingWater && this.level.paperConfig.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 = 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); ++ }); ++ } ++ } ++ // Paper end + } + + private void explode() { +@@ -152,4 +173,11 @@ public class PrimedTnt extends Entity { + public Packet<?> getAddEntityPacket() { + return new ClientboundAddEntityPacket(this); + } ++ ++ // Paper start - Optional prevent TNT from moving in water ++ @Override ++ public boolean isPushedByFluid() { ++ return !level.paperConfig.preventTntFromMovingInWater && super.isPushedByFluid(); ++ } ++ // Paper end + } |