Numerous fixes to entity related changes

While it wasn't really "broken" before, if plugins use NMS
(which they really should't be) and mess with entity management
themselves, and get it wrong, they could ultimately corrupt our
state expectations.

I've been unable to reproduce any issues locally, but these changes
are the result of me analyzing the code pretty deeply and seeing
about how to make it more durable to abnormal usage.

Any servers seeing oddities, please run with -Ddebug.entities=true
and send me any logs triggered.
This commit is contained in:
Aikar 2019-04-05 23:08:45 -04:00
parent 5c0133110b
commit 9dc4d6448b
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
33 changed files with 325 additions and 343 deletions

View File

@ -1,4 +1,4 @@
From 3da86d2abcd148f2ceed99d9ebafd5ea70e9f9d9 Mon Sep 17 00:00:00 2001
From b9facb273ca6721a832a5e9c4f7cf69ab6e5bbf6 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 417c015e5..b728a44f5 100644
index 417c015e56..95a51ab745 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -36,7 +36,7 @@ public class Chunk implements IChunkAccess {
@ -60,41 +60,39 @@ index 417c015e5..b728a44f5 100644
this.p = Maps.newHashMap();
this.q = Maps.newHashMap();
this.r = new ShortList[16];
@@ -657,6 +680,9 @@ public class Chunk implements IChunkAccess {
@@ -653,6 +676,7 @@ public class Chunk implements IChunkAccess {
}
entity.inChunk = true;
+ entity.setCurrentChunk(this); // Paper
entity.chunkX = this.locX;
entity.chunkY = k;
entity.chunkZ = this.locZ;
this.entitySlices[k].add(entity);
+ // Paper start
+ entity.setCurrentChunk(this);
+ // Paper end
@@ -663,6 +687,7 @@ public class Chunk implements IChunkAccess {
((HeightMap) this.heightMap.get(heightmap_type)).a(along);
}
public void a(HeightMap.Type heightmap_type, long[] along) {
@@ -675,8 +701,12 @@ public class Chunk implements IChunkAccess {
+ public void removeEntity(Entity entity) { this.b(entity); } // Paper - OBFHELPER
public void b(Entity entity) {
this.a(entity, entity.chunkY);
}
@@ -675,8 +700,12 @@ public class Chunk implements IChunkAccess {
if (i >= this.entitySlices.length) {
i = this.entitySlices.length - 1;
}
-
- this.entitySlices[i].remove(entity);
+ // Paper start
+ if (entity.currentChunk != null && entity.currentChunk.get() == this) entity.setCurrentChunk(null);
+ if (!this.entitySlices[i].remove(entity)) {
+ return;
+ }
+ entity.setCurrentChunk(null);
+ // Paper end
}
public boolean c(BlockPosition blockposition) {
@@ -885,6 +915,7 @@ public class Chunk implements IChunkAccess {
}
}
// Spigot End
+ entity.setCurrentChunk(null); // Paper
// Do not pass along players, as doing so can get them stuck outside of time.
// (which for example disables inventory icon updates and prevents block breaking)
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index d9c9748ce..3b8d09953 100644
index d9c9748cec..bdb4ca7643 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -132,7 +132,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -110,7 +108,7 @@ index d9c9748ce..3b8d09953 100644
}
// Paper start
+ private java.lang.ref.WeakReference<Chunk> currentChunk = null;
+ java.lang.ref.WeakReference<Chunk> currentChunk = null;
+
+ public void setCurrentChunk(Chunk chunk) {
+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;
@ -147,7 +145,7 @@ index d9c9748ce..3b8d09953 100644
private String entityKeyString;
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 7390061bf..c69209497 100644
index 7390061bf0..c69209497b 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -41,6 +41,15 @@ public abstract class TileEntity implements KeyedObject { // Paper
@ -167,7 +165,7 @@ index 7390061bf..c69209497 100644
@Nullable
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 9cdd0331f..7edbbb106 100644
index 9cdd0331f4..7edbbb106b 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 fcea42cc3d3d4bc1e4ade7725e589b16b6a018e3 Mon Sep 17 00:00:00 2001
From dbaafc47c5209214b5bd44396640cbf5da05c453 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 b728a44f5..23dee9b56 100644
index 95a51ab745..554fbeb071 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -67,15 +67,19 @@ public class Chunk implements IChunkAccess {
@ -37,22 +37,22 @@ index b728a44f5..23dee9b56 100644
}
return removed;
}
@@ -682,6 +687,7 @@ public class Chunk implements IChunkAccess {
this.entitySlices[k].add(entity);
// Paper start
entity.setCurrentChunk(this);
+ entityCounts.increment(entity.getMinecraftKeyString());
// Paper end
}
@@ -675,6 +680,7 @@ public class Chunk implements IChunkAccess {
k = this.entitySlices.length - 1;
}
@@ -706,6 +712,7 @@ public class Chunk implements IChunkAccess {
+ if (!entity.inChunk || entity.getCurrentChunk() != this) entityCounts.increment(entity.getMinecraftKeyString()); // Paper
entity.inChunk = true;
entity.setCurrentChunk(this); // Paper
entity.chunkX = this.locX;
@@ -705,6 +711,7 @@ public class Chunk implements IChunkAccess {
if (!this.entitySlices[i].remove(entity)) {
return;
}
entity.setCurrentChunk(null);
+ entityCounts.decrement(entity.getMinecraftKeyString());
// Paper end
}
--
2.20.1
2.21.0

View File

@ -1,4 +1,4 @@
From a633d98c7eded4f7345616985fe256159d9c1ae1 Mon Sep 17 00:00:00 2001
From e84716d2f76eee566d1a8b95074f1d84127d2ab9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 04:00:11 -0600
Subject: [PATCH] Timings v2
@ -6,7 +6,7 @@ Subject: [PATCH] Timings v2
diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
new file mode 100644
index 000000000..7a2a27cdb
index 0000000000..7a2a27cdb4
--- /dev/null
+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java
@@ -0,0 +1,132 @@
@ -144,7 +144,7 @@ index 000000000..7a2a27cdb
+}
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
new file mode 100644
index 000000000..145cb274b
index 0000000000..145cb274b0
--- /dev/null
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
@@ -0,0 +1,104 @@
@ -253,7 +253,7 @@ index 000000000..145cb274b
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index c4c1877d5..1256a0d58 100644
index 5518ec1e54..7691409f6c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -14,11 +14,14 @@ import java.util.concurrent.TimeUnit;
@ -297,7 +297,7 @@ index c4c1877d5..1256a0d58 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index e89ba3e41..1dc13fcc3 100644
index e89ba3e412..1dc13fcc30 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -22,6 +22,15 @@ public class Block implements IMaterial {
@ -317,10 +317,10 @@ index e89ba3e41..1dc13fcc3 100644
private final float frictionFactor;
protected final BlockStateList<Block, IBlockData> blockStateList;
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 23dee9b56..eca1284cc 100644
index 554fbeb071..2b1198ca8f 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -854,6 +854,7 @@ public class Chunk implements IChunkAccess {
@@ -853,6 +853,7 @@ public class Chunk implements IChunkAccess {
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(this.bukkitChunk, this.needsDecoration));
if (this.needsDecoration) {
@ -328,7 +328,7 @@ index 23dee9b56..eca1284cc 100644
BlockSand.instaFall = true;
java.util.Random random = new java.util.Random();
random.setSeed(world.getSeed());
@@ -874,6 +875,7 @@ public class Chunk implements IChunkAccess {
@@ -873,6 +874,7 @@ public class Chunk implements IChunkAccess {
}
BlockSand.instaFall = false;
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk));
@ -337,7 +337,7 @@ index 23dee9b56..eca1284cc 100644
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/ChunkMap.java b/src/main/java/net/minecraft/server/ChunkMap.java
index df2711a5f..732c8793e 100644
index df2711a5f8..732c8793e5 100644
--- a/src/main/java/net/minecraft/server/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/ChunkMap.java
@@ -14,6 +14,7 @@ public class ChunkMap extends Long2ObjectOpenHashMap<Chunk> {
@ -357,7 +357,7 @@ index df2711a5f..732c8793e 100644
return chunk1;
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index a8cdcb7da..eb83e20d5 100644
index a8cdcb7da8..eb83e20d50 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -88,7 +88,7 @@ public class ChunkProviderServer implements IChunkProvider {
@ -398,7 +398,7 @@ index a8cdcb7da..eb83e20d5 100644
this.chunkLoader.saveChunk(this.world, ichunkaccess, unloaded); // Spigot
} catch (IOException ioexception) {
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 8e5ce6c18..35976a26f 100644
index 8e5ce6c181..35976a26f3 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -1,5 +1,6 @@
@ -445,7 +445,7 @@ index 8e5ce6c18..35976a26f 100644
}
diff --git a/src/main/java/net/minecraft/server/CustomFunction.java b/src/main/java/net/minecraft/server/CustomFunction.java
index 65574eb2e..bc87cfc4b 100644
index 65574eb2e5..bc87cfc4b6 100644
--- a/src/main/java/net/minecraft/server/CustomFunction.java
+++ b/src/main/java/net/minecraft/server/CustomFunction.java
@@ -12,12 +12,22 @@ public class CustomFunction {
@ -472,7 +472,7 @@ index 65574eb2e..bc87cfc4b 100644
return this.b;
}
diff --git a/src/main/java/net/minecraft/server/CustomFunctionData.java b/src/main/java/net/minecraft/server/CustomFunctionData.java
index f28f4f3cd..6b417be1d 100644
index f28f4f3cd3..6b417be1dd 100644
--- a/src/main/java/net/minecraft/server/CustomFunctionData.java
+++ b/src/main/java/net/minecraft/server/CustomFunctionData.java
@@ -100,7 +100,7 @@ public class CustomFunctionData implements ITickable, IResourcePackListener {
@ -485,7 +485,7 @@ index f28f4f3cd..6b417be1d 100644
int j = 0;
CustomFunction.c[] acustomfunction_c = customfunction.b();
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index ad9c00bc8..4e9ef43b4 100644
index ad9c00bc80..4e9ef43b45 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -29,7 +29,7 @@ import org.apache.logging.log4j.Level;
@ -538,7 +538,7 @@ index ad9c00bc8..4e9ef43b4 100644
return waitable.get();
} catch (java.util.concurrent.ExecutionException e) {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 3b8d09953..3f13aaa52 100644
index bdb4ca7643..131946154e 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -27,7 +27,8 @@ import org.bukkit.command.CommandSender;
@ -577,7 +577,7 @@ index 3b8d09953..3f13aaa52 100644
protected float ab() {
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 011c7af21..b092b0fa2 100644
index 011c7af218..b092b0fa23 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -32,7 +32,7 @@ import org.bukkit.event.entity.EntityTeleportEvent;
@ -653,7 +653,7 @@ index 011c7af21..b092b0fa2 100644
}
diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java
index cd462f7df..45ab33d1a 100644
index cd462f7dfc..45ab33d1ae 100644
--- a/src/main/java/net/minecraft/server/EntityTracker.java
+++ b/src/main/java/net/minecraft/server/EntityTracker.java
@@ -168,7 +168,7 @@ public class EntityTracker {
@ -684,7 +684,7 @@ index cd462f7df..45ab33d1a 100644
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 72de40434..7e89d7158 100644
index 72de40434f..7e89d7158b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1,5 +1,6 @@
@ -837,7 +837,7 @@ index 72de40434..7e89d7158 100644
this.methodProfiler.exit();
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index c24f4a8fe..e01222ad2 100644
index c24f4a8fea..e01222ad2b 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -1,5 +1,6 @@
@ -929,7 +929,7 @@ index c24f4a8fe..e01222ad2 100644
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index d97cc4f72..1c90c9d7a 100644
index d97cc4f727..1c90c9d7a3 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -58,6 +58,7 @@ import org.bukkit.inventory.CraftingInventory;
@ -984,7 +984,7 @@ index d97cc4f72..1c90c9d7a 100644
// this.minecraftServer.getCommandDispatcher().a(this.player.getCommandListener(), s);
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java
index a73947d26..596aa27fe 100644
index a73947d261..596aa27feb 100644
--- a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java
+++ b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java
@@ -1,12 +1,19 @@
@ -1008,7 +1008,7 @@ index a73947d26..596aa27fe 100644
throw CancelledPacketHandleException.INSTANCE;
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 54e44cba3..3a83819d5 100644
index 54e44cba35..3a83819d56 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1,5 +1,6 @@
@ -1032,7 +1032,7 @@ index 54e44cba3..3a83819d5 100644
public WhiteList getWhitelist() {
diff --git a/src/main/java/net/minecraft/server/TickListServer.java b/src/main/java/net/minecraft/server/TickListServer.java
index 0da57948a..6571fc595 100644
index 0da57948a3..6571fc5952 100644
--- a/src/main/java/net/minecraft/server/TickListServer.java
+++ b/src/main/java/net/minecraft/server/TickListServer.java
@@ -24,13 +24,19 @@ public class TickListServer<T> implements TickList<T> {
@ -1086,7 +1086,7 @@ index 0da57948a..6571fc595 100644
}
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index c69209497..68ac014aa 100644
index c69209497b..68ac014aab 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -4,12 +4,13 @@ import javax.annotation.Nullable;
@ -1106,7 +1106,7 @@ index c69209497..68ac014aa 100644
private final TileEntityTypes<?> e; public TileEntityTypes getTileEntityType() { return e; } // Paper - OBFHELPER
protected World world;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 9d5b3958b..ad792af2b 100644
index 9d5b3958bf..ad792af2bc 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1,5 +1,6 @@
@ -1214,7 +1214,7 @@ index 9d5b3958b..ad792af2b 100644
public boolean a(@Nullable Entity entity, VoxelShape voxelshape) {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index a7ae16681..5a7087c75 100644
index a7ae16681d..5a7087c758 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1,5 +1,6 @@
@ -1316,7 +1316,7 @@ index a7ae16681..5a7087c75 100644
// CraftBukkit start
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2bf30cd6b..eb4d3fe06 100644
index 2bf30cd6b4..eb4d3fe069 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1985,12 +1985,31 @@ public final class CraftServer implements Server {
@ -1353,7 +1353,7 @@ index 2bf30cd6b..eb4d3fe06 100644
org.spigotmc.RestartCommand.restart();
diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
deleted file mode 100644
index 2ab4b11a8..000000000
index 2ab4b11a8d..0000000000
--- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
+++ /dev/null
@@ -1,173 +0,0 @@
@ -1531,7 +1531,7 @@ index 2ab4b11a8..000000000
- }
-}
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
index 413dd35f0..52a8c48fa 100644
index 413dd35f06..52a8c48fa4 100644
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
@@ -1,6 +1,8 @@
@ -1567,7 +1567,7 @@ index 413dd35f0..52a8c48fa 100644
public void callStage3(QueuedChunk queuedChunk, Chunk chunk, Runnable runnable) throws RuntimeException {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 7f0465ec4..99f99148d 100644
index 7f0465ec43..99f99148d6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1700,6 +1700,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -1586,7 +1586,7 @@ index 7f0465ec4..99f99148d 100644
public Player.Spigot spigot()
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 646128f16..d75cc42e1 100644
index 646128f16d..d75cc42e11 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -16,6 +16,7 @@ import java.util.concurrent.atomic.AtomicReference;
@ -1653,7 +1653,7 @@ index 646128f16..d75cc42e1 100644
private boolean isReady(final int currentTick) {
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
index 3f55381c1..0d9a46680 100644
index 3f55381c15..0d9a466809 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
@@ -1,9 +1,11 @@
@ -1738,7 +1738,7 @@ index 3f55381c1..0d9a46680 100644
- // Spigot end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
index e52ef47b7..3d90b3426 100644
index e52ef47b78..3d90b34268 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
@@ -5,6 +5,7 @@ import org.bukkit.util.CachedServerIcon;
@ -1750,7 +1750,7 @@ index e52ef47b7..3d90b3426 100644
this.value = value;
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index c1071c92e..a99c0cea0 100644
index c1071c92ee..a99c0cea0f 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -30,7 +30,7 @@ import net.minecraft.server.EntityWither;

View File

@ -1,14 +1,14 @@
From 5011c4049d2d9d65d19fd159a63811744bfb7ddb Mon Sep 17 00:00:00 2001
From 80a584557c916ec5acd1ac5f5b5c0bdd45023f02 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 1 Mar 2016 15:08:03 -0600
Subject: [PATCH] Remove invalid mob spawner tile entities
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index eca1284cc..0a436133a 100644
index 2b1198ca8f..e15ed21f67 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -797,6 +797,10 @@ public class Chunk implements IChunkAccess {
@@ -796,6 +796,10 @@ public class Chunk implements IChunkAccess {
tileentity.z();
this.tileEntities.put(blockposition.h(), tileentity);
// CraftBukkit start
@ -20,5 +20,5 @@ index eca1284cc..0a436133a 100644
System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()
+ " (" + getType(blockposition) + ") where there was no entity tile!");
--
2.20.1
2.21.0

View File

@ -1,4 +1,4 @@
From 547543692e3fbff83ee3fc2e930fefdebe974113 Mon Sep 17 00:00:00 2001
From b85bbfb42e8b12aa8e73894b0ad478c734d12f1d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 2 Mar 2016 00:52:31 -0600
Subject: [PATCH] Lighting Queue
@ -6,7 +6,7 @@ Subject: [PATCH] Lighting Queue
This provides option to queue lighting updates to ensure they do not cause the server lag
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
index 145cb274b..eff9dcf54 100644
index 145cb274b0..eff9dcf54f 100644
--- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
@@ -50,6 +50,8 @@ public class WorldTimingsHandler {
@ -28,7 +28,7 @@ index 145cb274b..eff9dcf54 100644
public static Timing getTickList(WorldServer worldserver, String timingsType) {
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 7691409f6..cfcc24467 100644
index 7691409f6c..cfcc244672 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -191,6 +191,13 @@ public class PaperConfig {
@ -46,7 +46,7 @@ index 7691409f6..cfcc24467 100644
boolean timings = getBoolean("timings.enabled", true);
boolean verboseTimings = getBoolean("timings.verbose", true);
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index a797a5767..59d82fa4f 100644
index a797a57671..59d82fa4fb 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -139,4 +139,12 @@ public class PaperWorldConfig {
@ -63,7 +63,7 @@ index a797a5767..59d82fa4f 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0a436133a..2afd6befa 100644
index e15ed21f67..a9aa13fbf8 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -94,6 +94,7 @@ public class Chunk implements IChunkAccess {
@ -108,7 +108,7 @@ index 0a436133a..2afd6befa 100644
}
TileEntity tileentity;
@@ -1360,6 +1363,16 @@ public class Chunk implements IChunkAccess {
@@ -1358,6 +1361,16 @@ public class Chunk implements IChunkAccess {
return this.D == 8;
}
@ -126,7 +126,7 @@ index 0a436133a..2afd6befa 100644
IMMEDIATE, QUEUED, CHECK;
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index eb83e20d5..c2ecc034e 100644
index eb83e20d50..c2ecc034e8 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -313,6 +313,7 @@ public class ChunkProviderServer implements IChunkProvider {
@ -138,7 +138,7 @@ index eb83e20d5..c2ecc034e 100644
// Update neighbor counts
for (int x = -2; x < 3; x++) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 7ca7b9f3a..00f1c36e9 100644
index 7ca7b9f3ac..00f1c36e99 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -890,7 +890,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
@ -160,7 +160,7 @@ index 7ca7b9f3a..00f1c36e9 100644
}
diff --git a/src/main/java/net/minecraft/server/PaperLightingQueue.java b/src/main/java/net/minecraft/server/PaperLightingQueue.java
new file mode 100644
index 000000000..9783f3a0d
index 0000000000..9783f3a0d9
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PaperLightingQueue.java
@@ -0,0 +1,98 @@
@ -263,7 +263,7 @@ index 000000000..9783f3a0d
+ }
+}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index b10e4c409..f3755fcfb 100644
index b10e4c409d..f3755fcfbe 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -329,7 +329,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc

View File

@ -1,4 +1,4 @@
From 68d160bf273d31d81e6687a9f64783f89adcd41e Mon Sep 17 00:00:00 2001
From 06645204746e6de3a180b5ae5c68b24645b7ba54 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 2afd6befa..d1b6344ce 100644
index a9aa13fbf8..cb56d067b9 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -95,6 +95,10 @@ public class Chunk implements IChunkAccess {
@ -28,19 +28,21 @@ index 2afd6befa..d1b6344ce 100644
// Paper end
public boolean areNeighborsLoaded(final int radius) {
switch (radius) {
@@ -689,6 +693,11 @@ public class Chunk implements IChunkAccess {
@@ -690,6 +694,13 @@ public class Chunk implements IChunkAccess {
entity.chunkY = k;
entity.chunkZ = this.locZ;
this.entitySlices[k].add(entity);
// Paper start
+ // Paper start
+ if (entity instanceof EntityItem) {
+ itemCounts[k]++;
+ } else if (entity instanceof IInventory) {
+ inventoryEntityCounts[k]++;
+ }
entity.setCurrentChunk(this);
entityCounts.increment(entity.getMinecraftKeyString());
// Paper end
@@ -714,6 +723,11 @@ public class Chunk implements IChunkAccess {
+ // Paper end
}
public void a(HeightMap.Type heightmap_type, long[] along) {
@@ -714,6 +725,11 @@ public class Chunk implements IChunkAccess {
if (!this.entitySlices[i].remove(entity)) {
return;
}
@ -49,10 +51,10 @@ index 2afd6befa..d1b6344ce 100644
+ } else if (entity instanceof IInventory) {
+ inventoryEntityCounts[i]--;
+ }
entity.setCurrentChunk(null);
entityCounts.decrement(entity.getMinecraftKeyString());
// Paper end
@@ -961,6 +975,15 @@ public class Chunk implements IChunkAccess {
}
@@ -959,6 +975,15 @@ public class Chunk implements IChunkAccess {
if (!this.entitySlices[k].isEmpty()) {
Iterator iterator = this.entitySlices[k].iterator();
@ -68,7 +70,7 @@ index 2afd6befa..d1b6344ce 100644
while (iterator.hasNext()) {
Entity entity1 = (Entity) iterator.next();
@@ -997,7 +1020,18 @@ public class Chunk implements IChunkAccess {
@@ -995,7 +1020,18 @@ public class Chunk implements IChunkAccess {
i = MathHelper.clamp(i, 0, this.entitySlices.length - 1);
j = MathHelper.clamp(j, 0, this.entitySlices.length - 1);
@ -88,7 +90,7 @@ index 2afd6befa..d1b6344ce 100644
while (iterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
index bbcbb6232..f6916fd45 100644
index bbcbb62325..f6916fd455 100644
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
@@ -11,6 +11,7 @@ public final class IEntitySelector {
@ -100,5 +102,5 @@ index bbcbb6232..f6916fd45 100644
return entity instanceof IInventory && entity.isAlive();
};
--
2.20.1
2.21.0

View File

@ -1,11 +1,12 @@
From e0215644ebfdb7159fa274af4d916829b42e89f9 Mon Sep 17 00:00:00 2001
From a16143b109a5099f59c969c98ed7299fbf4cf84c Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 02:39:54 -0600
Subject: [PATCH] Change implementation of (tile)entity removal list
use sets for faster removal
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 5ff06d247..7e1df0e5b 100644
index a80acbb6a5..09cf98ccdd 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -68,11 +68,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -22,36 +23,34 @@ index 5ff06d247..7e1df0e5b 100644
public final List<EntityHuman> players = Lists.newArrayList();
public final List<Entity> k = Lists.newArrayList();
protected final IntHashMap<Entity> entitiesById = new IntHashMap<>();
@@ -1095,20 +1095,20 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1095,20 +1095,21 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.entityList.removeAll(this.g);
int j;
+ // Paper start - Set based removal lists
+ for (Entity e : this.g) {
+ j = e.getChunkZ();
+ int k = e.getChunkX();
-
- for (i = 0; i < this.g.size(); ++i) {
- entity = (Entity) this.g.get(i);
- int k = entity.chunkX;
-
- j = entity.chunkZ;
- if (entity.inChunk && this.isChunkLoaded(k, j, true)) {
- this.getChunkAt(k, j).b(entity);
+ if (e.inChunk && this.isChunkLoaded(k, j, true)) {
+ this.getChunkAt(k, j).b(e);
+ // Paper start - Set based removal lists
+ for (Iterator<Entity> it = this.g.iterator(); it.hasNext() ; ) {
+ entity = it.next(); // Paper
int k = entity.chunkX;
j = entity.chunkZ;
if (entity.inChunk && this.isChunkLoaded(k, j, true)) {
this.getChunkAt(k, j).b(entity);
}
}
- }
+ //} // Paper - merge
- for (i = 0; i < this.g.size(); ++i) {
- this.c((Entity) this.g.get(i));
+ for (Entity e : this.g) {
+ this.c(e);
+ //for (Entity e : this.g) { // Paper - merge
+ this.c(entity); // Paper use entity
}
+ // Paper end
this.g.clear();
this.p_();
--
2.20.1
2.21.0

View File

@ -1,4 +1,4 @@
From f94a985e1f32da2033a8605b980a920c6a87d6e8 Mon Sep 17 00:00:00 2001
From 0f1c8615e262b38dcdde638ce67cf87eaa8175bb Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 03:15:41 -0600
Subject: [PATCH] Add exception reporting event
@ -49,7 +49,7 @@ index 0000000000..f699ce18ca
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index d1b6344ced..446e464b72 100644
index cb56d067b9..67cd4af4f5 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1,5 +1,6 @@
@ -67,7 +67,7 @@ index d1b6344ced..446e464b72 100644
public IBlockData getType(BlockPosition blockposition) {
return this.getBlockData(blockposition.getX(), blockposition.getY(), blockposition.getZ());
}
@@ -819,10 +821,15 @@ public class Chunk implements IChunkAccess {
@@ -820,10 +822,15 @@ public class Chunk implements IChunkAccess {
this.tileEntities.remove(blockposition);
// Paper end
} else {
@ -240,7 +240,7 @@ index 58122b18eb..0ac1fb53a4 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 7e1df0e5b6..0684d85beb 100644
index 09cf98ccdd..6e7c0c9da4 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1,6 +1,8 @@
@ -252,7 +252,7 @@ index 7e1df0e5b6..0684d85beb 100644
import com.google.common.base.MoreObjects;
import com.google.common.collect.Lists;
import it.unimi.dsi.fastutil.longs.LongSet;
@@ -1150,8 +1152,10 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1151,8 +1153,10 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
} catch (Throwable throwable1) {
entity.tickTimer.stopTiming();
// Paper start - Prevent tile entity and entity crashes
@ -264,7 +264,7 @@ index 7e1df0e5b6..0684d85beb 100644
entity.dead = true;
continue;
// Paper end
@@ -1216,8 +1220,10 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1217,8 +1221,10 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.methodProfiler.exit();
} catch (Throwable throwable2) {
// Paper start - Prevent tile entity and entity crashes
@ -335,5 +335,5 @@ index d75cc42e11..0e9d5fe3a7 100644
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
--
2.20.1
2.21.0

View File

@ -1,4 +1,4 @@
From 180e605d07d2befdf1f25c52219d7a68943a7201 Mon Sep 17 00:00:00 2001
From e97a654e918381c5b2eb07cf6d632fb55c457fa6 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 02:07:55 -0600
Subject: [PATCH] Optimize isValidLocation, getType and getBlockData for inling
@ -12,7 +12,7 @@ Replace all calls to the new place to the unnecessary forward.
Optimize getType and getBlockData to manually inline and optimize the calls
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
index 5843ef65a..4c7793f86 100644
index 5843ef65af..4c7793f86d 100644
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
@@ -10,6 +10,14 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
@ -31,7 +31,7 @@ index 5843ef65a..4c7793f86 100644
public BaseBlockPosition(int i, int j, int k) {
this.a = i;
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index 37f9037a2..dfd7496c7 100644
index 9bb7c9c652..bc364ce371 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -300,6 +300,16 @@ public class BlockPosition extends BaseBlockPosition {
@ -52,7 +52,7 @@ index 37f9037a2..dfd7496c7 100644
public MutableBlockPosition() {
this(0, 0, 0);
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index dcb036f31..182a637ad 100644
index 3f9de7e55a..b76c1579ea 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -425,12 +425,24 @@ public class Chunk implements IChunkAccess {
@ -84,7 +84,7 @@ index dcb036f31..182a637ad 100644
IBlockData iblockdata = null;
diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java
index 3c5f10ad4..621ed1fc5 100644
index 3c5f10ad4d..621ed1fc53 100644
--- a/src/main/java/net/minecraft/server/ChunkSection.java
+++ b/src/main/java/net/minecraft/server/ChunkSection.java
@@ -7,7 +7,7 @@ public class ChunkSection {
@ -97,7 +97,7 @@ index 3c5f10ad4..621ed1fc5 100644
private NibbleArray skyLight;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 7e35cc36b..6f5719928 100644
index fd45090685..f4e91db7c6 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -257,11 +257,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -173,7 +173,7 @@ index 7e35cc36b..6f5719928 100644
return FluidTypes.EMPTY.i();
} else {
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
@@ -1766,7 +1766,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1767,7 +1767,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
public Map<BlockPosition, TileEntity> capturedTileEntities = Maps.newHashMap();
@Nullable
public TileEntity getTileEntity(BlockPosition blockposition) {
@ -182,7 +182,7 @@ index 7e35cc36b..6f5719928 100644
return null;
} else {
// CraftBukkit start
@@ -1807,7 +1807,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1808,7 +1808,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
@ -191,7 +191,7 @@ index 7e35cc36b..6f5719928 100644
if (tileentity != null && !tileentity.x()) {
// CraftBukkit start
if (captureBlockStates) {
@@ -1868,7 +1868,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1869,7 +1869,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
public boolean p(BlockPosition blockposition) {
@ -201,5 +201,5 @@ index 7e35cc36b..6f5719928 100644
} else {
Chunk chunk = this.chunkProvider.getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4, false, false);
--
2.20.1
2.21.0

View File

@ -1,4 +1,4 @@
From ea660ab24b09540762357d57efda9b08db4da6be Mon Sep 17 00:00:00 2001
From 98961bc338270ab024b135c88508126d0cff607f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 13 Sep 2014 23:14:43 -0400
Subject: [PATCH] Configurable Keep Spawn Loaded range per world
@ -6,7 +6,7 @@ Subject: [PATCH] Configurable Keep Spawn Loaded range per world
This lets you disable it for some worlds and lower it for others.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 6b74f810a..260c55016 100644
index 6b74f810a9..260c55016e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -258,4 +258,10 @@ public class PaperWorldConfig {
@ -21,7 +21,7 @@ index 6b74f810a..260c55016 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ee45d3705..01c5d3c57 100644
index ee45d3705b..01c5d3c572 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -486,13 +486,21 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
@ -63,10 +63,10 @@ index ee45d3705..01c5d3c57 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 2e8485859..d77992640 100644
index 34b5ca3a7e..8a445a1fa3 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -2852,8 +2852,9 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2853,8 +2853,9 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
int k = i * 16 + 8 - blockposition.getX();
int l = j * 16 + 8 - blockposition.getZ();
boolean flag = true;
@ -78,7 +78,7 @@ index 2e8485859..d77992640 100644
public LongSet ag() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 533dcd60d..e107ddcf7 100644
index 533dcd60d7..e107ddcf71 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1006,7 +1006,7 @@ public final class CraftServer implements Server {
@ -91,7 +91,7 @@ index 533dcd60d..e107ddcf7 100644
for (int j = -short1; j <= short1; j += 16) {
for (int k = -short1; k <= short1; k += 16) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 262c3f910..a8c7e7931 100644
index 262c3f910e..a8c7e7931e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1419,8 +1419,9 @@ public class CraftWorld implements World {

View File

@ -1,14 +1,14 @@
From 050c476f2a947170b6f8564ef94fb1e25e678f04 Mon Sep 17 00:00:00 2001
From e967f3bcc7b0a00d5282d2a2d5976e1e48107238 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 5 Apr 2016 19:42:22 -0400
Subject: [PATCH] Don't spam reload spawn chunks in nether/end
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 937fd74b1..af6abc2df 100644
index b595536648..5fc2da0d92 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -2848,6 +2848,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2849,6 +2849,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
return this.K;
}
@ -17,7 +17,7 @@ index 937fd74b1..af6abc2df 100644
BlockPosition blockposition = this.getSpawn();
int k = i * 16 + 8 - blockposition.getX();
diff --git a/src/main/java/net/minecraft/server/WorldProvider.java b/src/main/java/net/minecraft/server/WorldProvider.java
index 5e87e537e..3911e4947 100644
index 5e87e537e4..3911e4947e 100644
--- a/src/main/java/net/minecraft/server/WorldProvider.java
+++ b/src/main/java/net/minecraft/server/WorldProvider.java
@@ -69,7 +69,7 @@ public abstract class WorldProvider {
@ -30,5 +30,5 @@ index 5e87e537e..3911e4947 100644
protected abstract void m();
--
2.20.1
2.21.0

View File

@ -1,4 +1,4 @@
From 37c4fc9303c9da3c1a83e5e8603ff99fd3a19951 Mon Sep 17 00:00:00 2001
From 509bc747e1d9431854cb6956c0fc1d1c95e072ed Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 13 Apr 2016 00:25:28 -0400
Subject: [PATCH] Remove unused World Tile Entity List
@ -6,7 +6,7 @@ Subject: [PATCH] Remove unused World Tile Entity List
Massive hit to performance and it is completely unnecessary.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index af6abc2df..d8ef300f7 100644
index 5fc2da0d92..04ec2a0399 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -71,7 +71,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -18,7 +18,7 @@ index af6abc2df..d8ef300f7 100644
public final List<TileEntity> tileEntityListTick = Lists.newArrayList();
private final List<TileEntity> c = Lists.newArrayList();
private final Set<TileEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); // Paper
@@ -1268,7 +1268,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1269,7 +1269,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
timings.tileEntityTick.startTiming(); // Spigot
if (!this.tileEntityListUnload.isEmpty()) {
this.tileEntityListTick.removeAll(this.tileEntityListUnload);
@ -27,7 +27,7 @@ index af6abc2df..d8ef300f7 100644
this.tileEntityListUnload.clear();
}
@@ -1321,7 +1321,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1322,7 +1322,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
if (tileentity.x()) {
tilesThisCycle--;
this.tileEntityListTick.remove(tileTickPosition--);
@ -36,7 +36,7 @@ index af6abc2df..d8ef300f7 100644
if (this.isLoaded(tileentity.getPosition())) {
this.getChunkAtWorldCoords(tileentity.getPosition()).d(tileentity.getPosition());
}
@@ -1351,7 +1351,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1352,7 +1352,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3);
// CraftBukkit start
// From above, don't screw this up - SPIGOT-1746
@ -45,7 +45,7 @@ index af6abc2df..d8ef300f7 100644
this.a(tileentity1);
}
// CraftBukkit end
@@ -1371,9 +1371,9 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1372,9 +1372,9 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
protected void p_() {}
public boolean a(TileEntity tileentity) {
@ -57,7 +57,7 @@ index af6abc2df..d8ef300f7 100644
this.tileEntityListTick.add(tileentity);
}
@@ -1854,7 +1854,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1855,7 +1855,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
} else {
if (tileentity != null) {
this.c.remove(tileentity);
@ -67,5 +67,5 @@ index af6abc2df..d8ef300f7 100644
}
--
2.20.1
2.21.0

View File

@ -1,4 +1,4 @@
From d8326d25da4180c98e1ef31864b813237a5351d7 Mon Sep 17 00:00:00 2001
From 2fbf2c556d7840198741959940696a14c7e3c26a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 18 Jun 2016 23:22:12 -0400
Subject: [PATCH] Delay Chunk Unloads based on Player Movement
@ -20,7 +20,7 @@ This also makes the Chunk GC System useless, by auto scheduling unload as soon a
a spare chunk is added to the server thats outside of view distance.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index bcc2ecaa3..c70771614 100644
index bcc2ecaa3a..c70771614d 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -310,4 +310,18 @@ public class PaperWorldConfig {
@ -43,7 +43,7 @@ index bcc2ecaa3..c70771614 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0421f8f95..ddccdc939 100644
index c74176daa5..bdf922db50 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -40,6 +40,7 @@ public class Chunk implements IChunkAccess {
@ -55,7 +55,7 @@ index 0421f8f95..ddccdc939 100644
public final int locZ;
private boolean l;
diff --git a/src/main/java/net/minecraft/server/ChunkMap.java b/src/main/java/net/minecraft/server/ChunkMap.java
index 8b3738c8f..2021c0d02 100644
index 8b3738c8f7..2021c0d02e 100644
--- a/src/main/java/net/minecraft/server/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/ChunkMap.java
@@ -48,6 +48,15 @@ public class ChunkMap extends Long2ObjectOpenHashMap<Chunk> {
@ -75,7 +75,7 @@ index 8b3738c8f..2021c0d02 100644
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index c54df4583..d0bf0f72d 100644
index c54df45837..d0bf0f72da 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -307,6 +307,19 @@ public class ChunkProviderServer implements IChunkProvider {
@ -99,7 +99,7 @@ index c54df4583..d0bf0f72d 100644
this.chunkScheduler.a(booleansupplier);
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index e47aae2f8..b9d90c4fb 100644
index e47aae2f8b..b9d90c4fb8 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -29,8 +29,23 @@ public class PlayerChunk {
@ -153,7 +153,7 @@ index e47aae2f8..b9d90c4fb 100644
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 206457650..ab4f3b722 100644
index 2064576501..ab4f3b7223 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -452,7 +452,13 @@ public class PlayerChunkMap {
@ -172,10 +172,10 @@ index 206457650..ab4f3b722 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index b287dbd91..3d3ea5152 100644
index 32ee298648..dcff6c8d8a 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1292,7 +1292,13 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1293,7 +1293,13 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
if (!tileentity.x() && tileentity.hasWorld()) {
BlockPosition blockposition = tileentity.getPosition();
@ -191,7 +191,7 @@ index b287dbd91..3d3ea5152 100644
this.methodProfiler.a(() -> {
return String.valueOf(TileEntityTypes.a(tileentity.C()));
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index a8c7e7931..f7883e708 100644
index a8c7e7931e..f7883e7085 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1772,7 +1772,7 @@ public class CraftWorld implements World {
@ -204,7 +204,7 @@ index a8c7e7931..f7883e708 100644
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index d08ef3fe1..081789a8f 100644
index d08ef3fe10..081789a8fe 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -323,6 +323,11 @@ public class ActivationRange

View File

@ -1,4 +1,4 @@
From 717d26909def2ce7339b76147cbcacabd139d9a5 Mon Sep 17 00:00:00 2001
From fbb663799bcceee4cfcafbac14a6b78fb196a209 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 21 Sep 2016 22:54:28 -0400
Subject: [PATCH] Chunk registration fixes
@ -8,10 +8,10 @@ World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is tr
Keep them consistent
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 56676f34b..4eb8e25bf 100644
index 336e6aeef6..282d6ae84c 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1472,7 +1472,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1473,7 +1473,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
i = MathHelper.floor(entity.locX / 16.0D);
@ -21,5 +21,5 @@ index 56676f34b..4eb8e25bf 100644
if (!entity.inChunk || entity.chunkX != i || entity.chunkY != j || entity.chunkZ != k) {
--
2.20.1
2.21.0

View File

@ -1,11 +1,11 @@
From 525caab8efebfe0c3a2e0130f7b40d6823a83d41 Mon Sep 17 00:00:00 2001
From 1babe552fc78799271b2ff008b63fe881ff40666 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 5 Oct 2016 16:27:36 -0500
Subject: [PATCH] Option to remove corrupt tile entities
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 6e28410c3..7e847af00 100644
index 6e28410c37..7e847af00b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -340,4 +340,9 @@ public class PaperWorldConfig {
@ -19,10 +19,10 @@ index 6e28410c3..7e847af00 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0d70ce797..6150b56e0 100644
index 0bf614ce57..a6cacd7da9 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -843,6 +843,12 @@ public class Chunk implements IChunkAccess {
@@ -844,6 +844,12 @@ public class Chunk implements IChunkAccess {
"Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16));
e.printStackTrace();
ServerInternalException.reportInternalException(e);
@ -35,7 +35,7 @@ index 0d70ce797..6150b56e0 100644
// Paper end
// CraftBukkit end
}
@@ -852,6 +858,7 @@ public class Chunk implements IChunkAccess {
@@ -853,6 +859,7 @@ public class Chunk implements IChunkAccess {
this.h.put(new BlockPosition(nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z")), nbttagcompound);
}

View File

@ -1,14 +1,14 @@
From 41a936d8fb39da0a7b185a10d9aea73e2db7840a Mon Sep 17 00:00:00 2001
From a704cf4fe36a950d5957af844c1cb51ab661f917 Mon Sep 17 00:00:00 2001
From: mezz <tehgeek@gmail.com>
Date: Wed, 9 Aug 2017 17:51:22 -0500
Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 837f875a4..5b589e76f 100644
index 5e1ab431dc..cdb430ef4f 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1273,7 +1273,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1274,7 +1274,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.methodProfiler.exitEnter("blockEntities");
timings.tileEntityTick.startTiming(); // Spigot
if (!this.tileEntityListUnload.isEmpty()) {

View File

@ -1,4 +1,4 @@
From 7cf1b664e72ac6c1deecb241d9c9577c5e32777e Mon Sep 17 00:00:00 2001
From 5db8e75d6daadd431d60cfc697b54397eda03abe Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 3 Jul 2018 21:56:23 -0400
Subject: [PATCH] InventoryCloseEvent Reason API
@ -7,10 +7,10 @@ Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 6150b56e0..3ca579e38 100644
index a6cacd7da9..c2f12f92b0 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -943,7 +943,7 @@ public class Chunk implements IChunkAccess {
@@ -944,7 +944,7 @@ public class Chunk implements IChunkAccess {
{
if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity )
{
@ -19,7 +19,7 @@ index 6150b56e0..3ca579e38 100644
}
}
}
@@ -968,7 +968,7 @@ public class Chunk implements IChunkAccess {
@@ -969,7 +969,7 @@ public class Chunk implements IChunkAccess {
{
if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity )
{
@ -29,7 +29,7 @@ index 6150b56e0..3ca579e38 100644
}
}
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index d4618d644..cc1bc01b1 100644
index d4618d644a..cc1bc01b16 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -158,7 +158,7 @@ public abstract class EntityHuman extends EntityLiving {
@ -56,7 +56,7 @@ index d4618d644..cc1bc01b1 100644
this.activeContainer = this.defaultContainer;
}
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index e4e1d999e..dc72538de 100644
index e4e1d999e9..dc72538de6 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -344,7 +344,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -110,7 +110,7 @@ index e4e1d999e..dc72538de 100644
this.m();
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 5ffb2cd34..a00b271b2 100644
index 5ffb2cd346..a00b271b2f 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2000,7 +2000,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@ -123,7 +123,7 @@ index 5ffb2cd34..a00b271b2 100644
this.player.m();
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 96eff10ff..ddaa73e83 100644
index 96eff10ffa..ddaa73e83d 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -422,7 +422,7 @@ public abstract class PlayerList {
@ -136,7 +136,7 @@ index 96eff10ff..ddaa73e83 100644
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game");
cserver.getPluginManager().callEvent(playerQuitEvent);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 9b19dce9b..cb7697f80 100644
index 9b19dce9bd..cb7697f80b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -513,8 +513,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@ -155,7 +155,7 @@ index 9b19dce9b..cb7697f80 100644
public boolean isBlocking() {
return getHandle().isBlocking();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 62235efde..47426d8fd 100644
index 62235efde9..47426d8fda 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -743,7 +743,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -168,7 +168,7 @@ index 62235efde..47426d8fd 100644
// Check if the fromWorld and toWorld are the same.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index acc80d068..2cfe8afe1 100644
index acc80d0684..2cfe8afe13 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1110,8 +1110,19 @@ public class CraftEventFactory {

View File

@ -1,4 +1,4 @@
From d059aee7f3cf690c8173570c63b736fdf971921f Mon Sep 17 00:00:00 2001
From 857c905119708c593c6cc1b805b45ab2a6b88bf1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 03:39:51 -0400
Subject: [PATCH] Avoid Chunk Lookups for Entity/TileEntity Current Chunk
@ -9,59 +9,49 @@ to the object directly on the Entity/TileEntity object we can directly grab.
Use that local value instead to reduce lookups in many hot places.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 3ca579e38..1c1f39524 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -723,6 +723,7 @@ public class Chunk implements IChunkAccess {
((HeightMap) this.heightMap.get(heightmap_type)).a(along);
}
+ public void removeEntity(Entity entity) { b(entity); } // Paper - OBFHELPER
public void b(Entity entity) {
this.a(entity, entity.chunkY);
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 08ad88c14..9befa890b 100644
index d87b08a49e..c7712d2e71 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1192,12 +1192,15 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
int j;
// Paper start - Set based removal lists
for (Entity e : this.g) {
+ /*
j = e.getChunkZ();
int k = e.getChunkX();
@@ -1110,9 +1110,8 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
int i = entity.chunkX;
int j = entity.chunkZ;
if (e.inChunk && this.isChunkLoaded(k, j, true)) {
this.getChunkAt(k, j).b(e);
- if (entity.inChunk && this.isChunkLoaded(i, j, true)) {
- this.getChunkAt(i, j).b(entity);
- }
+ Chunk chunk = entity.getCurrentChunk(); // Paper
+ if (chunk != null) chunk.removeEntity(entity); // Paper
// CraftBukkit start - Decrement loop variable field if we've already ticked this entity
int index = this.entityList.indexOf(entity);
@@ -1196,9 +1195,8 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
int k = entity.chunkX;
j = entity.chunkZ;
- if (entity.inChunk && this.isChunkLoaded(k, j, true)) {
- this.getChunkAt(k, j).b(entity);
- }
+ }*/
+ Chunk chunk = e.inChunk ? e.getCurrentChunk() : null;
+ if (chunk != null) chunk.removeEntity(e);
}
+ Chunk chunk = entity.getCurrentChunk(); // Paper
+ if (chunk != null) chunk.removeEntity(entity); // Paper
//} // Paper - merge
for (Entity e : this.g) {
@@ -1258,12 +1261,17 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.methodProfiler.exit();
this.methodProfiler.enter("remove");
if (entity.dead) {
+ // Paper start
+ /*
//for (Entity e : this.g) { // Paper - merge
@@ -1262,9 +1260,10 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
j = entity.chunkX;
int l = entity.chunkZ;
if (entity.inChunk && this.isChunkLoaded(j, l, true)) {
this.getChunkAt(j, l).b(entity);
- if (entity.inChunk && this.isChunkLoaded(j, l, true)) {
- this.getChunkAt(j, l).b(entity);
- }
+ }*/
+ Chunk chunk = entity.inChunk ? entity.getCurrentChunk() : null;
+ // Paper start
+ Chunk chunk = entity.getCurrentChunk();
+ if (chunk != null) chunk.removeEntity(entity);
+ // Paper end
guardEntityList = false; // Spigot
this.entityList.remove(this.tickPosition--); // CraftBukkit - Use field for loop variable
@@ -1308,7 +1316,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1309,7 +1308,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
BlockPosition blockposition = tileentity.getPosition();
// Paper start - Skip ticking in chunks scheduled for unload
@ -70,7 +60,7 @@ index 08ad88c14..9befa890b 100644
boolean shouldTick = chunk != null;
if(this.paperConfig.skipEntityTickingInChunksScheduledForUnload)
shouldTick = shouldTick && chunk.scheduledForUnload == null;
@@ -1344,8 +1352,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1345,8 +1344,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
tilesThisCycle--;
this.tileEntityListTick.remove(tileTickPosition--);
//this.tileEntityList.remove(tileentity); // Paper - remove unused list

View File

@ -1,11 +1,11 @@
From 60ea8c098f578211ad648ff7acfb3fd24876e4fd Mon Sep 17 00:00:00 2001
From 81263e2380923daafbda6e6c6b923716099a7043 Mon Sep 17 00:00:00 2001
From: Hugo Manrique <hugmanrique@gmail.com>
Date: Mon, 23 Jul 2018 12:57:39 +0200
Subject: [PATCH] Option to prevent armor stands from doing entity lookups
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 8c4ff1886..6c4cb61dc 100644
index 8c4ff18868..6c4cb61dc5 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -375,6 +375,11 @@ public class PaperWorldConfig {
@ -21,10 +21,10 @@ index 8c4ff1886..6c4cb61dc 100644
private void maxEntityCollision() {
maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) );
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index eda3f10f2..cd234c288 100644
index a5f4b9ad94..28fca165cd 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1547,6 +1547,14 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1539,6 +1539,14 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
}

View File

@ -1,11 +1,11 @@
From f9a1242fb60134e1404e031a18948fa8ba51197e Mon Sep 17 00:00:00 2001
From 18f41cfab72d71ce18a876d612fdce823ced970f Mon Sep 17 00:00:00 2001
From: Hugo Manrique <hugmanrique@gmail.com>
Date: Mon, 23 Jul 2018 14:22:26 +0200
Subject: [PATCH] Vanished players don't have rights
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index a64a02fd4..a211cb945 100644
index 6598b87eef..539273afbc 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -92,7 +92,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -18,7 +18,7 @@ index a64a02fd4..a211cb945 100644
protected int k;
private Entity vehicle;
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index f27d565e1..49ad201c6 100644
index f27d565e1e..49ad201c6e 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -70,7 +70,8 @@ public class ItemBlock extends Item {
@ -32,10 +32,10 @@ index f27d565e1..49ad201c6 100644
BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), player, CraftBlockData.fromData(iblockdata), defaultReturn);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index cd234c288..08596bf3c 100644
index 28fca165cd..1929e9d2ae 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1529,6 +1529,37 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1521,6 +1521,37 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
}
@ -74,7 +74,7 @@ index cd234c288..08596bf3c 100644
if (voxelshape.isEmpty()) {
return true;
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 167a3baec..1b13fa618 100644
index 2cfe8afe13..0a3a121cbc 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1000,6 +1000,14 @@ public class CraftEventFactory {

View File

@ -1,4 +1,4 @@
From dd6dc076e44e550e1851252e0d23ae0e3ad813c0 Mon Sep 17 00:00:00 2001
From 5db68f220944c579b43a082c9732005d4e2147f3 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,10 +6,10 @@ 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 edae53b82..42b76b212 100644
index e8c06e01b4..5d187e5d7d 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -716,6 +716,7 @@ public class Chunk implements IChunkAccess {
@@ -718,6 +718,7 @@ public class Chunk implements IChunkAccess {
entity.chunkZ = this.locZ;
this.entitySlices[k].add(entity);
// Paper start
@ -17,7 +17,7 @@ index edae53b82..42b76b212 100644
if (entity instanceof EntityItem) {
itemCounts[k]++;
} else if (entity instanceof IInventory) {
@@ -747,6 +748,7 @@ public class Chunk implements IChunkAccess {
@@ -748,6 +749,7 @@ public class Chunk implements IChunkAccess {
if (!this.entitySlices[i].remove(entity)) {
return;
}

View File

@ -1,4 +1,4 @@
From 96241e585235ed412e893f10f2cc1a9df400f679 Mon Sep 17 00:00:00 2001
From 100f05b6d3e0b894381d9f32dbadabdc77a97d9d 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,61 +9,55 @@ 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 42b76b212..7dd59ee03 100644
index 5d187e5d7d..01abe5e376 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -714,8 +714,27 @@ public class Chunk implements IChunkAccess {
entity.chunkX = this.locX;
entity.chunkY = k;
entity.chunkZ = this.locZ;
- this.entitySlices[k].add(entity);
+
// Paper start
+ List<Entity> entitySlice = this.entitySlices[k];
+ boolean inThis = entitySlice.contains(entity);
@@ -709,6 +709,25 @@ public class Chunk implements IChunkAccess {
if (k >= this.entitySlices.length) {
k = this.entitySlices.length - 1;
}
+ // Paper - remove from any old list if its in one
+ List<Entity> nextSlice = this.entitySlices[k]; // the next list to be added to
+ List<Entity> currentSlice = entity.entitySlice;
+ if (inThis || (currentSlice != null && currentSlice.contains(entity))) {
+ if (currentSlice == entitySlice || inThis) {
+ return;
+ } else {
+ Chunk chunk = entity.getCurrentChunk();
+ if (chunk != null) {
+ chunk.removeEntity(entity);
+ } else {
+ removeEntity(entity);
+ }
+ currentSlice.remove(entity); // Just incase the above did not remove from this target slice
+ }
+ if (nextSlice == currentSlice) {
+ if (World.DEBUG_ENTITIES) MinecraftServer.LOGGER.warn("Entity was already in this chunk!" + entity, new Throwable());
+ return; // ??? silly plugins
+ }
+ entity.entitySlice = entitySlice;
+ entitySlice.add(entity);
+
+ if (currentSlice != null && currentSlice.contains(entity)) {
+ // Still in an old chunk...
+ if (World.DEBUG_ENTITIES) MinecraftServer.LOGGER.warn("Entity is still in another chunk!" + entity, new Throwable());
+ Chunk chunk = entity.getCurrentChunk();
+ if (chunk != null) {
+ chunk.removeEntity(entity);
+ } else {
+ removeEntity(entity);
+ }
+ currentSlice.remove(entity); // Just incase the above did not remove from the previous slice
+ }
+ // Paper end
if (!entity.inChunk || entity.getCurrentChunk() != this) entityCounts.increment(entity.getMinecraftKeyString()); // Paper
entity.inChunk = true;
@@ -718,6 +737,7 @@ public class Chunk implements IChunkAccess {
entity.chunkZ = this.locZ;
this.entitySlices[k].add(entity);
// Paper start
+ entity.entitySlice = this.entitySlices[k]; // Paper
this.markDirty();
if (entity instanceof EntityItem) {
itemCounts[k]++;
@@ -745,9 +764,10 @@ public class Chunk implements IChunkAccess {
i = this.entitySlices.length - 1;
@@ -746,6 +766,9 @@ public class Chunk implements IChunkAccess {
}
// Paper start
- if (!this.entitySlices[i].remove(entity)) {
- return;
+ if (entity.entitySlice == null || !entity.entitySlice.contains(entity) || entitySlices[i] == entity.entitySlice) {
if (entity.currentChunk != null && entity.currentChunk.get() == this) entity.setCurrentChunk(null);
+ if (entitySlices[i] == entity.entitySlice) {
+ entity.entitySlice = null;
+ }
if (!this.entitySlices[i].remove(entity)) {
return;
}
+ if (!this.entitySlices[i].remove(entity)) { return; }
this.markDirty();
if (entity instanceof EntityItem) {
itemCounts[i]--;
@@ -1028,6 +1048,7 @@ public class Chunk implements IChunkAccess {
}
// Spigot End
entity.setCurrentChunk(null); // Paper
+ entity.entitySlice = null; // Paper
// Do not pass along players, as doing so can get them stuck outside of time.
// (which for example disables inventory icon updates and prevents block breaking)
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index a211cb945..72e43622e 100644
index 539273afbc..ead5af991c 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -62,6 +62,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke

View File

@ -1,4 +1,4 @@
From 58bcaacaaf7a6267dbc8766cf378858b40dd78ad Mon Sep 17 00:00:00 2001
From 057008b9c48ae55e921b3ee0014df76b4509118e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 28 Jul 2018 12:09:20 -0400
Subject: [PATCH] Always process chunk removal in removeEntity
@ -8,10 +8,10 @@ which can keep them in the chunk when they shouldnt be if done
during entity ticking.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 08596bf3c..f93adc860 100644
index 1929e9d2ae..1cbe6e17b7 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1107,7 +1107,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1107,13 +1107,14 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.everyoneSleeping();
}
@ -20,9 +20,8 @@ index 08596bf3c..f93adc860 100644
int i = entity.chunkX;
int j = entity.chunkZ;
@@ -1115,6 +1115,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.getChunkAt(i, j).b(entity);
}
Chunk chunk = entity.getCurrentChunk(); // Paper
if (chunk != null) chunk.removeEntity(entity); // Paper
+ if (!guardEntityList) { // Spigot - It will get removed after the tick if we are ticking // Paper - always remove from current chunk above
// CraftBukkit start - Decrement loop variable field if we've already ticked this entity

View File

@ -1,4 +1,4 @@
From 0e53985f8b0afb2bffb0b17aa5a014b9023db2c3 Mon Sep 17 00:00:00 2001
From 38b302a381c2e999cda2d6add7bf213adb295912 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 28 Jul 2018 12:18:27 -0400
Subject: [PATCH] Ignore Dead Entities in entityList iteration
@ -11,7 +11,7 @@ This will ensure that dead entities are skipped from iteration since
they shouldn't of been in the list in the first place.
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
index f38179e98..8e1bda4de 100644
index f38179e983..8e1bda4de9 100644
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -176,6 +176,7 @@ public class PaperCommand extends Command {
@ -23,7 +23,7 @@ index f38179e98..8e1bda4de 100644
MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ());
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 72e43622e..71ea64fe7 100644
index ead5af991c..cf69a4d8a4 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -121,6 +121,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -35,7 +35,7 @@ index 72e43622e..71ea64fe7 100644
public float length;
public float J;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index f93adc860..814950bde 100644
index 1cbe6e17b7..5d60b36678 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1046,6 +1046,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -46,15 +46,15 @@ index f93adc860..814950bde 100644
new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
}
@@ -1114,6 +1115,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
if (entity.inChunk && this.isChunkLoaded(i, j, true)) {
this.getChunkAt(i, j).b(entity);
}
@@ -1113,6 +1114,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
Chunk chunk = entity.getCurrentChunk(); // Paper
if (chunk != null) chunk.removeEntity(entity); // Paper
+ entity.shouldBeRemoved = true; // Paper
if (!guardEntityList) { // Spigot - It will get removed after the tick if we are ticking // Paper - always remove from current chunk above
// CraftBukkit start - Decrement loop variable field if we've already ticked this entity
@@ -2324,6 +2326,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2316,6 +2318,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@ -62,7 +62,7 @@ index f93adc860..814950bde 100644
if (oclass.isAssignableFrom(entity.getClass()) && predicate.test((T) entity)) { // CraftBukkit - decompile error
list.add((T) entity); // CraftBukkit - decompile error
@@ -2410,6 +2413,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2402,6 +2405,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@ -71,7 +71,7 @@ index f93adc860..814950bde 100644
if (entity instanceof EntityInsentient) {
EntityInsentient entityinsentient = (EntityInsentient) entity;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 609b91126..4594bab46 100644
index 609b911265..4594bab465 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -634,6 +634,7 @@ public class CraftWorld implements World {

View File

@ -1,11 +1,11 @@
From 20c9c4952328ef753d46754008f17efcc036d085 Mon Sep 17 00:00:00 2001
From 28a9ac54731e4f544a428ad3e267f26d96370d4d Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Mon, 30 Jul 2018 02:42:49 -0400
Subject: [PATCH] World EntityHuman Lookup Optimizations
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 814950bde..748ab8212 100644
index 5d60b36678..3acea908c2 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -76,6 +76,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -41,7 +41,7 @@ index 814950bde..748ab8212 100644
this.everyoneSleeping();
}
@@ -2675,6 +2680,8 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2667,6 +2672,8 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@Nullable
public EntityHuman a(String s) {
@ -50,7 +50,7 @@ index 814950bde..748ab8212 100644
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman = (EntityHuman) this.players.get(i);
@@ -2684,10 +2691,15 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2676,10 +2683,15 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
return null;
@ -66,7 +66,7 @@ index 814950bde..748ab8212 100644
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman = (EntityHuman) this.players.get(i);
@@ -2697,6 +2709,10 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2689,6 +2701,10 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
return null;

View File

@ -1,4 +1,4 @@
From 9a10ba335454cdf6a3ebb047e1ae00a84a00b368 Mon Sep 17 00:00:00 2001
From f915d35b9a42d9b6f78a2eaf785a90339988fa75 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 3 Aug 2018 22:47:46 -0400
Subject: [PATCH] Entity add to world fixes
@ -14,7 +14,7 @@ Fix this by differing entity add to world for all entities at the same time
the original entity is dead, overwrite it as the logic does for unloaod queued entities.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 7dd59ee03..a915d0184 100644
index 01abe5e376..4502ece4dd 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -2,6 +2,8 @@ package net.minecraft.server;
@ -26,7 +26,7 @@ index 7dd59ee03..a915d0184 100644
import java.util.HashMap;
import java.util.UUID;
// Paper end
@@ -954,15 +956,16 @@ public class Chunk implements IChunkAccess {
@@ -957,15 +959,16 @@ public class Chunk implements IChunkAccess {
// Paper end
// CraftBukkit start
@ -53,7 +53,7 @@ index 7dd59ee03..a915d0184 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 748ab8212..bd8d9ef48 100644
index 3acea908c2..e31e366249 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1037,6 +1037,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -64,7 +64,7 @@ index 748ab8212..bd8d9ef48 100644
this.entityList.add(entity);
this.b(entity);
return true;
@@ -2442,9 +2443,13 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2434,9 +2435,13 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
return j;
}
@ -79,7 +79,7 @@ index 748ab8212..bd8d9ef48 100644
this.b(entity);
});
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 293818b19..4cda6cee2 100644
index 293818b196..4cda6cee2b 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -967,7 +967,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {

View File

@ -1,4 +1,4 @@
From c71ea4c5adceb23f7c3ce0bc7dbc61194f96e0c0 Mon Sep 17 00:00:00 2001
From 3aaff97c0e74b3463e51c4d1fa2a81b43fb099b2 Mon Sep 17 00:00:00 2001
From: Colin Godsey <crgodsey@gmail.com>
Date: Wed, 8 Aug 2018 10:10:06 -0600
Subject: [PATCH] Cache World Entity Type counts
@ -133,7 +133,7 @@ index 0000000000..a10a5bc138
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 2d2edbd335..47d3609c34 100644
index 4dc7c8ba68..90e0d9d453 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -122,6 +122,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -183,7 +183,7 @@ index e626165520..d125fae03b 100644
if (l1 <= k) {
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index bd8d9ef489..17f9cd74fe 100644
index e31e366249..b007eb36c7 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -45,7 +45,8 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -216,9 +216,9 @@ index bd8d9ef489..17f9cd74fe 100644
private org.spigotmc.TickLimiter entityLimiter;
private org.spigotmc.TickLimiter tileLimiter;
private int tileTickPosition;
@@ -1122,6 +1126,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.getChunkAt(i, j).b(entity);
}
@@ -1121,6 +1125,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
Chunk chunk = entity.getCurrentChunk(); // Paper
if (chunk != null) chunk.removeEntity(entity); // Paper
entity.shouldBeRemoved = true; // Paper
+ ((com.destroystokyo.paper.PaperWorldEntityList) entityList).updateEntityCount(entity, -1); // Paper

View File

@ -1,4 +1,4 @@
From 291c79c7ba20324ab6aedf274c8e50e846429506 Mon Sep 17 00:00:00 2001
From d624e34a3f181e39bc9d168204cf4f8052539f4a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 29 Aug 2018 21:59:22 -0400
Subject: [PATCH] Optimize getChunkIfLoaded type calls
@ -10,7 +10,7 @@ Will improve inlining across many hot methods.
Improve getBrightness to not do double chunk map lookups.
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 41926a361..186cfda7e 100644
index 41926a361b..186cfda7e4 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -379,7 +379,7 @@ public class ChunkProviderServer implements IChunkProvider {
@ -23,7 +23,7 @@ index 41926a361..186cfda7e 100644
neighbor.setNeighborUnloaded(-x, -z);
chunk.setNeighborUnloaded(x, z);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 1bd2167aa..d12e4763a 100644
index 14f419deb8..630ebfb37c 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -162,7 +162,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -45,7 +45,7 @@ index 1bd2167aa..d12e4763a 100644
}
public void a(EnumSkyBlock enumskyblock, BlockPosition blockposition, int i) {
@@ -1967,7 +1968,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1959,7 +1960,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
if (blockposition.isInvalidYLocation()) { // Paper
return false;
} else {
@ -55,7 +55,7 @@ index 1bd2167aa..d12e4763a 100644
return chunk != null && !chunk.isEmpty();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index e0b466d0c..2c4465fff 100644
index 72eb8ed4f4..7e52859c1d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -218,7 +218,7 @@ public class CraftWorld implements World {

View File

@ -1,4 +1,4 @@
From 74a659caa33a7279b1be97385ce24e7e55082a65 Mon Sep 17 00:00:00 2001
From 722c4b837cfcb6db6ac546e4d3952b9552d7a56d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 28 Sep 2018 20:46:29 -0400
Subject: [PATCH] Optimize Light Recalculations
@ -7,7 +7,7 @@ Optimizes to not repeatedly look up the same chunk for
light lookups.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index fb00e7a9c..fabfc315c 100644
index 4f64072a7b..966879a894 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -353,7 +353,7 @@ public class Chunk implements IChunkAccess {
@ -20,7 +20,7 @@ index fb00e7a9c..fabfc315c 100644
this.x = true;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 739fbecac..739448d8b 100644
index 97a0fbd55c..fb71879ac0 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -591,8 +591,9 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -35,7 +35,7 @@ index 739fbecac..739448d8b 100644
}
}
@@ -2228,6 +2229,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2220,6 +2221,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
// CraftBukkit start - Use neighbor cache instead of looking up
Chunk chunk = this.getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4);

View File

@ -1,4 +1,4 @@
From 78aed292564c995e7aec1bcfd4fe1c89acb58e31 Mon Sep 17 00:00:00 2001
From 3c966ef69587e91e36e7b83cc8d175ae73c91dfb Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 28 Sep 2018 21:49:53 -0400
Subject: [PATCH] Fix issues with entity loss due to unloaded chunks
@ -18,7 +18,7 @@ This change ensures the chunks are always loaded when entities are
added to the world, or a valid entity moves between chunks.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 739448d8b..e88e265bf 100644
index fb71879ac0..728319968b 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1081,7 +1081,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -30,7 +30,7 @@ index 739448d8b..e88e265bf 100644
// Paper start - Set origin location when the entity is being added to the world
if (entity.origin == null) {
@@ -1585,7 +1585,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1577,7 +1577,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.getChunkAt(entity.chunkX, entity.chunkZ).a(entity, entity.chunkY);
}

View File

@ -1,4 +1,4 @@
From 56d87b1b48beb896633f0c9364806f711ae53655 Mon Sep 17 00:00:00 2001
From 8484a08f0e21ca3e231e2c2fa45de1ebeddc7f80 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 29 Sep 2018 01:18:16 -0400
Subject: [PATCH] Fix Sending Chunks to Client
@ -14,10 +14,10 @@ This fix always sends chunks to the client, and simply updates
the client anytime post processing is triggered with the new chunk data.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index d848a97bd..2bcbf8902 100644
index 0d51c1baeb..46804203fe 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1189,7 +1189,7 @@ public class Chunk implements IChunkAccess {
@@ -1190,7 +1190,7 @@ public class Chunk implements IChunkAccess {
}
public boolean isReady() {
@ -26,7 +26,7 @@ index d848a97bd..2bcbf8902 100644
}
public boolean v() {
@@ -1427,6 +1427,13 @@ public class Chunk implements IChunkAccess {
@@ -1428,6 +1428,13 @@ public class Chunk implements IChunkAccess {
this.h.clear();
this.a(ChunkStatus.POSTPROCESSED);
this.m.a(this);
@ -41,7 +41,7 @@ index d848a97bd..2bcbf8902 100644
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index e4cf8548d..ac5d15809 100644
index e4cf8548d3..ac5d158093 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -20,7 +20,7 @@ public class PlayerChunk {

View File

@ -1,4 +1,4 @@
From d476245f6673b26958fae0aa6d4c91fe2c5a5201 Mon Sep 17 00:00:00 2001
From d0ad57fd8f5cd9986e4cbad278129c2759002d9d Mon Sep 17 00:00:00 2001
From: theosib <millerti@172.16.221.1>
Date: Thu, 27 Sep 2018 01:43:35 -0600
Subject: [PATCH] Optimize redstone algorithm
@ -19,7 +19,7 @@ Aside from making the obvious class/function renames and obfhelpers I didn't nee
Just added Bukkit's event system and took a few liberties with dead code and comment misspellings.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 61ad2cef7..a70a64070 100644
index 61ad2cef7b..a70a64070e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -588,4 +588,14 @@ public class PaperWorldConfig {
@ -39,7 +39,7 @@ index 61ad2cef7..a70a64070 100644
}
diff --git a/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java
new file mode 100644
index 000000000..21d9d6d7e
index 0000000000..21d9d6d7ed
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java
@@ -0,0 +1,910 @@
@ -954,7 +954,7 @@ index 000000000..21d9d6d7e
+ }
+}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
index 2e30270bb..72d261707 100644
index 2e30270bb7..72d2617071 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
@@ -1,5 +1,7 @@
@ -1122,7 +1122,7 @@ index 2e30270bb..72d261707 100644
iblockdata.a(world, blockposition, 0);
world.setAir(blockposition);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index d9006a2d6..7f78445dc 100644
index 027bb64acc..645af17a58 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -648,6 +648,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -1133,7 +1133,7 @@ index d9006a2d6..7f78445dc 100644
public void a(BlockPosition blockposition, Block block, BlockPosition blockposition1) {
if (!this.isClientSide) {
IBlockData iblockdata = this.getType(blockposition);
@@ -2601,6 +2602,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2593,6 +2594,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
return this.getBlockFacePower(blockposition.down(), EnumDirection.DOWN) > 0 ? true : (this.getBlockFacePower(blockposition.up(), EnumDirection.UP) > 0 ? true : (this.getBlockFacePower(blockposition.north(), EnumDirection.NORTH) > 0 ? true : (this.getBlockFacePower(blockposition.south(), EnumDirection.SOUTH) > 0 ? true : (this.getBlockFacePower(blockposition.west(), EnumDirection.WEST) > 0 ? true : this.getBlockFacePower(blockposition.east(), EnumDirection.EAST) > 0))));
}

View File

@ -1,4 +1,4 @@
From 95730a89b8feceb17a77e6f7513b07c3cdb5cdb1 Mon Sep 17 00:00:00 2001
From f7085de57b10b4447c4fcf502780a649de366208 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Tue, 13 Nov 2018 14:01:00 +0000
Subject: [PATCH] limit the range at which we'll consider an attackable target
@ -12,10 +12,10 @@ decrease when set, allowing us to skip further checks earlier on
when looking for an attackable entity
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 7f78445dc..b6c602bd0 100644
index 645af17a58..7721dfee65 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -2729,8 +2729,13 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2721,8 +2721,13 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);