Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
0d3b35c339
This option does not set the absolute speed of the entity as the name implies. It sets a modifier. The default (vanilla) value of `0.5` sets the baby zombie to move at 50% faster than the base speed. A negative value like `-0.4` would set them to move at 40% slower. There should be no functional changes as a result of this change, it's just clarifying the config name.
112 Zeilen
4.5 KiB
Diff
112 Zeilen
4.5 KiB
Diff
From c6fac8147b0b1b3a1019625eb4e2ffaa05f22c3c 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 934097163..300cc68a7 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;
|
|
|
|
@@ -287,4 +286,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 4793bc7d8..0981e9c8c 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -2698,6 +2698,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
}
|
|
|
|
public boolean bE() {
|
|
+ // 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 f2ee53ab9..dc0d944ea 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.ay();
|
|
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 = this.tracker;
|
|
+ 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<?> N() {
|
|
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 f04a9d18c..cd7e0299a 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
@@ -36,7 +36,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;
|
|
|
|
--
|
|
2.23.0
|
|
|