mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 10:35:38 +01:00
Fix issue with entity activation range check - #1199
This commit is contained in:
parent
801e2ee3b1
commit
230bf934b5
@ -1,4 +1,4 @@
|
||||
From 12051b946e1a2fbe7faba1a7011db4dd05b3e727 Mon Sep 17 00:00:00 2001
|
||||
From 8613a4e2ae9a4bb6faef75b90d69728a88692dc1 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 4 Jul 2018 02:10:36 -0400
|
||||
Subject: [PATCH] Store reference to current Chunk for Entity and Block
|
||||
@ -81,28 +81,42 @@ index 4bbebb25a..68008fe6a 100644
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 3a8902bf1..f140d5e28 100644
|
||||
index 3a8902bf1..4af566b36 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -1703,6 +1703,24 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
@@ -1703,6 +1703,38 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
}
|
||||
|
||||
// Paper start
|
||||
+ private java.lang.ref.WeakReference<Chunk> currentChunk = null;
|
||||
+
|
||||
+ public void setCurrentChunk(Chunk chunk) {
|
||||
+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;
|
||||
+ }
|
||||
+ /**
|
||||
+ * Returns the entities current registered chunk. If the entity is not added to a chunk yet, it will return null
|
||||
+ */
|
||||
+ public Chunk getCurrentChunk() {
|
||||
+ final Chunk chunk = currentChunk != null ? currentChunk.get() : null;
|
||||
+ return chunk != null && chunk.isLoaded() ? chunk : null;
|
||||
+ }
|
||||
+ public void setCurrentChunk(Chunk chunk) {
|
||||
+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;
|
||||
+ }
|
||||
+ /**
|
||||
+ * Returns the chunk at the location, using the entities local cache if avail
|
||||
+ * Will only return null if the location specified is not loaded
|
||||
+ */
|
||||
+ public Chunk getCurrentChunkAt(int x, int z) {
|
||||
+ if (getChunkX() == x && getChunkZ() == z) {
|
||||
+ return getCurrentChunk();
|
||||
+ } else {
|
||||
+ return world.getChunkIfLoaded(x, z);
|
||||
+ Chunk chunk = getCurrentChunk();
|
||||
+ if (chunk != null) {
|
||||
+ return chunk;
|
||||
+ }
|
||||
+ }
|
||||
+ return world.getChunkIfLoaded(x, z);
|
||||
+ }
|
||||
+ /**
|
||||
+ * Returns the chunk at the entities current location, using the entities local cache if avail
|
||||
+ * Will only return null if the location specified is not loaded
|
||||
+ */
|
||||
+ public Chunk getChunkAtLocation() {
|
||||
+ return getCurrentChunkAt((int)Math.floor(locX) >> 4, (int)Math.floor(locZ) >> 4);
|
||||
+ }
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 16ff74ebe1e80730259a60e6803bad44733cb728 Mon Sep 17 00:00:00 2001
|
||||
From 3aa7c3bb231295a68bf403ab34f4b0dcc9e2696d Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Tue, 1 Mar 2016 14:14:15 -0600
|
||||
Subject: [PATCH] Drop falling block and tnt entities at the specified height
|
||||
@ -24,10 +24,10 @@ index 0094d1a87..4da846719 100644
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 05aad7dd0..bee8e632a 100644
|
||||
index 4540bf9f9..d358ab26a 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -1780,6 +1780,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
@@ -1794,6 +1794,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
return this.a(new ItemStack(item, i, 0), f);
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
From 5ad883e113f3989db0ce7fdb198f9b1990955142 Mon Sep 17 00:00:00 2001
|
||||
From eb34ce2535e4e16447bb108f92ca70742ff00a66 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Tue, 1 Mar 2016 23:45:08 -0600
|
||||
Subject: [PATCH] Entity Origin API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index bee8e632a..7f66f7579 100644
|
||||
index d358ab26a..011cf59c0 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -149,6 +149,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
@ -42,7 +42,7 @@ index bee8e632a..7f66f7579 100644
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
|
||||
@@ -1742,6 +1755,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
@@ -1756,6 +1769,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
||||
protected abstract void b(NBTTagCompound nbttagcompound);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From bb523c50d224b2ed674f592b66fb3bf6195269dc Mon Sep 17 00:00:00 2001
|
||||
From eb01ced7635cb5ef37aef6669d54e7b4e6a4cf72 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 8 Mar 2016 23:25:45 -0500
|
||||
Subject: [PATCH] Disable Scoreboards for non players by default
|
||||
@ -37,10 +37,10 @@ index ec9a87239..b08274d93 100644
|
||||
|
||||
if (scoreboard.addPlayerToTeam(s2, s)) {
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 158ee9e37..0e761997c 100644
|
||||
index 804104818..f547dbfd0 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -2109,6 +2109,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
@@ -2123,6 +2123,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
|
||||
@Nullable
|
||||
public ScoreboardTeamBase aY() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 615a75652424409cc5f097ea1cb71ce13ec4fb86 Mon Sep 17 00:00:00 2001
|
||||
From d24cf71aec74d0f22ad259e435ccbce611139fed Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 22 Mar 2016 00:55:23 -0400
|
||||
Subject: [PATCH] Don't teleport dead entities
|
||||
@ -7,10 +7,10 @@ Had some issue with this in past, and this is the vanilla logic.
|
||||
Potentially an old CB change that's no longer needed.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index b3eea4337..13035574e 100644
|
||||
index eb07d4233..e2202ed0c 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -2385,7 +2385,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
@@ -2399,7 +2399,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
}
|
||||
|
||||
public Entity teleportTo(Location exit, boolean portal) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 6b6bfc5c1d44feb7485d3e330c02983211794352 Mon Sep 17 00:00:00 2001
|
||||
From 90ca9d579f3d73834d58123205d8db9cfe179b56 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Wed, 6 Apr 2016 01:04:23 -0500
|
||||
Subject: [PATCH] Option to use vanilla per-world scoreboard coloring on names
|
||||
@ -19,10 +19,10 @@ index abc1aabdd..6ea608ba9 100644
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 13035574e..8f47ffd47 100644
|
||||
index e2202ed0c..88faa4601 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -2108,6 +2108,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
@@ -2122,6 +2122,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
return this.getFlag(5);
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ index 13035574e..8f47ffd47 100644
|
||||
public ScoreboardTeamBase aY() {
|
||||
if (!this.world.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof EntityHuman)) { return null; } // Paper
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 7c708a0de..9eb7b012f 100644
|
||||
index ba1cc267e..2b8162917 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -1390,7 +1390,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
|
@ -1,11 +1,11 @@
|
||||
From 577bace6c1eef300fd2970de0a10a377afe6e1ac Mon Sep 17 00:00:00 2001
|
||||
From eb11e43a94909435f4ce4020d2eded1eb0b8cdb1 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Fri, 22 Apr 2016 18:20:05 -0500
|
||||
Subject: [PATCH] Vehicle Event Cancellation Changes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 8f47ffd47..41fca4118 100644
|
||||
index 88faa4601..aece54d26 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -70,7 +70,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
@ -17,7 +17,7 @@ index 8f47ffd47..41fca4118 100644
|
||||
public boolean attachedToPlayer;
|
||||
public World world;
|
||||
public double lastX;
|
||||
@@ -1990,6 +1990,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
@@ -2004,6 +2004,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
@ -25,7 +25,7 @@ index 8f47ffd47..41fca4118 100644
|
||||
CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
|
||||
Entity orig = craft == null ? null : craft.getHandle();
|
||||
if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
|
||||
@@ -2005,7 +2006,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
@@ -2019,7 +2020,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 03dc46a921790b6f0fabdb28969547a4af7e7954 Mon Sep 17 00:00:00 2001
|
||||
From d45df5fa649ad40f1cb1057bc29f5f23aed74c96 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
|
||||
@ -32,7 +32,7 @@ index 067cb233e..06acdaaf0 100644
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index b6b4b581b..e77a3b2ab 100644
|
||||
index c105dd9b0..334441ed7 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -1114,6 +1114,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
@ -47,7 +47,7 @@ index b6b4b581b..e77a3b2ab 100644
|
||||
if (this.bJ() instanceof EntityBoat) {
|
||||
this.inWater = false;
|
||||
} else if (this.world.a(this.getBoundingBox().grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.001D), Material.WATER, this)) {
|
||||
@@ -2573,6 +2578,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
@@ -2587,6 +2592,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
}
|
||||
|
||||
public boolean bo() {
|
||||
|
@ -1,14 +1,14 @@
|
||||
From 06dc5de21c577e7757f5e38cbc88062fb62158c9 Mon Sep 17 00:00:00 2001
|
||||
From 977e13e598af25e22f19ad88220a047723a12193 Mon Sep 17 00:00:00 2001
|
||||
From: Alfie Cleveland <alfeh@me.com>
|
||||
Date: Sun, 8 Jan 2017 04:31:36 +0000
|
||||
Subject: [PATCH] Don't allow entities to ride themselves - #572
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index e4b45f2c7..8fbef57cc 100644
|
||||
index b6711dcfa..e7f63c927 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -1967,6 +1967,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
@@ -1981,6 +1981,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
}
|
||||
|
||||
protected void o(Entity entity) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 1fc278e5919f7644bd12ebb0eb81039c27faa37e Mon Sep 17 00:00:00 2001
|
||||
From b770be1d1eb24d049cd7ca1af1a96bb87aed62e3 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 10 Jun 2018 20:04:42 -0400
|
||||
Subject: [PATCH] Properly remove entities on dimension teleport
|
||||
@ -22,10 +22,10 @@ requirement, but plugins (such as my own) use this method to
|
||||
trigger a "reload" of the entity on the client.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index b61927c99..eff84f812 100644
|
||||
index 7b17c32bb..d03e7c24f 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -2435,7 +2435,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
@@ -2449,7 +2449,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
}
|
||||
// CraftBukkit end */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user