3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 13:00:06 +01:00

Extremely experimental fix to the tile-entity wipe, thanks to Wug

Dieser Commit ist enthalten in:
Dinnerbone 2011-08-04 11:57:51 +01:00
Ursprung effc6c8559
Commit 47453c6055
2 geänderte Dateien mit 15 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -478,7 +478,7 @@ public class Chunk {
while (iterator.hasNext()) { while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next(); TileEntity tileentity = (TileEntity) iterator.next();
tileentity.h(); world.markForRemoval(tileentity); // Craftbukkit
} }
for (int i = 0; i < this.entitySlices.length; ++i) { for (int i = 0; i < this.entitySlices.length; ++i) {

Datei anzeigen

@ -89,6 +89,7 @@ public class World implements IBlockAccess {
int lastXAccessed = Integer.MIN_VALUE; int lastXAccessed = Integer.MIN_VALUE;
int lastZAccessed = Integer.MIN_VALUE; int lastZAccessed = Integer.MIN_VALUE;
final Object chunkLock = new Object(); final Object chunkLock = new Object();
private List<TileEntity> tileEntitiesToUnload;
private boolean canSpawn(int x, int z) { private boolean canSpawn(int x, int z) {
if (this.generator != null) { if (this.generator != null) {
@ -106,10 +107,15 @@ public class World implements IBlockAccess {
return (CraftServer) Bukkit.getServer(); return (CraftServer) Bukkit.getServer();
} }
public void markForRemoval(TileEntity tileentity) {
tileEntitiesToUnload.add(tileentity);
}
// CraftBukkit - changed signature // CraftBukkit - changed signature
public World(IDataManager idatamanager, String s, long i, WorldProvider worldprovider, ChunkGenerator gen, org.bukkit.World.Environment env) { public World(IDataManager idatamanager, String s, long i, WorldProvider worldprovider, ChunkGenerator gen, org.bukkit.World.Environment env) {
this.generator = gen; this.generator = gen;
this.world = new CraftWorld((WorldServer) this, gen, env); this.world = new CraftWorld((WorldServer) this, gen, env);
tileEntitiesToUnload = new ArrayList<TileEntity>();
// CraftBukkit end // CraftBukkit end
this.Q = this.random.nextInt(12000); this.Q = this.random.nextInt(12000);
@ -1137,6 +1143,14 @@ public class World implements IBlockAccess {
} }
this.L = false; this.L = false;
// Craftbukkit start
if (!tileEntitiesToUnload.isEmpty()) {
this.c.removeAll(tileEntitiesToUnload);
this.tileEntitiesToUnload.clear();
}
// Craftbukkit end
if (!this.G.isEmpty()) { if (!this.G.isEmpty()) {
Iterator iterator1 = this.G.iterator(); Iterator iterator1 = this.G.iterator();