mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 06:30:46 +01:00
Merge branch 'master' into pre/1.13
* master: Relookup Entity Save ID if was null during precache
This commit is contained in:
commit
817b9934c7
12 changed files with 66 additions and 71 deletions
|
@ -13,10 +13,10 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE
|
|||
If Tile Entity was null, correct Sign to return empty lines instead of null
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
index 9ad14417e3..3e9b357c87 100644
|
||||
index 6021a3401f..536fd37254 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject {
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { // Paper
|
||||
}
|
||||
|
||||
// CraftBukkit start - add method
|
||||
|
@ -29,7 +29,7 @@ index 9ad14417e3..3e9b357c87 100644
|
|||
if (world == null) return null;
|
||||
// Spigot start
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject {
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { // Paper
|
||||
return null;
|
||||
}
|
||||
// Spigot end
|
||||
|
@ -39,7 +39,7 @@ index 9ad14417e3..3e9b357c87 100644
|
|||
return null;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index 698d044a8d..9514968b07 100644
|
||||
index d6e4adf147..8cb08c5584 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -0,0 +0,0 @@ public class CraftBlock implements Block {
|
||||
|
|
|
@ -19,7 +19,7 @@ index e8f7b7292d..7ff8e70b24 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 29c7043c86..1a7d78a5c3 100644
|
||||
index 29c7043c86..628fda8e7c 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityPortalEvent;
|
||||
|
@ -40,32 +40,26 @@ index 29c7043c86..1a7d78a5c3 100644
|
|||
private int id;
|
||||
public boolean j;
|
||||
public final List<Entity> passengers;
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener {
|
||||
} else {
|
||||
this.defaultActivationState = false;
|
||||
}
|
||||
+ // Paper start
|
||||
+ this.entityKey = EntityTypes.getName(entitytypes);
|
||||
+ this.entityKeyString = this.entityKey != null ? this.entityKey.toString() : null;
|
||||
+ // Paper end
|
||||
// Spigot end
|
||||
|
||||
this.datawatcher = new DataWatcher(this);
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener {
|
||||
return true;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public final MinecraftKey entityKey;
|
||||
+ public final String entityKeyString;
|
||||
+ private MinecraftKey entityKey;
|
||||
+ private String entityKeyString;
|
||||
+
|
||||
+ @Override
|
||||
+ public MinecraftKey getMinecraftKey() {
|
||||
+ if (entityKey == null) {
|
||||
+ this.entityKey = EntityTypes.getName(this.getEntityType());
|
||||
+ this.entityKeyString = this.entityKey != null ? this.entityKey.toString() : null;
|
||||
+ }
|
||||
+ return entityKey;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getMinecraftKeyString() {
|
||||
+ getMinecraftKey(); // Try to load if it doesn't exists. see: https://github.com/PaperMC/Paper/issues/1280
|
||||
+ return entityKeyString;
|
||||
+ }
|
||||
@Nullable
|
||||
|
@ -75,7 +69,7 @@ index 29c7043c86..1a7d78a5c3 100644
|
|||
-
|
||||
- return entitytypes.a() && minecraftkey != null ? minecraftkey.toString() : null;
|
||||
+ EntityTypes type = this.getEntityType();
|
||||
+ return type != null && type.isPersistable() ? entityKeyString : null;
|
||||
+ return type != null && type.isPersistable() ? getMinecraftKeyString() : null;
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
|
@ -94,7 +88,7 @@ index 9a513b4e3a..fa268f3543 100644
|
|||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/KeyedObject.java b/src/main/java/net/minecraft/server/KeyedObject.java
|
||||
new file mode 100644
|
||||
index 0000000000..61c2b993c9
|
||||
index 0000000000..743142d030
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/KeyedObject.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -103,11 +97,12 @@ index 0000000000..61c2b993c9
|
|||
+public interface KeyedObject {
|
||||
+ MinecraftKey getMinecraftKey();
|
||||
+ default String getMinecraftKeyString() {
|
||||
+ return getMinecraftKey().toString();
|
||||
+ MinecraftKey key = getMinecraftKey();
|
||||
+ return key != null ? key.toString() : null;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
index 8a0453245d..257dd1da9c 100644
|
||||
index 8a0453245d..5ca7fef518 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
|
||||
|
@ -115,7 +110,7 @@ index 8a0453245d..257dd1da9c 100644
|
|||
import org.bukkit.inventory.InventoryHolder; // CraftBukkit
|
||||
|
||||
-public abstract class TileEntity {
|
||||
+public abstract class TileEntity implements KeyedObject {
|
||||
+public abstract class TileEntity implements KeyedObject { // Paper
|
||||
|
||||
public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot
|
||||
private static final Logger a = LogManager.getLogger();
|
||||
|
@ -125,24 +120,25 @@ index 8a0453245d..257dd1da9c 100644
|
|||
protected BlockPosition position;
|
||||
protected boolean d;
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntity {
|
||||
public TileEntity(TileEntityTypes<?> tileentitytypes) {
|
||||
this.position = BlockPosition.ZERO;
|
||||
this.e = tileentitytypes;
|
||||
+ // Paper start
|
||||
+ this.tileEntityKey = TileEntityTypes.a(tileentitytypes);
|
||||
+ this.tileEntityKeyString = tileEntityKey != null ? tileEntityKey.toString() : null;
|
||||
}
|
||||
|
||||
+ public final MinecraftKey tileEntityKey;
|
||||
+ public final String tileEntityKeyString;
|
||||
+ // Paper start
|
||||
+ private String tileEntityKeyString = null;
|
||||
+ private MinecraftKey tileEntityKey = null;
|
||||
+
|
||||
+ @Override
|
||||
+ public MinecraftKey getMinecraftKey() {
|
||||
+ if (tileEntityKey == null) {
|
||||
+ tileEntityKey = TileEntityTypes.a(this.getTileEntityType());
|
||||
+ tileEntityKeyString = tileEntityKey != null ? tileEntityKey.toString() : null;
|
||||
+ }
|
||||
+ return tileEntityKey;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getMinecraftKeyString() {
|
||||
+ getMinecraftKey(); // Try to load if it doesn't exists.
|
||||
+ return tileEntityKeyString;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
|
|
@ -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 eb7a41977..0d80d811a 100644
|
||||
index 39aeabff74..ea7d82f099 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
@ -38,7 +38,7 @@ index eb7a41977..0d80d811a 100644
|
|||
+ inventoryEntityCounts[k]++;
|
||||
+ }
|
||||
entity.setCurrentChunk(this);
|
||||
entityCounts.increment(entity.entityKeyString);
|
||||
entityCounts.increment(entity.getMinecraftKeyString());
|
||||
// Paper end
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
if (!this.entitySlices[i].remove(entity)) {
|
||||
|
@ -50,7 +50,7 @@ index eb7a41977..0d80d811a 100644
|
|||
+ inventoryEntityCounts[i]--;
|
||||
+ }
|
||||
entity.setCurrentChunk(null);
|
||||
entityCounts.decrement(entity.entityKeyString);
|
||||
entityCounts.decrement(entity.getMinecraftKeyString());
|
||||
// Paper end
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
if (!this.entitySlices[k].isEmpty()) {
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Configurable top of nether void damage
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 38a697e1b..68898d624 100644
|
||||
index 38a697e1b7..68898d624f 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
|
@ -20,7 +20,7 @@ index 38a697e1b..68898d624 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 778b8d440..1870930f6 100644
|
||||
index 5ba537bab2..f95024cba5 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
@ -63,7 +63,7 @@ index 778b8d440..1870930f6 100644
|
|||
this.die();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
||||
index 6e48cf475..4644d7efe 100644
|
||||
index 6e48cf4751..4644d7efe3 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableT
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Entity Origin API
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 20248de7e..6bb4cf48e 100644
|
||||
index 04674c39d5..5ba537bab2 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
@ -51,7 +51,7 @@ index 20248de7e..6bb4cf48e 100644
|
|||
NBTTagList nbttaglist = new NBTTagList();
|
||||
double[] adouble1 = adouble;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
index 8d47b58c9..7e5a2775a 100644
|
||||
index 5e01aa0f85..33bc46b054 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity {
|
||||
|
@ -70,7 +70,7 @@ index 8d47b58c9..7e5a2775a 100644
|
|||
|
||||
public void a(boolean flag) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
index 5ceb3f206..87f3205f8 100644
|
||||
index 5ceb3f2068..87f3205f82 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
|
||||
|
@ -89,7 +89,7 @@ index 5ceb3f206..87f3205f8 100644
|
|||
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java
|
||||
index a8280acf9..38dd8f17a 100644
|
||||
index a8280acf94..38dd8f17a6 100644
|
||||
--- a/src/main/java/net/minecraft/server/NBTTagList.java
|
||||
+++ b/src/main/java/net/minecraft/server/NBTTagList.java
|
||||
@@ -0,0 +0,0 @@ public class NBTTagList extends NBTList<NBTBase> {
|
||||
|
@ -101,7 +101,7 @@ index a8280acf9..38dd8f17a 100644
|
|||
if (i >= 0 && i < this.list.size()) {
|
||||
NBTBase nbtbase = (NBTBase) this.list.get(i);
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index fd64b75ed..3f0b6ac26 100644
|
||||
index ae11c2e431..e3c56a7506 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
|
@ -118,7 +118,7 @@ index fd64b75ed..3f0b6ac26 100644
|
|||
flag = true;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index f09251eec..34246369c 100644
|
||||
index f09251eec8..34246369c5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Entity#fromMobSpawner()
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 6db20aa75c..bd232b31e4 100644
|
||||
index f79295052a..034169140b 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
|
|
@ -25,11 +25,11 @@ index 785a1a2184..528db8704e 100644
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
index e03965fc7c..9ad14417e3 100644
|
||||
index d8d519143e..6021a3401f 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.inventory.InventoryHolder; // CraftBukkit
|
||||
public abstract class TileEntity implements KeyedObject {
|
||||
public abstract class TileEntity implements KeyedObject { // Paper
|
||||
|
||||
public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper
|
||||
+ boolean isLoadingStructure = false; // Paper
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Optional TNT doesn't move in water
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index a3823408c..41e73b340 100644
|
||||
index a3823408ca..41e73b3409 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ package com.destroystokyo.paper;
|
||||
|
@ -32,7 +32,7 @@ index a3823408c..41e73b340 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 93df154b1..e56f458ca 100644
|
||||
index 1f41c1ded1..d35c0437f3 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
@ -61,7 +61,7 @@ index 93df154b1..e56f458ca 100644
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
index 87f3205f8..8c1d25979 100644
|
||||
index 87f3205f82..8c1d25979f 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Prevent tile entity and entity crashes
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
index 6b8a1c8c8..e03965fc7 100644
|
||||
index 0d54513a44..d8d519143e 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject {
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { // Paper
|
||||
return TileEntityTypes.a.b(this.C()) + " // " + this.getClass().getCanonicalName();
|
||||
});
|
||||
if (this.world != null) {
|
||||
|
@ -23,7 +23,7 @@ index 6b8a1c8c8..e03965fc7 100644
|
|||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index e3c56a750..bfe09a205 100644
|
||||
index e3c56a7506..bfe09a2055 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
|
|
|
@ -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 7837f1024..0a0d04cf6 100644
|
||||
index 7837f1024c..24a2ec4b4a 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
@ -21,11 +21,11 @@ index 7837f1024..0a0d04cf6 100644
|
|||
TileEntity replaced = super.put(key, value);
|
||||
if (replaced != null) {
|
||||
replaced.setCurrentChunk(null);
|
||||
+ tileEntityCounts.decrement(replaced.tileEntityKeyString);
|
||||
+ tileEntityCounts.decrement(replaced.getMinecraftKeyString());
|
||||
}
|
||||
if (value != null) {
|
||||
value.setCurrentChunk(Chunk.this);
|
||||
+ tileEntityCounts.increment(value.tileEntityKeyString);
|
||||
+ tileEntityCounts.increment(value.getMinecraftKeyString());
|
||||
}
|
||||
return replaced;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ index 7837f1024..0a0d04cf6 100644
|
|||
TileEntity removed = super.remove(key);
|
||||
if (removed != null) {
|
||||
removed.setCurrentChunk(null);
|
||||
+ tileEntityCounts.decrement(removed.tileEntityKeyString);
|
||||
+ tileEntityCounts.decrement(removed.getMinecraftKeyString());
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ index 7837f1024..0a0d04cf6 100644
|
|||
this.entitySlices[k].add(entity);
|
||||
// Paper start
|
||||
entity.setCurrentChunk(this);
|
||||
+ entityCounts.increment(entity.entityKeyString);
|
||||
+ entityCounts.increment(entity.getMinecraftKeyString());
|
||||
// Paper end
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ index 7837f1024..0a0d04cf6 100644
|
|||
return;
|
||||
}
|
||||
entity.setCurrentChunk(null);
|
||||
+ entityCounts.decrement(entity.entityKeyString);
|
||||
+ entityCounts.decrement(entity.getMinecraftKeyString());
|
||||
// Paper end
|
||||
}
|
||||
|
||||
|
|
|
@ -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 cd4fbee0c..7837f1024 100644
|
||||
index cd4fbee0ca..7837f1024c 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
@ -86,14 +86,13 @@ index cd4fbee0c..7837f1024 100644
|
|||
|
||||
public boolean c(BlockPosition blockposition) {
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index e65558f7a..36cc0c18d 100644
|
||||
index 628fda8e7c..17bcef97e0 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
}
|
||||
|
||||
// Paper start
|
||||
+
|
||||
+ private java.lang.ref.WeakReference<Chunk> currentChunk = null;
|
||||
+
|
||||
+ public void setCurrentChunk(Chunk chunk) {
|
||||
|
@ -127,21 +126,21 @@ index e65558f7a..36cc0c18d 100644
|
|||
+ return getCurrentChunkAt((int)Math.floor(locX) >> 4, (int)Math.floor(locZ) >> 4);
|
||||
+ }
|
||||
+
|
||||
public final MinecraftKey entityKey;
|
||||
public final String entityKeyString;
|
||||
private MinecraftKey entityKey;
|
||||
private String entityKeyString;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
index 257dd1da9..cffbcb8f7 100644
|
||||
index 5ca7fef518..9361667c3b 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject {
|
||||
public String getMinecraftKeyString() {
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { // Paper
|
||||
getMinecraftKey(); // Try to load if it doesn't exists.
|
||||
return tileEntityKeyString;
|
||||
}
|
||||
+
|
||||
+ private java.lang.ref.WeakReference<Chunk> currentChunk = null;
|
||||
+ public Chunk getCurrentChunk() {
|
||||
+ final Chunk chunk = currentChunk != null ? currentChunk.get() : world.getChunkIfLoaded(position.getX() >> 4, position.getZ() >> 4);
|
||||
+ final Chunk chunk = currentChunk != null ? currentChunk.get() : null;
|
||||
+ return chunk != null && chunk.isLoaded() ? chunk : null;
|
||||
+ }
|
||||
+ public void setCurrentChunk(Chunk chunk) {
|
||||
|
@ -151,7 +150,7 @@ index 257dd1da9..cffbcb8f7 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 72164e11a..f09251eec 100644
|
||||
index 72164e11af..f09251eec8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -0,0 +0,0 @@ import java.util.UUID;
|
||||
|
|
|
@ -660,7 +660,7 @@ index 3706e44a34..bf1fffcfee 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 e67c5dc90b..f1e71de42a 100644
|
||||
index 17bcef97e0..5590919dd6 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.command.CommandSender;
|
||||
|
@ -806,7 +806,7 @@ index ae31935c48..70c9b1f50c 100644
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 71ee66a9bb..1839bf7d24 100644
|
||||
index d453d0c421..83a73b86ea 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -1194,7 +1194,7 @@ index a07895935e..ee5c2421bb 100644
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
index cffbcb8f71..6b8a1c8c8b 100644
|
||||
index 9361667c3b..0d54513a44 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
|
||||
|
@ -1206,7 +1206,7 @@ index cffbcb8f71..6b8a1c8c8b 100644
|
|||
+import co.aikar.timings.Timing; // Paper
|
||||
import org.bukkit.inventory.InventoryHolder; // CraftBukkit
|
||||
|
||||
public abstract class TileEntity implements KeyedObject {
|
||||
public abstract class TileEntity implements KeyedObject { // Paper
|
||||
|
||||
- public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot
|
||||
+ public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper
|
||||
|
|
Loading…
Reference in a new issue