Relookup Entity Save ID if was null during precache

Should fix #1280

Citizens hijacks entity map, and im guessing under the right conditions
the result might actually be null during entity creation

Pre the cache patch, the id is looked up on save, so it was fine.

Now, if its null and the save ID is requested, we will try to look
it up again and cache it if found.
This commit is contained in:
Aikar 2018-07-26 23:57:31 -04:00
parent 42f6bebcc3
commit 8175ec916f
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
21 changed files with 125 additions and 115 deletions

View File

@ -1,4 +1,4 @@
From 471ff10805ee8ef1b93d19bd05a91b9f372417c9 Mon Sep 17 00:00:00 2001
From de17c631c117b92a3cb3256819347d169ed0225b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 01:40:13 -0400
Subject: [PATCH] Add MinecraftKey Information to Objects
@ -6,7 +6,7 @@ Subject: [PATCH] Add MinecraftKey Information to Objects
Stores the reference to the objects respective MinecraftKey
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index ed39b122e..3a8902bf1 100644
index ed39b122ec..06c72b95f3 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -41,7 +41,7 @@ import org.bukkit.event.entity.EntityPortalEvent;
@ -18,21 +18,26 @@ index ed39b122e..3a8902bf1 100644
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
@@ -1702,11 +1702,23 @@ public abstract class Entity implements ICommandListener {
@@ -1702,11 +1702,28 @@ public abstract class Entity implements ICommandListener {
return true;
}
+ // Paper start
+ public final MinecraftKey entityKey = EntityTypes.getKey(this);
+ public final String entityKeyString = entityKey != null ? entityKey.toString() : null;
+ private String entityKeyString = null;
+ private MinecraftKey entityKey = getMinecraftKey();
+
+ @Override
+ public MinecraftKey getMinecraftKey() {
+ if (entityKey == null) {
+ entityKey = EntityTypes.getKey(this);
+ entityKeyString = entityKey != null ? entityKey.toString() : null;
+ }
+ return entityKey;
+ }
+
+ @Override
+ public String getMinecraftKeyString() {
+ getMinecraftKey(); // Try to load if it doesn't exists. see: https://github.com/PaperMC/Paper/issues/1280
+ return entityKeyString;
+ }
@Nullable
@ -40,14 +45,14 @@ index ed39b122e..3a8902bf1 100644
- MinecraftKey minecraftkey = EntityTypes.a(this);
-
- return minecraftkey == null ? null : minecraftkey.toString();
+ return entityKeyString;
+ return getMinecraftKeyString();
+ // Paper end
}
protected abstract void a(NBTTagCompound nbttagcompound);
diff --git a/src/main/java/net/minecraft/server/KeyedObject.java b/src/main/java/net/minecraft/server/KeyedObject.java
new file mode 100644
index 000000000..61c2b993c
index 0000000000..61c2b993c9
--- /dev/null
+++ b/src/main/java/net/minecraft/server/KeyedObject.java
@@ -0,0 +1,8 @@
@ -60,7 +65,7 @@ index 000000000..61c2b993c
+ }
+}
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 5a5a588e7..672ba3134 100644
index 5a5a588e7c..0176ca530c 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -7,7 +7,7 @@ import org.apache.logging.log4j.Logger;
@ -72,23 +77,28 @@ index 5a5a588e7..672ba3134 100644
public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot
private static final Logger a = LogManager.getLogger();
@@ -27,8 +27,21 @@ public abstract class TileEntity {
@@ -27,8 +27,26 @@ public abstract class TileEntity {
TileEntity.f.a(new MinecraftKey(s), oclass);
}
- @Nullable
- public static MinecraftKey a(Class<? extends TileEntity> oclass) {
+ // Paper start
+ public final MinecraftKey tileEntityKey = getKey(this.getClass());
+ public final String tileEntityKeyString = tileEntityKey != null ? tileEntityKey.toString() : null;
+ private String tileEntityKeyString = null;
+ private MinecraftKey tileEntityKey = getMinecraftKey();
+
+ @Override
+ public MinecraftKey getMinecraftKey() {
+ if (tileEntityKey == null) {
+ tileEntityKey = getKey(this.getClass());
+ tileEntityKeyString = tileEntityKey != null ? tileEntityKey.toString() : null;
+ }
+ return tileEntityKey;
+ }
+
+ @Override
+ public String getMinecraftKeyString() {
+ getMinecraftKey(); // Try to load if it doesn't exists.
+ return tileEntityKeyString;
+ }
+ @Nullable public static MinecraftKey getKey(Class<? extends TileEntity> oclass) { return a(oclass); } // Paper - OBFHELPER

View File

@ -1,4 +1,4 @@
From ada548d469ddfd07d7ee05b4473b46eafbe104e0 Mon Sep 17 00:00:00 2001
From 67c7a52969344e723be71cbd2fed330ca8ffa28d 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
@ -8,7 +8,7 @@ This enables us a fast reference to the entities current chunk instead
of having to look it up by hashmap lookups.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 4bbebb25a..ea167a17b 100644
index 4bbebb25af..ea167a17bb 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -25,7 +25,7 @@ public class Chunk {
@ -81,7 +81,7 @@ index 4bbebb25a..ea167a17b 100644
// Keep this synced up with World.a(Class)
if (entity instanceof EntityInsentient) {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 3a8902bf1..4af566b36 100644
index 06c72b95f3..c107bd767f 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1703,6 +1703,38 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@ -120,11 +120,11 @@ index 3a8902bf1..4af566b36 100644
+ public Chunk getChunkAtLocation() {
+ return getCurrentChunkAt((int)Math.floor(locX) >> 4, (int)Math.floor(locZ) >> 4);
+ }
public final MinecraftKey entityKey = EntityTypes.getKey(this);
public final String entityKeyString = entityKey != null ? entityKey.toString() : null;
private String entityKeyString = null;
private MinecraftKey entityKey = getMinecraftKey();
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 672ba3134..d7132c3c0 100644
index 0176ca530c..29069b753e 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -28,6 +28,14 @@ public abstract class TileEntity implements KeyedObject {
@ -139,11 +139,11 @@ index 672ba3134..d7132c3c0 100644
+ public void setCurrentChunk(Chunk chunk) {
+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;
+ }
public final MinecraftKey tileEntityKey = getKey(this.getClass());
public final String tileEntityKeyString = tileEntityKey != null ? tileEntityKey.toString() : null;
private String tileEntityKeyString = null;
private MinecraftKey tileEntityKey = getMinecraftKey();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index c5a194ffe..833e3111d 100644
index c5a194ffea..833e3111de 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -9,6 +9,7 @@ import java.util.UUID;

View File

@ -1,4 +1,4 @@
From 20c6d16a7db36e57bde2a9bac4e5bb99d606239a Mon Sep 17 00:00:00 2001
From 7feae31914ee5d50576995af8fbe35a44b1f0de3 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 02:13:59 -0400
Subject: [PATCH] Store counts for each Entity/Block Entity Type
@ -6,7 +6,7 @@ Subject: [PATCH] Store counts for each Entity/Block Entity Type
Opens door for future patches to optimize performance
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index ea167a17b..77fdb3c4a 100644
index ea167a17bb..efcece7857 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -34,15 +34,19 @@ public class Chunk {
@ -21,11 +21,11 @@ index ea167a17b..77fdb3c4a 100644
TileEntity replaced = super.put(key, value);
if (replaced != null) {
replaced.setCurrentChunk(null);
+ tileEntityCounts.decrement(replaced.tileEntityKeyString);
+ tileEntityCounts.decrement(replaced.getMinecraftKeyString());
}
if (value != null) {
value.setCurrentChunk(Chunk.this);
+ tileEntityCounts.increment(value.tileEntityKeyString);
+ tileEntityCounts.increment(value.getMinecraftKeyString());
}
return replaced;
}
@ -33,7 +33,7 @@ index ea167a17b..77fdb3c4a 100644
TileEntity removed = super.remove(key);
if (removed != null) {
removed.setCurrentChunk(null);
+ tileEntityCounts.decrement(removed.tileEntityKeyString);
+ tileEntityCounts.decrement(removed.getMinecraftKeyString());
}
return removed;
}
@ -41,7 +41,7 @@ index ea167a17b..77fdb3c4a 100644
this.entitySlices[k].add(entity);
// Paper start
entity.setCurrentChunk(this);
+ entityCounts.increment(entity.entityKeyString);
+ entityCounts.increment(entity.getMinecraftKeyString());
// Paper end
// Spigot start - increment creature type count
// Keep this synced up with World.a(Class)
@ -49,7 +49,7 @@ index ea167a17b..77fdb3c4a 100644
this.entitySlices[i].remove(entity);
// Paper start
entity.setCurrentChunk(null);
+ entityCounts.decrement(entity.entityKeyString);
+ entityCounts.decrement(entity.getMinecraftKeyString());
// Paper end
// Spigot start - decrement creature type count
// Keep this synced up with World.a(Class)

View File

@ -1,11 +1,11 @@
From 3aa7c3bb231295a68bf403ab34f4b0dcc9e2696d Mon Sep 17 00:00:00 2001
From 3245f2a838cecf17e9f9a315f5435b8a0c08ae48 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
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0094d1a87..4da846719 100644
index 0094d1a87d..4da846719d 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -113,4 +113,14 @@ public class PaperWorldConfig {
@ -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 4540bf9f9..d358ab26a 100644
index 459bdbd6ec..335d2ce4cb 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1794,6 +1794,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -1799,6 +1799,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
return this.a(new ItemStack(item, i, 0), f);
}
@ -36,7 +36,7 @@ index 4540bf9f9..d358ab26a 100644
public EntityItem a(ItemStack itemstack, float f) {
if (itemstack.isEmpty()) {
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 579e51a0a..2ba5d51a5 100644
index 579e51a0aa..2ba5d51a5f 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -84,6 +84,17 @@ public class EntityFallingBlock extends Entity {
@ -58,7 +58,7 @@ index 579e51a0a..2ba5d51a5 100644
blockposition = new BlockPosition(this);
boolean flag = this.block.getBlock() == Blocks.dS;
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 44b2d4735..0d70dd1d2 100644
index 44b2d47351..0d70dd1d22 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -57,6 +57,13 @@ public class EntityTNTPrimed extends Entity {

View File

@ -1,11 +1,11 @@
From eb34ce2535e4e16447bb108f92ca70742ff00a66 Mon Sep 17 00:00:00 2001
From 40d24e0192a049584a4c70c8474ae23346e50f2d 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 d358ab26a..011cf59c0 100644
index 335d2ce4cb..cea987f33e 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 d358ab26a..011cf59c0 100644
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
@@ -1756,6 +1769,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -1761,6 +1774,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
protected abstract void b(NBTTagCompound nbttagcompound);
@ -51,7 +51,7 @@ index d358ab26a..011cf59c0 100644
NBTTagList nbttaglist = new NBTTagList();
double[] adouble1 = adouble;
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 2ba5d51a5..abdc2dea9 100644
index 2ba5d51a5f..abdc2dea9b 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -267,6 +267,14 @@ public class EntityFallingBlock extends Entity {
@ -70,7 +70,7 @@ index 2ba5d51a5..abdc2dea9 100644
public void a(boolean flag) {
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 0d70dd1d2..bb0904f86 100644
index 0d70dd1d22..bb0904f865 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -109,6 +109,14 @@ public class EntityTNTPrimed extends Entity {
@ -89,7 +89,7 @@ index 0d70dd1d2..bb0904f86 100644
@Nullable
diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java
index bc6383669..ca9eb2f3b 100644
index bc6383669e..ca9eb2f3b2 100644
--- a/src/main/java/net/minecraft/server/NBTTagList.java
+++ b/src/main/java/net/minecraft/server/NBTTagList.java
@@ -153,6 +153,7 @@ public class NBTTagList extends NBTBase {
@ -101,7 +101,7 @@ index bc6383669..ca9eb2f3b 100644
if (i >= 0 && i < this.list.size()) {
NBTBase nbtbase = (NBTBase) this.list.get(i);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 26d4bd690..31b765dea 100644
index 26d4bd690b..31b765deaf 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1071,6 +1071,12 @@ public abstract class World implements IBlockAccess {
@ -118,7 +118,7 @@ index 26d4bd690..31b765dea 100644
flag = true;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 833e3111d..6c23e88a5 100644
index 833e3111de..6c23e88a54 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -761,4 +761,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

View File

@ -1,14 +1,14 @@
From f0ff71ed88b27c82c77ecc140d2dd068749f9807 Mon Sep 17 00:00:00 2001
From 8ed8aaa564e0285d9c0ff6dd5308c66186db4c41 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 1 Mar 2016 23:52:34 -0600
Subject: [PATCH] Prevent tile entity and entity crashes
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 15f18ba1d..33e245e4c 100644
index 081e56f481..f191225c62 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -196,7 +196,12 @@ public abstract class TileEntity implements KeyedObject {
@@ -201,7 +201,12 @@ public abstract class TileEntity implements KeyedObject {
}
});
if (this.world != null) {
@ -23,7 +23,7 @@ index 15f18ba1d..33e245e4c 100644
public String a() throws Exception {
int i = Block.getId(TileEntity.this.world.getType(TileEntity.this.position).getBlock());
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 31b765dea..fd5f8102a 100644
index 31b765deaf..fd5f8102af 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1449,10 +1449,12 @@ public abstract class World implements IBlockAccess {

View File

@ -1,4 +1,4 @@
From 8878c3563aa9f2217bd4ea486aa52ee394b69f01 Mon Sep 17 00:00:00 2001
From 4e0067394fe5e3d753349255621049ff01869afb Mon Sep 17 00:00:00 2001
From: CullanP <cullanpage@gmail.com>
Date: Thu, 3 Mar 2016 02:13:38 -0600
Subject: [PATCH] Avoid hopper searches if there are no items
@ -14,7 +14,7 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear
Combined, this adds up a lot.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index d6f6cfef2..08d6ef09a 100644
index 42d27e0362..be386716be 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -76,6 +76,13 @@ public class Chunk {
@ -34,7 +34,7 @@ index d6f6cfef2..08d6ef09a 100644
@@ -651,6 +658,11 @@ public class Chunk {
// Paper start
entity.setCurrentChunk(this);
entityCounts.increment(entity.entityKeyString);
entityCounts.increment(entity.getMinecraftKeyString());
+ if (entity instanceof EntityItem) {
+ itemCounts[k]++;
+ } else if (entity instanceof IInventory) {
@ -46,7 +46,7 @@ index d6f6cfef2..08d6ef09a 100644
@@ -687,6 +699,11 @@ public class Chunk {
// Paper start
entity.setCurrentChunk(null);
entityCounts.decrement(entity.entityKeyString);
entityCounts.decrement(entity.getMinecraftKeyString());
+ if (entity instanceof EntityItem) {
+ itemCounts[i]--;
+ } else if (entity instanceof IInventory) {

View File

@ -1,4 +1,4 @@
From eb01ced7635cb5ef37aef6669d54e7b4e6a4cf72 Mon Sep 17 00:00:00 2001
From e974cc2dc77b8e3ca057231ad712724603872f56 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
@ -11,7 +11,7 @@ So avoid looking up scoreboards and short circuit to the "not on a team"
logic which is most likely to be true.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index b241c0380..a4c94845b 100644
index b241c0380d..a4c94845b8 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -242,4 +242,9 @@ public class PaperWorldConfig {
@ -25,7 +25,7 @@ index b241c0380..a4c94845b 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/CommandScoreboard.java b/src/main/java/net/minecraft/server/CommandScoreboard.java
index ec9a87239..b08274d93 100644
index ec9a87239a..b08274d933 100644
--- a/src/main/java/net/minecraft/server/CommandScoreboard.java
+++ b/src/main/java/net/minecraft/server/CommandScoreboard.java
@@ -492,6 +492,7 @@ public class CommandScoreboard extends CommandAbstract {
@ -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 804104818..f547dbfd0 100644
index 9d6e684d26..a03a809d61 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2123,6 +2123,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2128,6 +2128,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@Nullable
public ScoreboardTeamBase aY() {

View File

@ -1,4 +1,4 @@
From 3faa48aebbc50348a1c69b43c8f4be1f0d8d78e8 Mon Sep 17 00:00:00 2001
From 92be596a29c450456eb1ff4aba0306aa090999ff 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 daf97bce3..87b82f908 100644
index ff854e1ab9..fd193bbece 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2412,7 +2412,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2417,7 +2417,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
public Entity teleportTo(Location exit, boolean portal) {

View File

@ -1,11 +1,11 @@
From 0f917b2215537ad0e4c08b4c4add7ad3bdec07c7 Mon Sep 17 00:00:00 2001
From e460a38fa7693771218e49ab68a7de69492de0e9 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
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index abc1aabdd..6ea608ba9 100644
index abc1aabdd8..6ea608ba9a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -288,4 +288,9 @@ public class PaperWorldConfig {
@ -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 87b82f908..fa9319aff 100644
index fd193bbece..89e42c0a46 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2135,6 +2135,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2140,6 +2140,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
return this.getFlag(5);
}
@ -31,7 +31,7 @@ index 87b82f908..fa9319aff 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 ba1cc267e..2b8162917 100644
index ba1cc267e6..2b81629170 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 {

View File

@ -1,4 +1,4 @@
From f7b327727e2ac3ad221592ae2b97c64d9297c702 Mon Sep 17 00:00:00 2001
From a95213605057d27a9ab8ec79291e1354cee01106 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 14 Apr 2016 21:01:39 -0400
Subject: [PATCH] Fix Bugs with Spigot Mob Spawn Logic
@ -14,7 +14,7 @@ Specially with servers using smaller mob spawn ranges than view distance, as wel
This patch returns mob counting to use all loaded chunks, and 17x17 division.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index da7b59434..1157bc7eb 100644
index e9a44098d9..6c86d3b6bc 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -714,8 +714,8 @@ public class Chunk {
@ -25,10 +25,10 @@ index da7b59434..1157bc7eb 100644
// Paper start
+ if (!this.entitySlices[i].remove(entity)) { return; }
entity.setCurrentChunk(null);
entityCounts.decrement(entity.entityKeyString);
entityCounts.decrement(entity.getMinecraftKeyString());
if (entity instanceof EntityItem) {
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 45a83ae99..ed22607d9 100644
index 45a83ae995..ed22607d91 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -23,6 +23,15 @@ public final class SpawnerCreature {

View File

@ -1,11 +1,11 @@
From 59d26d28500f04c9cced47dc4c99d71fc7efb7e5 Mon Sep 17 00:00:00 2001
From e834b8fc7de6fc3a3460176d2c23e77d3c5afce3 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 fa9319aff..a3e9ee052 100644
index 89e42c0a46..86b783e73b 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -83,7 +83,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@ -17,7 +17,7 @@ index fa9319aff..a3e9ee052 100644
public boolean attachedToPlayer;
public World world;
public double lastX;
@@ -2017,6 +2017,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2022,6 +2022,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 fa9319aff..a3e9ee052 100644
CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
Entity orig = craft == null ? null : craft.getHandle();
if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
@@ -2032,7 +2033,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2037,7 +2038,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
}
// CraftBukkit end

View File

@ -1,11 +1,11 @@
From 036e57626907e289a1c0a842460a9bac8da4e5d3 Mon Sep 17 00:00:00 2001
From c75aa93b1c1e98ce0d1f87d73720311182848d68 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 067cb233e..06acdaaf0 100644
index 067cb233e4..06acdaaf04 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;
@ -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 9b01c23e0..0a62ebf4a 100644
index 0456cda937..2fbe17ce9d 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1127,6 +1127,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@ -47,7 +47,7 @@ index 9b01c23e0..0a62ebf4a 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)) {
@@ -2600,6 +2605,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2605,6 +2610,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
public boolean bo() {
@ -60,7 +60,7 @@ index 9b01c23e0..0a62ebf4a 100644
}
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index bb0904f86..50811852a 100644
index bb0904f865..50811852a3 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -147,4 +147,49 @@ public class EntityTNTPrimed extends Entity {

View File

@ -1,14 +1,14 @@
From 512e2cf16911c2f07c0c5b763d4b56b1788344fb Mon Sep 17 00:00:00 2001
From 8b87011bb2c827251749bcd3bb5df2f48244a212 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 6d1e61e23..92b2bcb86 100644
index 26a76ec972..d156563b08 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1994,6 +1994,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -1999,6 +1999,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
protected void o(Entity entity) {

View File

@ -1,4 +1,4 @@
From 955230d3e8ac631d5b64a60aab4c0c97dc0e95ba Mon Sep 17 00:00:00 2001
From a8bc4c6ef79676c1a9ce64658f95a3963c149688 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 6 Nov 2017 21:08:22 -0500
Subject: [PATCH] API to get a BlockState without a snapshot
@ -13,10 +13,10 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE
If Tile Entity was null, correct Sign to return empty lines instead of null
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 358c99227..5b5f102e2 100644
index b4a7db2b66..30d3e19de8 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -285,7 +285,12 @@ public abstract class TileEntity implements KeyedObject {
@@ -290,7 +290,12 @@ public abstract class TileEntity implements KeyedObject {
}
// CraftBukkit start - add method
@ -29,7 +29,7 @@ index 358c99227..5b5f102e2 100644
if (world == null) return null;
// Spigot start
org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
@@ -294,7 +299,7 @@ public abstract class TileEntity implements KeyedObject {
@@ -299,7 +304,7 @@ public abstract class TileEntity implements KeyedObject {
return null;
}
// Spigot end
@ -39,7 +39,7 @@ index 358c99227..5b5f102e2 100644
return null;
}
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
index 54b719d91..3f2c5b2d5 100644
index 54b719d917..3f2c5b2d5c 100644
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
@@ -60,7 +60,7 @@ public class TileEntitySign extends TileEntity {
@ -52,7 +52,7 @@ index 54b719d91..3f2c5b2d5 100644
};
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 46670c346..a9d3f12bc 100644
index 46670c3466..a9d3f12bc6 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -260,7 +260,22 @@ public class CraftBlock implements Block {
@ -79,7 +79,7 @@ index 46670c346..a9d3f12bc 100644
switch (material) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
index 266f87d7f..fe112812d 100644
index 266f87d7f1..fe112812d1 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -22,20 +22,40 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
@ -129,7 +129,7 @@ index 266f87d7f..fe112812d 100644
private T createSnapshot(T tileEntity) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
index 7a8d44529..97b4e6910 100644
index 7a8d445299..97b4e6910d 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
@@ -14,10 +14,12 @@ public class CraftSign extends CraftBlockEntityState<TileEntitySign> implements

View File

@ -1,4 +1,4 @@
From ce497ce0dd8da9d9b5a3bbddf60f8bfcd70fd03e Mon Sep 17 00:00:00 2001
From 7cd85ceb045d6fc847caa3af14fde0c9ac06e7cf Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 27 Apr 2016 22:09:52 -0400
Subject: [PATCH] Optimize Hoppers
@ -11,7 +11,7 @@ Subject: [PATCH] Optimize Hoppers
* Skip subsequent InventoryMoveItemEvents if a plugin does not use the item after first event fire for an iteration
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 9fd76dcc9..363e03b65 100644
index 9fd76dcc90..363e03b65d 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -489,4 +489,12 @@ public class PaperWorldConfig {
@ -28,7 +28,7 @@ index 9fd76dcc9..363e03b65 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index fcf6bac08..3092913f5 100644
index fcf6bac08f..3092913f5b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -876,6 +876,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@ -40,10 +40,10 @@ index fcf6bac08..3092913f5 100644
this.methodProfiler.a(() -> {
return worldserver.getWorldData().getName();
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 5b5f102e2..3f6b34489 100644
index 30d3e19de8..54bfbfc6bc 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -55,6 +55,7 @@ public abstract class TileEntity implements KeyedObject {
@@ -60,6 +60,7 @@ public abstract class TileEntity implements KeyedObject {
return (MinecraftKey) TileEntity.f.b(oclass);
}
@ -51,7 +51,7 @@ index 5b5f102e2..3f6b34489 100644
public World getWorld() {
return this.world;
}
@@ -133,6 +134,7 @@ public abstract class TileEntity implements KeyedObject {
@@ -138,6 +139,7 @@ public abstract class TileEntity implements KeyedObject {
public void update() {
if (this.world != null) {
@ -60,7 +60,7 @@ index 5b5f102e2..3f6b34489 100644
this.g = iblockdata.getBlock().toLegacyData(iblockdata);
diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java
index e9315f2d5..5198a590a 100644
index e9315f2d5c..5198a590a7 100644
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
@@ -196,6 +196,154 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi

View File

@ -1,4 +1,4 @@
From 11c4b454e2dca08dc7d8823bf7d533e20d67c7ef Mon Sep 17 00:00:00 2001
From e1b60705c11cb4eedbe9ea30504df1012cb58dd9 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 2dbb88f2d..80ecdb282 100644
index ea2502409d..71da8e1e7d 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2462,7 +2462,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2467,7 +2467,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
// CraftBukkit end */
@ -35,7 +35,7 @@ index 2dbb88f2d..80ecdb282 100644
this.world.methodProfiler.a("reposition");
/* CraftBukkit start - Handled in calculateTarget
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 49019d54d..bba2e164f 100644
index 49019d54d5..bba2e164f2 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1205,6 +1205,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {

View File

@ -1,4 +1,4 @@
From b0c9be521fc1613e6ab93cbc058b8fbf2de7068a Mon Sep 17 00:00:00 2001
From 1f2212fa5986435d4cd3bb3f4cd62821d7246d66 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 19 Jul 2018 01:13:28 -0400
Subject: [PATCH] add more information to Entity.toString()
@ -6,10 +6,10 @@ Subject: [PATCH] add more information to Entity.toString()
UUID, ticks lived, valid, dead
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 80ecdb282..99dac412f 100644
index 71da8e1e7d..28713f045d 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2361,7 +2361,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2366,7 +2366,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
public String toString() {

View File

@ -1,4 +1,4 @@
From 60078ed225caffbeab2732eb4a64364d9d342341 Mon Sep 17 00:00:00 2001
From 4452cada18204294fb8059bdefe9da4e3f246480 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 21 Jul 2018 14:27:34 -0400
Subject: [PATCH] Duplicate UUID Resolve Option
@ -33,7 +33,7 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA
It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 14c8edeff..e3f6557e1 100644
index 14c8edeffc..e3f6557e1f 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -541,4 +541,40 @@ public class PaperWorldConfig {
@ -78,7 +78,7 @@ index 14c8edeff..e3f6557e1 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 04adf4e3c..b31c301ec 100644
index f1815d3766..7a62fae332 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1,5 +1,10 @@
@ -145,10 +145,10 @@ index 04adf4e3c..b31c301ec 100644
this.world.a((Collection) entityslice);
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 0d3af8cb7..7188d0c99 100644
index 93ab050fa6..fdabb1e369 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2614,6 +2614,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2619,6 +2619,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
});
}
@ -157,7 +157,7 @@ index 0d3af8cb7..7188d0c99 100644
this.uniqueID = uuid;
this.ar = this.uniqueID.toString();
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 994d4bbb8..1244baf45 100644
index 994d4bbb84..1244baf45a 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -42,7 +42,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {

View File

@ -1,4 +1,4 @@
From 37c0cfe11574838ad8c24863a4b926e0b88878d5 Mon Sep 17 00:00:00 2001
From 6ea5914741d70c9656d108d609a4378a903e087e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 23 Jul 2018 22:18:31 -0400
Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it
@ -6,7 +6,7 @@ Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index b31c301ec..6de053781 100644
index 7a62fae332..eaee492010 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -683,6 +683,7 @@ public class Chunk {
@ -15,7 +15,7 @@ index b31c301ec..6de053781 100644
// Paper start
+ this.markDirty();
entity.setCurrentChunk(this);
entityCounts.increment(entity.entityKeyString);
entityCounts.increment(entity.getMinecraftKeyString());
if (entity instanceof EntityItem) {
@@ -725,6 +726,7 @@ public class Chunk {
@ -23,7 +23,7 @@ index b31c301ec..6de053781 100644
if (!this.entitySlices[i].remove(entity)) { return; }
+ this.markDirty();
entity.setCurrentChunk(null);
entityCounts.decrement(entity.entityKeyString);
entityCounts.decrement(entity.getMinecraftKeyString());
if (entity instanceof EntityItem) {
--
2.18.0

View File

@ -1,4 +1,4 @@
From 80a062ecc95b8346f6a9161e375e41d5f5df3882 Mon Sep 17 00:00:00 2001
From f66a29c8dbea9062242445480ebaf1db98c8b0f7 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 23 Jul 2018 22:44:23 -0400
Subject: [PATCH] Add some Debug to Chunk Entity slices
@ -9,7 +9,7 @@ This should hopefully avoid duplicate entities ever being created
if the entity was to end up in 2 different chunk slices
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 6de053781..be0b411e5 100644
index eaee492010..1787607622 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -681,8 +681,33 @@ public class Chunk {
@ -46,7 +46,7 @@ index 6de053781..be0b411e5 100644
+
this.markDirty();
entity.setCurrentChunk(this);
entityCounts.increment(entity.entityKeyString);
entityCounts.increment(entity.getMinecraftKeyString());
@@ -726,6 +751,12 @@ public class Chunk {
// Paper start
@ -59,9 +59,9 @@ index 6de053781..be0b411e5 100644
+ }
this.markDirty();
entity.setCurrentChunk(null);
entityCounts.decrement(entity.entityKeyString);
entityCounts.decrement(entity.getMinecraftKeyString());
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 7188d0c99..b3120d7cc 100644
index fdabb1e369..89f9bd347b 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -59,6 +59,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper