mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
Remove entities from per-chunk list (Fixes #2918)
This commit is contained in:
parent
b21010e7e3
commit
859f1296fe
12 changed files with 85 additions and 78 deletions
|
@ -1,4 +1,4 @@
|
|||
From 9360a474d1de17fd98648746c9ec18708a1711ad Mon Sep 17 00:00:00 2001
|
||||
From c750b5ba92a117b69ce896b1147e65a79044a244 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 28 Mar 2016 20:55:47 -0400
|
||||
Subject: [PATCH] MC Utils
|
||||
|
@ -1700,7 +1700,7 @@ index c88a62f6b..5dbd3e60f 100644
|
|||
this.d = i;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 55373cae0..517014d21 100644
|
||||
index 55373cae0..af10c18d4 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -25,7 +25,7 @@ import org.apache.logging.log4j.Logger;
|
||||
|
@ -1769,7 +1769,15 @@ index 55373cae0..517014d21 100644
|
|||
this.entitySlices[k].add(entity);
|
||||
}
|
||||
|
||||
@@ -395,6 +413,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -374,6 +392,7 @@ public class Chunk implements IChunkAccess {
|
||||
}
|
||||
|
||||
this.entitySlices[i].remove(entity);
|
||||
+ this.entities.remove(entity); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -395,6 +414,7 @@ public class Chunk implements IChunkAccess {
|
||||
return this.a(blockposition, Chunk.EnumTileEntityState.CHECK);
|
||||
}
|
||||
|
||||
|
@ -1777,7 +1785,7 @@ index 55373cae0..517014d21 100644
|
|||
@Nullable
|
||||
public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
|
||||
// CraftBukkit start
|
||||
@@ -507,6 +526,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -507,6 +527,7 @@ public class Chunk implements IChunkAccess {
|
||||
// CraftBukkit start
|
||||
public void loadCallback() {
|
||||
org.bukkit.Server server = this.world.getServer();
|
||||
|
@ -1785,7 +1793,7 @@ index 55373cae0..517014d21 100644
|
|||
if (server != null) {
|
||||
/*
|
||||
* If it's a new world, the first few chunks are generated inside
|
||||
@@ -545,6 +565,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -545,6 +566,7 @@ public class Chunk implements IChunkAccess {
|
||||
server.getPluginManager().callEvent(unloadEvent);
|
||||
// note: saving can be prevented, but not forced if no saving is actually required
|
||||
this.mustNotSave = !unloadEvent.isSaveChunk();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 0fb24c3112ee195e65b308f168e3bca44fa4edab Mon Sep 17 00:00:00 2001
|
||||
From 5dceede9a1d0b751290ea95355ee03e831d4be85 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 a263f60d49..8627365923 100644
|
||||
index af10c18d4..02b142fe8 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -29,7 +29,7 @@ public class Chunk implements IChunkAccess {
|
||||
|
@ -74,11 +74,10 @@ index a263f60d49..8627365923 100644
|
|||
public void b(Entity entity) {
|
||||
this.a(entity, entity.chunkY);
|
||||
}
|
||||
@@ -390,8 +417,12 @@ public class Chunk implements IChunkAccess {
|
||||
if (i >= this.entitySlices.length) {
|
||||
@@ -391,7 +418,12 @@ public class Chunk implements IChunkAccess {
|
||||
i = this.entitySlices.length - 1;
|
||||
}
|
||||
-
|
||||
|
||||
- this.entitySlices[i].remove(entity);
|
||||
+ // Paper start
|
||||
+ if (entity.currentChunk != null && entity.currentChunk.get() == this) entity.setCurrentChunk(null);
|
||||
|
@ -86,11 +85,11 @@ index a263f60d49..8627365923 100644
|
|||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.entities.remove(entity); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index a8ea70b36b..3a969d92e0 100644
|
||||
index e9e40f159..306724e69 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -134,7 +134,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
@ -143,7 +142,7 @@ index a8ea70b36b..3a969d92e0 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 9071bb7ece..820180ab3f 100644
|
||||
index 9071bb7ec..820180ab3 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
@@ -51,6 +51,15 @@ public abstract class TileEntity implements KeyedObject { // Paper
|
||||
|
@ -163,7 +162,7 @@ index 9071bb7ece..820180ab3f 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 63ecbcd47a..c82c213260 100644
|
||||
index 63ecbcd47..c82c21326 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -138,6 +138,7 @@ import net.minecraft.server.EntityZombieVillager;
|
||||
|
@ -188,5 +187,5 @@ index 63ecbcd47a..c82c213260 100644
|
|||
/**
|
||||
* Order is *EXTREMELY* important -- keep it right! =D
|
||||
--
|
||||
2.25.0.windows.1
|
||||
2.25.0
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 109173e7396da82ee8dcef2df5036d1dda99b0f2 Mon Sep 17 00:00:00 2001
|
||||
From 9cb17cf35fc80ec87379bcb8dcce5a034aa536e8 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 8627365923..4110b6fa39 100644
|
||||
index 02b142fe8..e58dd3e6d 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -56,15 +56,19 @@ public class Chunk implements IChunkAccess {
|
||||
|
@ -45,14 +45,14 @@ index 8627365923..4110b6fa39 100644
|
|||
entity.inChunk = true;
|
||||
entity.setCurrentChunk(this); // Paper
|
||||
entity.chunkX = this.loc.x;
|
||||
@@ -422,6 +428,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -423,6 +429,7 @@ public class Chunk implements IChunkAccess {
|
||||
if (!this.entitySlices[i].remove(entity)) {
|
||||
return;
|
||||
}
|
||||
+ entityCounts.decrement(entity.getMinecraftKeyString());
|
||||
// Paper end
|
||||
this.entities.remove(entity); // Paper
|
||||
}
|
||||
|
||||
--
|
||||
2.25.0.windows.1
|
||||
2.25.0
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 90208679a7f12b67d2c5cab6d310144554d78d2e Mon Sep 17 00:00:00 2001
|
||||
From a4a6f03e666aa2f01f7dee3aad76884da38fe00b 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
|
||||
|
@ -355,10 +355,10 @@ index cd72a9c84..5de881371 100644
|
|||
private final float frictionFactor;
|
||||
private final float f;
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 4110b6fa3..2ebbcc695 100644
|
||||
index e58dd3e6d..0b32179b7 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -574,6 +574,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -576,6 +576,7 @@ public class Chunk implements IChunkAccess {
|
||||
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(this.bukkitChunk, this.needsDecoration));
|
||||
|
||||
if (this.needsDecoration) {
|
||||
|
@ -366,7 +366,7 @@ index 4110b6fa3..2ebbcc695 100644
|
|||
this.needsDecoration = false;
|
||||
java.util.Random random = new java.util.Random();
|
||||
random.setSeed(world.getSeed());
|
||||
@@ -593,6 +594,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -595,6 +596,7 @@ public class Chunk implements IChunkAccess {
|
||||
}
|
||||
}
|
||||
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk));
|
||||
|
@ -1848,5 +1848,5 @@ index ca7789b5e..442383969 100644
|
|||
}
|
||||
}
|
||||
--
|
||||
2.25.0.windows.1
|
||||
2.25.0
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
From e9d2579100a78a8de64e2942babd0acee0965be5 Mon Sep 17 00:00:00 2001
|
||||
From caecbd9db7f124511fcbeb92cc6afb88982a412a 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 2ebbcc6958..e7268074b4 100644
|
||||
index 0b32179b7..9adb21279 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -506,6 +506,10 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -508,6 +508,10 @@ public class Chunk implements IChunkAccess {
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
|
@ -20,5 +20,5 @@ index 2ebbcc6958..e7268074b4 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.25.0.windows.1
|
||||
2.25.0
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 058e5298ae051aef1224425039ae5e6042a61679 Mon Sep 17 00:00:00 2001
|
||||
From ad137e8e3c6ec5c46cd87caa10e2c1056439bfef 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
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Add exception reporting event
|
|||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java
|
||||
new file mode 100644
|
||||
index 0000000000..f699ce18ca
|
||||
index 000000000..f699ce18c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java
|
||||
@@ -0,0 +1,38 @@
|
||||
|
@ -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 e7268074b4..6ed23ea6c8 100644
|
||||
index 9adb21279..f3d20f214 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -1,5 +1,6 @@
|
||||
|
@ -59,7 +59,7 @@ index e7268074b4..6ed23ea6c8 100644
|
|||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||
@@ -511,10 +512,15 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -513,10 +514,15 @@ public class Chunk implements IChunkAccess {
|
||||
this.tileEntities.remove(blockposition);
|
||||
// Paper end
|
||||
} else {
|
||||
|
@ -80,7 +80,7 @@ index e7268074b4..6ed23ea6c8 100644
|
|||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 1ba34cfaa9..3ef7e4561f 100644
|
||||
index b09868e2d..1d789b668 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -15,6 +15,9 @@ import java.util.function.BooleanSupplier;
|
||||
|
@ -94,7 +94,7 @@ index 1ba34cfaa9..3ef7e4561f 100644
|
|||
public class ChunkProviderServer extends IChunkProvider {
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
|
||||
index c9c2b00251..1422503e11 100644
|
||||
index c9c2b0025..1422503e1 100644
|
||||
--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
|
||||
+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
|
||||
@@ -1,5 +1,6 @@
|
||||
|
@ -121,7 +121,7 @@ index c9c2b00251..1422503e11 100644
|
|||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
index b2260498cb..c575ff57dd 100644
|
||||
index b2260498c..c575ff57d 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -727,6 +727,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
|
@ -141,7 +141,7 @@ index b2260498cb..c575ff57dd 100644
|
|||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
|
||||
index 187c4e0f58..c2312a227c 100644
|
||||
index 187c4e0f5..c2312a227 100644
|
||||
--- a/src/main/java/net/minecraft/server/RegionFile.java
|
||||
+++ b/src/main/java/net/minecraft/server/RegionFile.java
|
||||
@@ -241,6 +241,7 @@ public class RegionFile implements AutoCloseable {
|
||||
|
@ -161,7 +161,7 @@ index 187c4e0f58..c2312a227c 100644
|
|||
} finally {
|
||||
if (filechannel != null) {
|
||||
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
||||
index 8ba344df64..02157d051f 100644
|
||||
index 8ba344df6..02157d051 100644
|
||||
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
|
||||
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
||||
@@ -8,6 +8,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
|
@ -189,7 +189,7 @@ index 8ba344df64..02157d051f 100644
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
|
||||
index d5e9bae709..1bcf01c09a 100644
|
||||
index d5e9bae70..1bcf01c09 100644
|
||||
--- a/src/main/java/net/minecraft/server/VillageSiege.java
|
||||
+++ b/src/main/java/net/minecraft/server/VillageSiege.java
|
||||
@@ -1,5 +1,7 @@
|
||||
|
@ -209,7 +209,7 @@ index d5e9bae709..1bcf01c09a 100644
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index caead09a64..bf20ce9341 100644
|
||||
index caead09a6..bf20ce934 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -2,6 +2,9 @@ package net.minecraft.server;
|
||||
|
@ -248,7 +248,7 @@ index caead09a64..bf20ce9341 100644
|
|||
return;
|
||||
// Paper end
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldPersistentData.java b/src/main/java/net/minecraft/server/WorldPersistentData.java
|
||||
index 19e68a7831..a2a25cf6a4 100644
|
||||
index 19e68a783..a2a25cf6a 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldPersistentData.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldPersistentData.java
|
||||
@@ -121,6 +121,7 @@ public class WorldPersistentData {
|
||||
|
@ -260,7 +260,7 @@ index 19e68a7831..a2a25cf6a4 100644
|
|||
} finally {
|
||||
if (pushbackinputstream != null) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
index 8823f94f7b..552daf4376 100644
|
||||
index 8823f94f7..552daf437 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
@@ -16,6 +16,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From d6acffa96589e496354732eab4ffabeb36dec11d Mon Sep 17 00:00:00 2001
|
||||
From f2b28db6cbd7289df74c913e2b2f275eb530c031 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 28 Mar 2016 20:46:14 -0400
|
||||
Subject: [PATCH] Configurable Chunk Inhabited Time
|
||||
|
@ -11,7 +11,7 @@ For people who want all chunks to be treated equally, you can chose a fixed valu
|
|||
This allows to fine-tune vanilla gameplay.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 6ef0e1399e..5872e6b171 100644
|
||||
index 6ef0e1399..5872e6b17 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -236,4 +236,14 @@ public class PaperWorldConfig {
|
||||
|
@ -30,10 +30,10 @@ index 6ef0e1399e..5872e6b171 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 7033c6e839..c6a79644ef 100644
|
||||
index ee94f59e6..4fe36bb71 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -840,7 +840,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -842,7 +842,7 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
@Override
|
||||
public long getInhabitedTime() {
|
||||
|
@ -43,5 +43,5 @@ index 7033c6e839..c6a79644ef 100644
|
|||
|
||||
@Override
|
||||
--
|
||||
2.25.0.windows.1
|
||||
2.25.0
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
From 7db41031dd776df0570cfc2c86a08345d3d5bc2f Mon Sep 17 00:00:00 2001
|
||||
From b04aea34b60cbf074e239be94e0167d9766b9d22 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 8cf3076f4e..721eceeffc 100644
|
||||
index 8cf3076f4..721eceeff 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -298,4 +298,9 @@ public class PaperWorldConfig {
|
||||
|
@ -19,10 +19,10 @@ index 8cf3076f4e..721eceeffc 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index c6a79644ef..8fdae388e3 100644
|
||||
index 4fe36bb71..3af311c6e 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -532,6 +532,12 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -534,6 +534,12 @@ public class Chunk implements IChunkAccess {
|
||||
"Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16));
|
||||
e.printStackTrace();
|
||||
ServerInternalException.reportInternalException(e);
|
||||
|
@ -36,5 +36,5 @@ index c6a79644ef..8fdae388e3 100644
|
|||
// CraftBukkit end
|
||||
}
|
||||
--
|
||||
2.25.0.windows.1
|
||||
2.25.0
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From f2538725efa773c32f5c14be02a9c19ef3f931f3 Mon Sep 17 00:00:00 2001
|
||||
From de9e6201b6df14fa0dfc31a4fcb3037d9a626da3 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 23 Jul 2018 22:18:31 -0400
|
||||
Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 8fdae388e3..28e5105ffe 100644
|
||||
index 3af311c6e..68cde3356 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -416,6 +416,7 @@ public class Chunk implements IChunkAccess {
|
||||
|
@ -17,14 +17,14 @@ index 8fdae388e3..28e5105ffe 100644
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -442,6 +443,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -443,6 +444,7 @@ public class Chunk implements IChunkAccess {
|
||||
return;
|
||||
}
|
||||
entityCounts.decrement(entity.getMinecraftKeyString());
|
||||
+ this.markDirty(); // Paper
|
||||
// Paper end
|
||||
this.entities.remove(entity); // Paper
|
||||
}
|
||||
|
||||
--
|
||||
2.25.0.windows.1
|
||||
2.25.0
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 0acebe52e93af5833c06aa7223868da0e572226e Mon Sep 17 00:00:00 2001
|
||||
From 45990e551bfbcb491cba48dac25b6b669428216c Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 23 Jul 2018 22:44:23 -0400
|
||||
Subject: [PATCH] Add some Debug to Chunk Entity slices
|
||||
|
@ -9,7 +9,7 @@ This should hopefully avoid duplicate entities ever being created
|
|||
if the entity was to end up in 2 different chunk slices
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 28e5105ffe..2004f7fbe1 100644
|
||||
index 68cde3356..1d47e4737 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -407,6 +407,25 @@ public class Chunk implements IChunkAccess {
|
||||
|
@ -46,8 +46,8 @@ index 28e5105ffe..2004f7fbe1 100644
|
|||
this.markDirty(); // Paper
|
||||
}
|
||||
|
||||
@@ -439,6 +459,9 @@ public class Chunk implements IChunkAccess {
|
||||
}
|
||||
@@ -440,6 +460,9 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
// Paper start
|
||||
if (entity.currentChunk != null && entity.currentChunk.get() == this) entity.setCurrentChunk(null);
|
||||
+ if (entitySlices[i] == entity.entitySlice) {
|
||||
|
@ -57,7 +57,7 @@ index 28e5105ffe..2004f7fbe1 100644
|
|||
return;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 8e23f336a8..e761f71487 100644
|
||||
index fcc47182c..09ec144eb 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -71,6 +71,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
@ -69,5 +69,5 @@ index 8e23f336a8..e761f71487 100644
|
|||
|
||||
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
|
||||
--
|
||||
2.25.0.windows.1
|
||||
2.25.0
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 3993ccb409951da42b475f821c3e6134b3982777 Mon Sep 17 00:00:00 2001
|
||||
From 0a72bb4348272eee4bfd507865c781c5a5d198cc 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 eecf27370b..d704fc79c0 100644
|
||||
index eecf27370..d704fc79c 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
@@ -179,6 +179,7 @@ public class PaperCommand extends Command {
|
||||
|
@ -23,10 +23,10 @@ index eecf27370b..d704fc79c0 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/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 2004f7fbe1..7ecff4443a 100644
|
||||
index 1d47e4737..c464d6962 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -679,6 +679,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -681,6 +681,7 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
|
@ -34,7 +34,7 @@ index 2004f7fbe1..7ecff4443a 100644
|
|||
|
||||
if (entity1.getBoundingBox().c(axisalignedbb) && entity1 != entity) {
|
||||
if (predicate == null || predicate.test(entity1)) {
|
||||
@@ -716,6 +717,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -718,6 +719,7 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T entity = (T) iterator.next(); // CraftBukkit - decompile error
|
||||
|
@ -42,7 +42,7 @@ index 2004f7fbe1..7ecff4443a 100644
|
|||
|
||||
if ((entitytypes == null || entity.getEntityType() == entitytypes) && entity.getBoundingBox().c(axisalignedbb) && predicate.test(entity)) {
|
||||
list.add(entity);
|
||||
@@ -737,6 +739,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -739,6 +741,7 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = (T) iterator.next(); // CraftBukkit - decompile error
|
||||
|
@ -51,7 +51,7 @@ index 2004f7fbe1..7ecff4443a 100644
|
|||
if (oclass.isInstance(t0) && t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) { // Spigot - instance check
|
||||
list.add(t0);
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 09ec144eb6..4880ece947 100644
|
||||
index 09ec144eb..4880ece94 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -196,6 +196,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
@ -63,7 +63,7 @@ index 09ec144eb6..4880ece947 100644
|
|||
public float getBukkitYaw() {
|
||||
return this.yaw;
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 3d5a50ddcc..12cdb0cc9a 100644
|
||||
index 3d5a50ddc..12cdb0cc9 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -904,7 +904,7 @@ public class WorldServer extends World {
|
||||
|
@ -92,7 +92,7 @@ index 3d5a50ddcc..12cdb0cc9a 100644
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 89705e5ffa..fe91e08f22 100644
|
||||
index 89705e5ff..fe91e08f2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -1005,6 +1005,7 @@ public class CraftWorld implements World {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 9bc42552b2b41e2263f1f39db6b9d0d3f819b91b Mon Sep 17 00:00:00 2001
|
||||
From 141837bed113227f781b7f984d04d9baf8e1587e 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 3fdcc2e5d4..59d8a8719e 100644
|
||||
index 06b4dc628..37b12daff 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -84,6 +84,10 @@ public class Chunk implements IChunkAccess {
|
||||
|
@ -42,7 +42,7 @@ index 3fdcc2e5d4..59d8a8719e 100644
|
|||
entity.entitySlice = this.entitySlices[k]; // Paper
|
||||
this.markDirty(); // Paper
|
||||
}
|
||||
@@ -466,6 +477,11 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -467,6 +478,11 @@ public class Chunk implements IChunkAccess {
|
||||
if (!this.entitySlices[i].remove(entity)) {
|
||||
return;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ index 3fdcc2e5d4..59d8a8719e 100644
|
|||
entityCounts.decrement(entity.getMinecraftKeyString());
|
||||
this.markDirty(); // Paper
|
||||
// Paper end
|
||||
@@ -735,9 +751,29 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -737,9 +753,29 @@ public class Chunk implements IChunkAccess {
|
||||
i = MathHelper.clamp(i, 0, this.entitySlices.length - 1);
|
||||
j = MathHelper.clamp(j, 0, this.entitySlices.length - 1);
|
||||
|
||||
|
@ -85,7 +85,7 @@ index 3fdcc2e5d4..59d8a8719e 100644
|
|||
T t0 = (T) iterator.next(); // CraftBukkit - decompile error
|
||||
if (t0.shouldBeRemoved) continue; // Paper
|
||||
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||
index 498f381099..a2d1ef3602 100644
|
||||
index 498f38109..a2d1ef360 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 {
|
||||
|
@ -97,5 +97,5 @@ index 498f381099..a2d1ef3602 100644
|
|||
return entity instanceof IInventory && entity.isAlive();
|
||||
};
|
||||
--
|
||||
2.25.0.windows.1
|
||||
2.25.0
|
||||
|
||||
|
|
Loading…
Reference in a new issue