geforkt von Mirrors/Paper
0ea3083817
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: 1e843b72 #510: Add NamespacedKey#fromString() to fetch from user input a4d18241 #581: Add methods to modify despawn delay for wandering villagers CraftBukkit Changes: 0cd8f19f #802: Add methods to modify despawn delay for wandering villagers d5c5d998 SPIGOT-6362: ConcurrentModificationException: null --> Server Crash 8c7d69fe SPIGOT-5228: Entities that are removed during chunk unloads are not properly removed from the chunk.
108 Zeilen
4.8 KiB
Diff
108 Zeilen
4.8 KiB
Diff
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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index eb04fdb172a50ec1f5b7fe78fa0e7655246abd60..6eca3f300020006f02dd36253b522db442e3cc33 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -2,7 +2,6 @@ package com.destroystokyo.paper;
|
|
|
|
import java.util.List;
|
|
|
|
-import org.bukkit.Bukkit;
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
import org.spigotmc.SpigotWorldConfig;
|
|
|
|
@@ -291,4 +290,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/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
index 0dd63d2e0ed16eb08cf97dbf8c293e24a5a1bda9..6aa29495802b7d52c4c0f283495c7d1762f657fa 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -2681,6 +2681,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
}
|
|
|
|
public boolean bV() {
|
|
+ // Paper start
|
|
+ return this.pushedByWater();
|
|
+ }
|
|
+ public boolean pushedByWater() {
|
|
+ // Paper end
|
|
return true;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
|
index e25404fd89ad6317c2656c68c2e32aa05e5f0e73..b108874d977a4fb1a7c0d52f66bc08390decb4d0 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
|
@@ -80,7 +80,27 @@ public class EntityTNTPrimed extends Entity {
|
|
this.world.addParticle(Particles.SMOKE, this.locX(), this.locY() + 0.5D, this.locZ(), 0.0D, 0.0D, 0.0D);
|
|
}
|
|
}
|
|
-
|
|
+ // Paper start - Optional prevent TNT from moving in water
|
|
+ if (!this.dead && this.inWater && this.world.paperConfig.preventTntFromMovingInWater) {
|
|
+ /*
|
|
+ * 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.
|
|
+ PlayerChunkMap.EntityTracker ete = ((WorldServer)this.world).getChunkProvider().playerChunkMap.trackedEntities.get(this.getId());
|
|
+ if (ete != null) {
|
|
+ PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity(this);
|
|
+ PacketPlayOutEntityTeleport positionPacket = new PacketPlayOutEntityTeleport(this);
|
|
+
|
|
+ ete.trackedPlayers.stream()
|
|
+ .filter(viewer -> (viewer.locX() - this.locX()) * (viewer.locY() - this.locY()) * (viewer.locZ() - this.locZ()) < 16 * 16)
|
|
+ .forEach(viewer -> {
|
|
+ viewer.playerConnection.sendPacket(velocityPacket);
|
|
+ viewer.playerConnection.sendPacket(positionPacket);
|
|
+ });
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
private void explode() {
|
|
@@ -149,4 +169,11 @@ public class EntityTNTPrimed extends Entity {
|
|
public Packet<?> P() {
|
|
return new PacketPlayOutSpawnEntity(this);
|
|
}
|
|
+
|
|
+ // Paper start - Optional prevent TNT from moving in water
|
|
+ @Override
|
|
+ public boolean pushedByWater() {
|
|
+ return !world.paperConfig.preventTntFromMovingInWater && super.pushedByWater();
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
index dec48226d713ef0198ef3c679daf553a9d05a099..c346ca8ba30da401ea1a421e8ce6ed1d5b6e4c13 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
@@ -38,7 +38,7 @@ public class EntityTrackerEntry {
|
|
private boolean q;
|
|
private boolean r;
|
|
// CraftBukkit start
|
|
- private final Set<EntityPlayer> trackedPlayers;
|
|
+ final Set<EntityPlayer> trackedPlayers; // Paper - private -> package
|
|
// Paper start
|
|
private java.util.Map<EntityPlayer, Boolean> trackedPlayerMap = null;
|
|
|