more patches added back

Dieser Commit ist enthalten in:
Jake Potrebic 2021-06-15 23:25:38 -07:00
Ursprung 98994a0aa1
Commit 852ce73590
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7C58557EC9C421F8
381 geänderte Dateien mit 353 neuen und 463 gelöschten Zeilen

Datei anzeigen

@ -8,7 +8,7 @@ to a chunk. The default values of -1 disable the limit. Although
defaults are only included for certain entites, this allows setting
limits for any entity type.
1.17: looks like tracking the count on should work fine just putting it in the EntityType#loadEntitiesRecursive, but
1.17: looks like tracking the count on loading should work fine just putting it in the EntityType#loadEntitiesRecursive, but
the tracking count on save needs some more work to implement.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java

Datei anzeigen

@ -32,28 +32,8 @@ This fix also maintains compatability if someone switches server jars to one wit
this fix, as the data will remain in the oversized file. Once the server returns
to a jar with this fix, the data will be restored.
diff --git a/src/main/java/net/minecraft/nbt/NbtIo.java b/src/main/java/net/minecraft/nbt/NbtIo.java
index c4fbc0bc8b80d16f09d3c6642acc7476a0817868..b3838e709c1581c25da7738c9a03a827761845b1 100644
--- a/src/main/java/net/minecraft/nbt/NbtIo.java
+++ b/src/main/java/net/minecraft/nbt/NbtIo.java
@@ -132,6 +132,7 @@ public class NbtIo {
}
+ public static CompoundTag readNBT(DataInput datainput) throws IOException { return read(datainput); } // Paper - OBFHELPER
public static CompoundTag read(DataInput input) throws IOException {
return read(input, NbtAccounter.UNLIMITED);
}
@@ -152,6 +153,7 @@ public class NbtIo {
}
}
+ public static void writeNBT(CompoundTag nbttagcompound, DataOutput dataoutput) throws IOException { write(nbttagcompound, dataoutput); } // Paper - OBFHELPER
public static void write(CompoundTag tag, DataOutput output) throws IOException {
writeUnnamedTag((Tag) tag, output);
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
index 1aa4d342b97f8be71c108194a6f1e0e2828aa364..424628c9588c02454558bc7e7c5bad3a3e75ec9f 100644
index 357da4846344d1182ab7149c4d352d5019384715..26ad58e7a73e63d2393eb277984be20472157539 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -20,8 +20,12 @@ import java.nio.file.LinkOption;
@ -69,25 +49,25 @@ index 1aa4d342b97f8be71c108194a6f1e0e2828aa364..424628c9588c02454558bc7e7c5bad3a
import net.minecraft.world.level.ChunkPos;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -38,6 +42,7 @@ public class RegionFile implements AutoCloseable {
private final IntBuffer timestamps;
@@ -48,6 +52,7 @@ public class RegionFile implements AutoCloseable {
@VisibleForTesting
protected final RegionBitmap usedSectors;
+ public final File file; // Paper
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper
+ public final File regionFile; // Paper
public RegionFile(File file, File directory, boolean dsync) throws IOException {
this(file.toPath(), directory.toPath(), RegionFileVersion.VERSION_DEFLATE, dsync);
@@ -45,6 +50,8 @@ public class RegionFile implements AutoCloseable {
@@ -55,6 +60,8 @@ public class RegionFile implements AutoCloseable {
public RegionFile(Path file, Path directory, RegionFileVersion outputChunkStreamVersion, boolean dsync) throws IOException {
this.header = ByteBuffer.allocateDirect(8192);
+ this.file = file.toFile(); // Paper
+ this.regionFile = file.toFile(); // Paper
+ initOversizedState(); // Paper
this.usedSectors = new RegionBitmap();
this.version = outputChunkStreamVersion;
if (!Files.isDirectory(directory, new LinkOption[0])) {
@@ -408,6 +415,74 @@ public class RegionFile implements AutoCloseable {
void run() throws IOException;
@@ -434,6 +441,74 @@ public class RegionFile implements AutoCloseable {
}
+ // Paper start
@ -143,26 +123,26 @@ index 1aa4d342b97f8be71c108194a6f1e0e2828aa364..424628c9588c02454558bc7e7c5bad3a
+ }
+
+ private File getOversizedMetaFile() {
+ return new File(this.file.getParentFile(), this.file.getName().replaceAll("\\.mca$", "") + ".oversized.nbt");
+ return new File(this.regionFile.getParentFile(), this.regionFile.getName().replaceAll("\\.mca$", "") + ".oversized.nbt");
+ }
+
+ private File getOversizedFile(int x, int z) {
+ return new File(this.file.getParentFile(), this.file.getName().replaceAll("\\.mca$", "") + "_oversized_" + x + "_" + z + ".nbt");
+ return new File(this.regionFile.getParentFile(), this.regionFile.getName().replaceAll("\\.mca$", "") + "_oversized_" + x + "_" + z + ".nbt");
+ }
+
+ synchronized CompoundTag getOversizedData(int x, int z) throws IOException {
+ File file = getOversizedFile(x, z);
+ try (DataInputStream out = new DataInputStream(new BufferedInputStream(new InflaterInputStream(new java.io.FileInputStream(file))))) {
+ return NbtIo.readNBT((java.io.DataInput) out);
+ return NbtIo.read((java.io.DataInput) out);
+ }
+
+ }
+ // Paper end
class ChunkBuffer extends ByteArrayOutputStream {
private class ChunkBuffer extends ByteArrayOutputStream {
private final ChunkPos pos;
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index f33a5fc725d1d5e895f8878d82ebc4172237ad29..6d3e1bb20d1ab8ce5c9ea613322042d80550761a 100644
index ebb1a050beab9530942c4498335f084c89faef06..f53268f2d7d2d1909d64d06bb6a61086386830e1 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -10,7 +10,9 @@ import java.io.File;
@ -175,7 +155,7 @@ index f33a5fc725d1d5e895f8878d82ebc4172237ad29..6d3e1bb20d1ab8ce5c9ea613322042d8
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ExceptionCollector;
import net.minecraft.world.level.ChunkPos;
@@ -50,6 +52,74 @@ public final class RegionFileStorage implements AutoCloseable {
@@ -81,6 +83,74 @@ public class RegionFileStorage implements AutoCloseable {
}
}
@ -204,7 +184,7 @@ index f33a5fc725d1d5e895f8878d82ebc4172237ad29..6d3e1bb20d1ab8ce5c9ea613322042d8
+ synchronized (regionfile) {
+ try (DataInputStream datainputstream = regionfile.getReadStream(chunkCoordinate)) {
+ CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z);
+ CompoundTag chunk = NbtIo.readNBT((DataInput) datainputstream);
+ CompoundTag chunk = NbtIo.read((DataInput) datainputstream);
+ if (oversizedData == null) {
+ return chunk;
+ }
@ -250,24 +230,24 @@ index f33a5fc725d1d5e895f8878d82ebc4172237ad29..6d3e1bb20d1ab8ce5c9ea613322042d8
@Nullable
public CompoundTag read(ChunkPos pos) throws IOException {
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
@@ -59,6 +129,12 @@ public final class RegionFileStorage implements AutoCloseable {
}
// CraftBukkit end
@@ -92,6 +162,12 @@ public class RegionFileStorage implements AutoCloseable {
try { // Paper
DataInputStream datainputstream = regionfile.getChunkDataInputStream(pos);
+ // Paper start
+ if (regionfile.isOversized(pos.x, pos.z)) {
+ printOversizedLog("Loading Oversized Chunk!", regionfile.file, pos.x, pos.z);
+ printOversizedLog("Loading Oversized Chunk!", regionfile.regionFile, pos.x, pos.z);
+ return readOversizedChunk(regionfile, pos);
+ }
+ // Paper end
Throwable throwable = null;
CompoundTag nbttagcompound;
@@ -99,6 +175,7 @@ public final class RegionFileStorage implements AutoCloseable {
label43:
{
@@ -143,6 +219,7 @@ public class RegionFileStorage implements AutoCloseable {
try {
NbtIo.write(tag, (DataOutput) dataoutputstream);
+ regionfile.setOversized(pos.x, pos.z, false); // Paper - We don't do this anymore, mojang stores differently, but clear old meta flag if it exists to get rid of our own meta file once last oversized is gone
} catch (Throwable throwable1) {
throwable = throwable1;
throw throwable1;
try {
NbtIo.write(nbt, (DataOutput) dataoutputstream);
+ regionfile.setOversized(pos.x, pos.z, false); // Paper - We don't do this anymore, mojang stores differently, but clear old meta flag if it exists to get rid of our own meta file once last oversized is gone
} catch (Throwable throwable) {
if (dataoutputstream != null) {
try {

Datei anzeigen

@ -172,20 +172,20 @@ index 2621739b8dd11860084ea574c243cb8ba167ac40..fc320450878279a6aa48019fbde35bb1
if (nbt != null) {
ChunkStatus chunkstatus = ChunkStatus.byName(nbt.getCompound("Level").getString("Status"));
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
index 357da4846344d1182ab7149c4d352d5019384715..832392cc2adc94e1fcb1055d91eb465529da1e92 100644
index 26ad58e7a73e63d2393eb277984be20472157539..3dae5a4d13118c232529d4d5af29bf7b76ac2a7c 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -23,6 +23,7 @@ import java.nio.file.StandardOpenOption;
import javax.annotation.Nullable;
import net.minecraft.Util;
@@ -27,6 +27,7 @@ import net.minecraft.Util;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtIo;
import net.minecraft.world.level.ChunkPos;
+import net.minecraft.world.level.chunk.ChunkStatus;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -49,6 +50,30 @@ public class RegionFile implements AutoCloseable {
protected final RegionBitmap usedSectors;
@@ -54,6 +55,30 @@ public class RegionFile implements AutoCloseable {
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper
public final File regionFile; // Paper
+ // Paper start - Cache chunk status
+ private final ChunkStatus[] statuses = new ChunkStatus[32 * 32];
@ -214,7 +214,7 @@ index 357da4846344d1182ab7149c4d352d5019384715..832392cc2adc94e1fcb1055d91eb4655
public RegionFile(File file, File directory, boolean dsync) throws IOException {
this(file.toPath(), directory.toPath(), RegionFileVersion.VERSION_DEFLATE, dsync);
}
@@ -395,6 +420,7 @@ public class RegionFile implements AutoCloseable {
@@ -402,6 +427,7 @@ public class RegionFile implements AutoCloseable {
return this.getOffset(pos) != 0;
}
@ -222,7 +222,7 @@ index 357da4846344d1182ab7149c4d352d5019384715..832392cc2adc94e1fcb1055d91eb4655
private static int getOffsetIndex(ChunkPos pos) {
return pos.getRegionLocalX() + pos.getRegionLocalZ() * 32;
}
@@ -405,6 +431,7 @@ public class RegionFile implements AutoCloseable {
@@ -412,6 +438,7 @@ public class RegionFile implements AutoCloseable {
synchronized (this) {
try {
// Paper end
@ -231,22 +231,17 @@ index 357da4846344d1182ab7149c4d352d5019384715..832392cc2adc94e1fcb1055d91eb4655
this.padToFullSector();
} finally {
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index ebb1a050beab9530942c4498335f084c89faef06..4ab881f0488af3577deda2f90a31a3f9243306dc 100644
index f53268f2d7d2d1909d64d06bb6a61086386830e1..e1b9051f8537db6f023cfdeaca4fb89305ece363 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -143,6 +143,7 @@ public class RegionFileStorage implements AutoCloseable {
@@ -219,6 +219,7 @@ public class RegionFileStorage implements AutoCloseable {
try {
NbtIo.write(nbt, (DataOutput) dataoutputstream);
+ regionfile.setStatus(pos.x, pos.z, ChunkSerializer.getStatus(nbt)); // Paper - cache status on disk
regionfile.setOversized(pos.x, pos.z, false); // Paper - We don't do this anymore, mojang stores differently, but clear old meta flag if it exists to get rid of our own meta file once last oversized is gone
} catch (Throwable throwable) {
if (dataoutputstream != null) {
try {
@@ -205,3 +206,4 @@ public class RegionFileStorage implements AutoCloseable {
}
}
+
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 98b2d054b6436e3fdb8fadd03369a65cf4156843..f9c58de7fa8b3c2ab5ac78cf0b366df69e0b40df 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java

Datei anzeigen

@ -33,14 +33,13 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA
It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index fbf3ccfb347a5ba6e895339e9576629d940d1aa4..38d25a12c6a52d8a83214e2a0f43a218cf15ceac 100644
index 8190c30346c0fd2d86fb7cbcfc7ce17333e05146..9860f5a0ddff83f1393ee13a96b38c3b14077512 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -401,4 +401,43 @@ public class PaperWorldConfig {
private void preventMovingIntoUnloadedChunks() {
@@ -402,6 +402,45 @@ public class PaperWorldConfig {
preventMovingIntoUnloadedChunks = getBoolean("prevent-moving-into-unloaded-chunks", false);
}
+
+ public enum DuplicateUUIDMode {
+ SAFE_REGEN, DELETE, NOTHING, WARN
+ }
@ -79,9 +78,12 @@ index fbf3ccfb347a5ba6e895339e9576629d940d1aa4..38d25a12c6a52d8a83214e2a0f43a218
+ break;
+ }
+ }
}
+
public boolean countAllMobsForSpawning = false;
private void countAllMobsForSpawning() {
countAllMobsForSpawning = getBoolean("count-all-mobs-for-spawning", false);
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 083db6c1899b5391231b6d5d5044a334212f148c..5d87a282042d7112415b7d7175031f734219f2c9 100644
index 6d69f15d90e9096f0ee6cb7259effa87622c787b..7345d92ccebf6ca4011e2845628e2cf29b462277 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1,6 +1,7 @@
@ -92,12 +94,12 @@ index 083db6c1899b5391231b6d5d5044a334212f148c..5d87a282042d7112415b7d7175031f73
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.ComparisonChain; // Paper
@@ -23,14 +24,17 @@ import it.unimi.dsi.fastutil.objects.ObjectIterator;
import java.io.File;
@@ -24,13 +25,17 @@ import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.util.BitSet;
+import java.util.HashMap; // Paper
import java.util.Collection;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.Map; // Paper
@ -109,45 +111,21 @@ index 083db6c1899b5391231b6d5d5044a334212f148c..5d87a282042d7112415b7d7175031f73
+import java.util.UUID; // Paper
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.Executor;
@@ -71,6 +75,7 @@ import net.minecraft.world.entity.ai.village.poi.PoiManager;
import net.minecraft.world.entity.boss.EnderDragonPart;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.GameRules;
+import net.minecraft.world.level.Level;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.chunk.ChunkStatus;
@@ -697,18 +702,18 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (chunk.needsDecoration) {
net.minecraft.server.dedicated.DedicatedServer server = this.level.getCraftServer().getServer();
if (!server.areNpcsEnabled() && entity instanceof net.minecraft.world.entity.npc.Npc) {
- entity.remove();
+ entity.removed = true; // Paper
needsRemoval = true;
}
if (!server.isSpawningAnimals() && (entity instanceof net.minecraft.world.entity.animal.Animal || entity instanceof net.minecraft.world.entity.animal.WaterAnimal)) {
- entity.remove();
+ entity.removed = true; // Paper
needsRemoval = true;
}
}
-
- if (!(entity instanceof net.minecraft.world.entity.player.Player) && (needsRemoval || !this.level.loadFromChunk(entity))) {
- // CraftBukkit end
+ // CraftBukkit end
+ checkDupeUUID(entity); // Paper
+ if (!(entity instanceof net.minecraft.world.entity.player.Player) && (entity.removed || !this.level.loadFromChunk(entity))) { // Paper
if (list == null) {
list = Lists.newArrayList(new Entity[]{entity});
} else {
@@ -735,6 +740,44 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
import java.util.concurrent.CompletionStage;
@@ -788,6 +793,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
entity.discard();
needsRemoval = true;
}
+ checkDupeUUID(worldserver, entity); // Paper
return !needsRemoval;
}));
// CraftBukkit end
@@ -837,6 +843,43 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
}
+ // Paper start
+ private void checkDupeUUID(Entity entity) {
+ private static void checkDupeUUID(ServerLevel level, Entity entity) {
+ PaperWorldConfig.DuplicateUUIDMode mode = level.paperConfig.duplicateUUIDMode;
+ if (mode != PaperWorldConfig.DuplicateUUIDMode.WARN
+ && mode != PaperWorldConfig.DuplicateUUIDMode.DELETE
@ -156,15 +134,15 @@ index 083db6c1899b5391231b6d5d5044a334212f148c..5d87a282042d7112415b7d7175031f73
+ }
+ Entity other = level.getEntity(entity.getUUID());
+
+ if (mode == PaperWorldConfig.DuplicateUUIDMode.SAFE_REGEN && other != null && !other.removed
+ && Objects.equals(other.getEncodeId(), entity.getEncodeId())
+ && entity.getBukkitEntity().getLocation().distance(other.getBukkitEntity().getLocation()) < level.paperConfig.duplicateUUIDDeleteRange
+ if (mode == PaperWorldConfig.DuplicateUUIDMode.SAFE_REGEN && other != null && !other.isRemoved()
+ && Objects.equals(other.getEncodeId(), entity.getEncodeId())
+ && entity.getBukkitEntity().getLocation().distance(other.getBukkitEntity().getLocation()) < level.paperConfig.duplicateUUIDDeleteRange
+ ) {
+ if (Level.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ entity.removed = true;
+ entity.discard();
+ return;
+ }
+ if (other != null && !other.removed) {
+ if (other != null && !other.isRemoved()) {
+ switch (mode) {
+ case SAFE_REGEN: {
+ entity.setUUID(UUID.randomUUID());
@ -173,7 +151,7 @@ index 083db6c1899b5391231b6d5d5044a334212f148c..5d87a282042d7112415b7d7175031f73
+ }
+ case DELETE: {
+ if (Level.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ entity.removed = true;
+ entity.discard();
+ break;
+ }
+ default:
@ -183,67 +161,68 @@ index 083db6c1899b5391231b6d5d5044a334212f148c..5d87a282042d7112415b7d7175031f73
+ }
+ }
+ // Paper end
+
public CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> postProcess(ChunkHolder holder) {
public CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> prepareTickingChunk(ChunkHolder holder) {
ChunkPos chunkcoordintpair = holder.getPos();
CompletableFuture<Either<List<ChunkAccess>, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkRangeFuture(chunkcoordintpair, 1, (i) -> {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 99883c83c126405fc93becefed8a1d0727b94aa7..20b74fc8e1273fcd07ea4417eaedc8bd9aba93b3 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -4,6 +4,8 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Iterables;
import co.aikar.timings.TimingHistory; // Paper
import co.aikar.timings.Timings; // Paper
+
+import com.destroystokyo.paper.PaperWorldConfig; // Paper
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Queues;
@@ -1102,7 +1104,22 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
if (entity1 == null) {
return false;
} else {
diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
index 390d841d34bb0ef67fe5b82199fbe268277a5f44..58de276b1ba709d466ca8e6bde42be4f3bdcf26c 100644
--- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
+++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
@@ -61,7 +61,21 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
private boolean addEntityUuid(T entity) {
if (!this.knownUuids.add(entity.getUUID())) {
+ // Paper start
+ if (entity1.removed) {
+ onEntityRemoved(entity1); // remove the existing entity
+ if (((Entity) entity).isRemoved()) {
+ stopTracking(entity); // remove the existing entity
+ return false;
+ }
+ // Paper end
ServerLevel.LOGGER.warn("Trying to add entity with duplicated UUID {}. Existing {}#{}, new: {}#{}", uuid, EntityType.getKey(entity1.getType()), entity1.getId(), EntityType.getKey(entity.getType()), entity.getId()); // CraftBukkit // Paper
LOGGER.warn("UUID of added entity already exists: {}", (Object)entity);
+ // Paper start
+ if (DEBUG_ENTITIES && entity.level.paperConfig.duplicateUUIDMode != PaperWorldConfig.DuplicateUUIDMode.NOTHING) {
+ if (entity1.addedToWorldStack != null) {
+ entity1.addedToWorldStack.printStackTrace();
+ if (net.minecraft.world.level.Level.DEBUG_ENTITIES && ((Entity) entity).level.paperConfig.duplicateUUIDMode != com.destroystokyo.paper.PaperWorldConfig.DuplicateUUIDMode.NOTHING) {
+ if (((Entity) entity).addedToWorldStack != null) {
+ ((Entity) entity).addedToWorldStack.printStackTrace();
+ }
+
+ getAddToWorldStackTrace(entity).printStackTrace();
+ net.minecraft.server.level.ServerLevel.getAddToWorldStackTrace((net.minecraft.world.entity.Entity) entity).printStackTrace();
+ }
+ // Paper end
return false;
} else {
return true;
}
@@ -238,7 +252,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 6faac8773136412ca129dfa884178f311e197f6e..af86c370c6f834514115a8e40659f5e1aaabec75 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2803,6 +2803,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
private void processUnloads() {
- this.chunksToUnload.removeIf((pos) -> {
+ this.chunksToUnload.removeIf((java.util.function.LongPredicate) (pos) -> { // Paper - decompile fix
return this.chunkVisibility.get(pos) != Visibility.HIDDEN ? true : this.processChunkUnload(pos);
});
}
@@ -272,7 +286,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
+ public final void setUUID(UUID uuid) { setUUID(uuid); } // Paper - OBFHELPER
public void setUUID(UUID uuid) {
this.uuid = uuid;
this.stringUUID = this.uuid.toString();
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index db28bfe95c885cdefa855c7aaa3bcf92bc52df26..55872a17060a35b727a597bc414fecec3ada3515 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -541,6 +541,7 @@ public class LevelChunk implements ChunkAccess {
if (i != this.chunkPos.x || j != this.chunkPos.z) {
LevelChunk.LOGGER.warn("Wrong location! ({}, {}) should be ({}, {}), {}", i, j, this.chunkPos.x, this.chunkPos.z, entity);
entity.removed = true;
+ return; // Paper
}
public void autoSave() {
- this.getAllChunksToSave().forEach((pos) -> {
+ this.getAllChunksToSave().forEach((java.util.function.LongConsumer) (pos) -> { // Paper - decompile fix
boolean bl = this.chunkVisibility.get(pos) == Visibility.HIDDEN;
if (bl) {
this.processChunkUnload(pos);
@@ -290,7 +304,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
while(!longSet.isEmpty()) {
this.permanentStorage.flush();
this.processPendingLoads();
- longSet.removeIf((pos) -> {
+ longSet.removeIf((java.util.function.LongPredicate) (pos) -> { // Paper - decompile fix
boolean bl = this.chunkVisibility.get(pos) == Visibility.HIDDEN;
return bl ? this.processChunkUnload(pos) : this.storeChunkSections(pos, (entityAccess) -> {
});
@@ -327,7 +341,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
int k = Mth.floor(entity.getY() / 16.0D);
public void dumpSections(Writer writer) throws IOException {
CsvOutput csvOutput = CsvOutput.builder().addColumn("x").addColumn("y").addColumn("z").addColumn("visibility").addColumn("load_status").addColumn("entity_count").build(writer);
- this.sectionStorage.getAllChunksWithExistingSections().forEach((chunkPos) -> {
+ this.sectionStorage.getAllChunksWithExistingSections().forEach((java.util.function.LongConsumer) (chunkPos) -> { // Paper - decompile fix
PersistentEntitySectionManager.ChunkLoadStatus chunkLoadStatus = this.chunkLoadStatuses.get(chunkPos);
this.sectionStorage.getExistingSectionPositionsInChunk(chunkPos).forEach((sectionPos) -> {
EntitySection<T> entitySection = this.sectionStorage.getSection(sectionPos);

Datei anzeigen

@ -13,10 +13,10 @@ Subject: [PATCH] Optimize Hoppers
* Remove Streams from Item Suck In and restore restore 1.12 AABB checks which is simpler and no voxel allocations (was doing TWO Item Suck ins)
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 8190c30346c0fd2d86fb7cbcfc7ce17333e05146..041efecbfcd54384d15ebf771cdfa0e711483997 100644
index 9860f5a0ddff83f1393ee13a96b38c3b14077512..bf704993d0abd50dba91682a7fbb575e3696be62 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -431,5 +431,14 @@ public class PaperWorldConfig {
@@ -470,5 +470,14 @@ public class PaperWorldConfig {
private void entitiesTargetWithFollowRange() {
entitiesTargetWithFollowRange = getBoolean("entities-target-with-follow-range", entitiesTargetWithFollowRange);
}

Datei anzeigen

@ -14,10 +14,10 @@ light engine on shutdown...
The queue size only puts a cap on max loss, doesn't solve that problem.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 041efecbfcd54384d15ebf771cdfa0e711483997..e29566cad2647da4d9288e912188b57f00e8dd0c 100644
index bf704993d0abd50dba91682a7fbb575e3696be62..a91a7d8f56a068b18d50a8b987b71510b0a19d5b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -440,5 +440,10 @@ public class PaperWorldConfig {
@@ -479,5 +479,10 @@ public class PaperWorldConfig {
disableHopperMoveEvents = getBoolean("hopper.disable-move-event", disableHopperMoveEvents);
log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled"));
}

Datei anzeigen

@ -134,10 +134,10 @@ index 71ffa66973d8994e2a480435ac1ada3fe61600a4..7b5afc5d34b78e6404c1a5c6bb823d95
+ }
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 6d69f15d90e9096f0ee6cb7259effa87622c787b..fe0fd4e590f7ceb47467c692c81e2b3579596f4e 100644
index 7345d92ccebf6ca4011e2845628e2cf29b462277..d11c04ddd2bb40f1d0bbc98da8eb43a9f7b57f63 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -123,6 +123,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -128,6 +128,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private final ChunkTaskPriorityQueueSorter queueSorter;
private final ProcessorHandle<ChunkTaskPriorityQueueSorter.Message<Runnable>> worldgenMailbox;
private final ProcessorHandle<ChunkTaskPriorityQueueSorter.Message<Runnable>> mainThreadMailbox;
@ -150,7 +150,7 @@ index 6d69f15d90e9096f0ee6cb7259effa87622c787b..fe0fd4e590f7ceb47467c692c81e2b35
public final ChunkProgressListener progressListener;
private final ChunkStatusUpdateListener chunkStatusListener;
public final ChunkMap.ChunkDistanceManager distanceManager;
@@ -199,11 +205,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -204,11 +210,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.progressListener = worldGenerationProgressListener;
this.chunkStatusListener = chunkStatusChangeListener;

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Anti-Xray
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index e29566cad2647da4d9288e912188b57f00e8dd0c..edb9952ddd014c92b9604a9a187fdcd46de8a04f 100644
index a91a7d8f56a068b18d50a8b987b71510b0a19d5b..c1bf19629cca9a6b616a63ae7a919827ec839c12 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -1,7 +1,9 @@
@ -18,7 +18,7 @@ index e29566cad2647da4d9288e912188b57f00e8dd0c..edb9952ddd014c92b9604a9a187fdcd4
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.spigotmc.SpigotWorldConfig;
@@ -445,5 +447,41 @@ public class PaperWorldConfig {
@@ -484,5 +486,41 @@ public class PaperWorldConfig {
private void lightQueueSize() {
lightQueueSize = getInt("light-queue-size", lightQueueSize);
}
@ -1105,10 +1105,10 @@ index c28879f32b004f36ff746ea2274f91ddd9501e71..7762d8ff94f856d613a6f50311006b69
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index fe0fd4e590f7ceb47467c692c81e2b3579596f4e..3a16316a8ecd658b2fbd473fa6ff14abe18e00de 100644
index d11c04ddd2bb40f1d0bbc98da8eb43a9f7b57f63..2e08fc8f9d139609e063f4c7d8f3f2bf440abf0d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1444,7 +1444,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1487,7 +1487,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public void playerLoadedChunk(ServerPlayer player, Packet<?>[] packets, LevelChunk chunk) {
if (packets[0] == null) {

Datei anzeigen

@ -23,10 +23,10 @@ index f27fadc15cb7f5c782e45885ec6a5a69963beade..2ff4d4921e2076abf415bd3c8f5173ec
}));
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index edb9952ddd014c92b9604a9a187fdcd46de8a04f..3e3097f23f775eec4107f5c2f3f2266f4250ba15 100644
index c1bf19629cca9a6b616a63ae7a919827ec839c12..ab39c75da393f639b8b6f20bbcb00b4f6513d702 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -448,6 +448,11 @@ public class PaperWorldConfig {
@@ -487,6 +487,11 @@ public class PaperWorldConfig {
lightQueueSize = getInt("light-queue-size", lightQueueSize);
}
@ -145,10 +145,10 @@ index 2aa86f35b8960273ad91b21e260bcf91cf861e08..8fff5580a88fd1643845967eb7bdab26
public CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getOrScheduleFuture(ChunkStatus targetStatus, ChunkMap chunkStorage) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 3a16316a8ecd658b2fbd473fa6ff14abe18e00de..91930daa3c965dcc1cb50ae260c159be55f351ed 100644
index 2e08fc8f9d139609e063f4c7d8f3f2bf440abf0d..63608698747abc8577fe2bd6746e779122377895 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -122,7 +122,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -127,7 +127,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private boolean modified;
private final ChunkTaskPriorityQueueSorter queueSorter;
private final ProcessorHandle<ChunkTaskPriorityQueueSorter.Message<Runnable>> worldgenMailbox;
@ -157,7 +157,7 @@ index 3a16316a8ecd658b2fbd473fa6ff14abe18e00de..91930daa3c965dcc1cb50ae260c159be
// Paper start
final ProcessorHandle<ChunkTaskPriorityQueueSorter.Message<Runnable>> mailboxLight;
public void addLightTask(ChunkHolder playerchunk, Runnable run) {
@@ -164,21 +164,68 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -169,21 +169,68 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper start - distance maps
private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
@ -226,7 +226,7 @@ index 3a16316a8ecd658b2fbd473fa6ff14abe18e00de..91930daa3c965dcc1cb50ae260c159be
}
// Paper end
@@ -216,6 +263,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -221,6 +268,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.overworldDataStorage = persistentStateManagerFactory;
this.poiManager = new PoiManager(new File(this.storageFolder, "poi"), dataFixer, dsync, world);
this.setViewDistance(viewDistance);
@ -272,7 +272,7 @@ index 3a16316a8ecd658b2fbd473fa6ff14abe18e00de..91930daa3c965dcc1cb50ae260c159be
}
private static double euclideanDistanceSquared(ChunkPos pos, Entity entity) {
@@ -863,14 +949,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -906,14 +992,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
completablefuture1.thenAcceptAsync((either) -> {
either.ifLeft((chunk) -> {
this.tickingGenerated.getAndIncrement();
@ -289,7 +289,7 @@ index 3a16316a8ecd658b2fbd473fa6ff14abe18e00de..91930daa3c965dcc1cb50ae260c159be
});
return completablefuture1;
}
@@ -963,27 +1045,34 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1006,27 +1088,34 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public void setViewDistance(int watchDistance) {
@ -337,7 +337,7 @@ index 3a16316a8ecd658b2fbd473fa6ff14abe18e00de..91930daa3c965dcc1cb50ae260c159be
}
}
@@ -995,7 +1084,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1038,7 +1127,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos.toLong());
if (playerchunk != null) {
@ -346,7 +346,7 @@ index 3a16316a8ecd658b2fbd473fa6ff14abe18e00de..91930daa3c965dcc1cb50ae260c159be
if (chunk != null) {
this.playerLoadedChunk(player, packets, chunk);
@@ -1091,7 +1180,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1134,7 +1223,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end
@Nullable
@ -355,7 +355,7 @@ index 3a16316a8ecd658b2fbd473fa6ff14abe18e00de..91930daa3c965dcc1cb50ae260c159be
CompoundTag nbttagcompound = this.read(pos);
// Paper start - Cache chunk status on disk
if (nbttagcompound == null) {
@@ -1202,13 +1291,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1245,13 +1334,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.removePlayerFromDistanceMaps(player); // Paper - distance maps
}
@ -370,7 +370,7 @@ index 3a16316a8ecd658b2fbd473fa6ff14abe18e00de..91930daa3c965dcc1cb50ae260c159be
}
@@ -1216,7 +1299,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1259,7 +1342,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
SectionPos sectionposition = SectionPos.of((Entity) player);
player.setLastSectionPos(sectionposition);
@ -379,7 +379,7 @@ index 3a16316a8ecd658b2fbd473fa6ff14abe18e00de..91930daa3c965dcc1cb50ae260c159be
return sectionposition;
}
@@ -1271,6 +1354,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1314,6 +1397,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
int k1;
int l1;
@ -387,7 +387,7 @@ index 3a16316a8ecd658b2fbd473fa6ff14abe18e00de..91930daa3c965dcc1cb50ae260c159be
if (Math.abs(i1 - i) <= this.viewDistance * 2 && Math.abs(j1 - j) <= this.viewDistance * 2) {
k1 = Math.min(i, i1) - this.viewDistance;
l1 = Math.min(j, j1) - this.viewDistance;
@@ -1309,6 +1393,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1352,6 +1436,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
}
}
@ -395,19 +395,20 @@ index 3a16316a8ecd658b2fbd473fa6ff14abe18e00de..91930daa3c965dcc1cb50ae260c159be
this.updateMaps(player); // Paper - distance maps
@@ -1316,11 +1401,46 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1359,11 +1444,46 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@Override
public Stream<ServerPlayer> getPlayers(ChunkPos chunkPos, boolean onlyOnWatchDistanceEdge) {
- return this.playerMap.getPlayers(chunkPos.toLong()).filter((entityplayer) -> {
- int i = ChunkMap.checkerboardDistance(chunkPos, entityplayer, true);
-
- return i > this.viewDistance ? false : !onlyOnWatchDistanceEdge || i == this.viewDistance;
- });
+ // Paper start - per player view distance
+ // there can be potential desync with player's last mapped section and the view distance map, so use the
+ // view distance map here.
+ com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> inRange = this.playerViewDistanceBroadcastMap.getObjectsInRange(chunkPos);
- return i > this.viewDistance ? false : !onlyOnWatchDistanceEdge || i == this.viewDistance;
- });
+
+ if (inRange == null) {
+ return Stream.empty();
+ }
@ -446,7 +447,7 @@ index 3a16316a8ecd658b2fbd473fa6ff14abe18e00de..91930daa3c965dcc1cb50ae260c159be
}
public void addEntity(Entity entity) {
@@ -1442,6 +1562,47 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1485,6 +1605,47 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Implement alternative item-despawn-rate
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 3e3097f23f775eec4107f5c2f3f2266f4250ba15..1a21a177e3062130d7bbcde53e49732c634db73d 100644
index ab39c75da393f639b8b6f20bbcb00b4f6513d702..9ab9645f8dbda50912fd6b6d6c661ca7bdff88bd 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -453,6 +453,54 @@ public class PaperWorldConfig {
@@ -492,6 +492,54 @@ public class PaperWorldConfig {
this.noTickViewDistance = this.getInt("viewdistances.no-tick-view-distance", -1);
}

Datei anzeigen

@ -8,10 +8,10 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code
Also ignores Enderdragon, defaulting it to Mojang's setting
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 91930daa3c965dcc1cb50ae260c159be55f351ed..38c0437b0676e3f5f4bbc96c1f3a42712794ba5f 100644
index 63608698747abc8577fe2bd6746e779122377895..0cbb735f1b4753f373eaadf57476c0b522a5cfc7 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1791,6 +1791,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
@@ -1834,6 +1834,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
int j = entity.getType().clientTrackingRange() * 16;

Datei anzeigen

@ -25,10 +25,10 @@ index fe79c0add4f7cb18d487c5bb9415c40c5b551ea2..8d9ddad1879e7616d980ca70de8aecac
poiUnload = Timings.ofSafe(name + "Chunk unload - POI");
chunkUnload = Timings.ofSafe(name + "Chunk unload - Chunk");
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 1a21a177e3062130d7bbcde53e49732c634db73d..154866506a33cf2185891cd5051d51de9e2e4584 100644
index 9ab9645f8dbda50912fd6b6d6c661ca7bdff88bd..b6d680d6d6762125db180638ee43bf9ece4dc51a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -536,5 +536,10 @@ public class PaperWorldConfig {
@@ -575,5 +575,10 @@ public class PaperWorldConfig {
Bukkit.getLogger().warning("You have enabled permission-based Anti-Xray checking - depending on your permission plugin, this may cause performance issues");
}
}
@ -545,10 +545,10 @@ index 0000000000000000000000000000000000000000..11de56afaf059b00fa5bec293516bcdc
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 38c0437b0676e3f5f4bbc96c1f3a42712794ba5f..ebcfe31c8395aa2bbcc9a9ac74d4c6e1f2e5d0f7 100644
index 0cbb735f1b4753f373eaadf57476c0b522a5cfc7..e10ded850c770a6aaa5321693525296ee77bb7e0 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -140,6 +140,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -145,6 +145,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private final Long2ByteMap chunkTypeCache;
private final Queue<Runnable> unloadQueue;
int viewDistance;
@ -556,7 +556,7 @@ index 38c0437b0676e3f5f4bbc96c1f3a42712794ba5f..ebcfe31c8395aa2bbcc9a9ac74d4c6e1
// CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
public final CallbackExecutor callbackExecutor = new CallbackExecutor();
@@ -263,6 +264,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -268,6 +269,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.overworldDataStorage = persistentStateManagerFactory;
this.poiManager = new PoiManager(new File(this.storageFolder, "poi"), dataFixer, dsync, world);
this.setViewDistance(viewDistance);
@ -564,7 +564,7 @@ index 38c0437b0676e3f5f4bbc96c1f3a42712794ba5f..ebcfe31c8395aa2bbcc9a9ac74d4c6e1
// Paper start - no-tick view distance
this.setNoTickViewDistance(this.level.paperConfig.noTickViewDistance);
this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets,
@@ -304,6 +306,25 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -309,6 +311,25 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end - no-tick view distance
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add option to nerf pigmen from nether portals
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 154866506a33cf2185891cd5051d51de9e2e4584..5ce5cdb4f6c703fa93f808527d2bca706d748c70 100644
index b6d680d6d6762125db180638ee43bf9ece4dc51a..c9b5f662b94e47a25949449af8ce42edc78917b1 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -443,6 +443,11 @@ public class PaperWorldConfig {
@@ -482,6 +482,11 @@ public class PaperWorldConfig {
log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled"));
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add option to allow iron golems to spawn in air
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 5ce5cdb4f6c703fa93f808527d2bca706d748c70..fc1c65a4b3c3d5e52d967a3174d8373ddde95e4d 100644
index c9b5f662b94e47a25949449af8ce42edc78917b1..12a2a05b400e314f48b234e160b27f5a883c2c0e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -382,6 +382,11 @@ public class PaperWorldConfig {

Datei anzeigen

@ -8,10 +8,10 @@ This allows you to solve an issue in vanilla behavior where:
* On normal difficulty they will have a 50% of getting infected or dying.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index fc1c65a4b3c3d5e52d967a3174d8373ddde95e4d..0c9aa7fb4d42c63c920a002050941299e3847d95 100644
index 12a2a05b400e314f48b234e160b27f5a883c2c0e..c5c866c97c22008c3ea2c2f2b125b367072af92d 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -453,6 +453,11 @@ public class PaperWorldConfig {
@@ -492,6 +492,11 @@ public class PaperWorldConfig {
nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen);
}

Datei anzeigen

@ -10,10 +10,10 @@ When not per player it will use the Vanilla mechanic of one delay per
world and the world age for the start day.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0c9aa7fb4d42c63c920a002050941299e3847d95..11a8b71fb3c7ba24f6e4986d241328ad369407c4 100644
index c5c866c97c22008c3ea2c2f2b125b367072af92d..c26f08f6fd53cd44e5679f19bd3fdaa04f60a437 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -430,10 +430,21 @@ public class PaperWorldConfig {
@@ -469,10 +469,21 @@ public class PaperWorldConfig {
}
public boolean disablePillagerPatrols = false;

Datei anzeigen

@ -7,10 +7,10 @@ Suspected case would be around the technique used in .stopRiding
Stack will identify any causer of this and warn instead of crashing.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index ebcfe31c8395aa2bbcc9a9ac74d4c6e1f2e5d0f7..46976a0ef5098e6d794653078111a9dcc1a151d2 100644
index e10ded850c770a6aaa5321693525296ee77bb7e0..aa671a25e458ab2f382b37fc1517c98ab99949fb 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1466,6 +1466,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1509,6 +1509,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public void addEntity(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot

Datei anzeigen

@ -70,10 +70,10 @@ index 9c88426ab1275ee5fb6e28be8b213533dc4ab859..87c9a5c1b43f6010898d72136b5eb997
List<ChunkHolder> allChunks = new ArrayList<>(visibleChunks.values());
List<ServerPlayer> players = world.players;
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 46976a0ef5098e6d794653078111a9dcc1a151d2..1e366262306aedcd4b3236a6895d30fb35e3cc51 100644
index aa671a25e458ab2f382b37fc1517c98ab99949fb..fbb58957c925fbefa623f7cf9856f2c427bd006d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -107,9 +107,36 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -112,9 +112,36 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private static final int MIN_VIEW_DISTANCE = 3;
public static final int MAX_VIEW_DISTANCE = 33;
public static final int MAX_CHUNK_DISTANCE = 33 + ChunkStatus.maxDistance();
@ -112,7 +112,7 @@ index 46976a0ef5098e6d794653078111a9dcc1a151d2..1e366262306aedcd4b3236a6895d30fb
private final Long2ObjectLinkedOpenHashMap<ChunkHolder> pendingUnloads;
public final LongSet entitiesInLevel;
public final ServerLevel level;
@@ -232,7 +259,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -237,7 +264,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) {
super(new File(session.getDimensionPath(world.dimension()), "region"), dataFixer, dsync);
@ -121,7 +121,7 @@ index 46976a0ef5098e6d794653078111a9dcc1a151d2..1e366262306aedcd4b3236a6895d30fb
this.pendingUnloads = new Long2ObjectLinkedOpenHashMap();
this.entitiesInLevel = new LongOpenHashSet();
this.toDrop = new LongOpenHashSet();
@@ -371,9 +398,52 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -376,9 +403,52 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return (ChunkHolder) this.updatingChunkMap.get(pos);
}
@ -175,7 +175,7 @@ index 46976a0ef5098e6d794653078111a9dcc1a151d2..1e366262306aedcd4b3236a6895d30fb
}
protected IntSupplier getChunkQueueLevel(long pos) {
@@ -530,8 +600,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -535,8 +605,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected void saveAllChunks(boolean flush) {
@ -186,7 +186,7 @@ index 46976a0ef5098e6d794653078111a9dcc1a151d2..1e366262306aedcd4b3236a6895d30fb
MutableBoolean mutableboolean = new MutableBoolean();
do {
@@ -562,7 +633,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -567,7 +638,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// this.i(); // Paper - nuke IOWorker
ChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.storageFolder.getName());
} else {
@ -195,7 +195,7 @@ index 46976a0ef5098e6d794653078111a9dcc1a151d2..1e366262306aedcd4b3236a6895d30fb
ChunkAccess ichunkaccess = (ChunkAccess) playerchunk.getChunkToSave().getNow(null); // CraftBukkit - decompile error
if (ichunkaccess instanceof ImposterProtoChunk || ichunkaccess instanceof LevelChunk) {
@@ -722,7 +793,20 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -727,7 +798,20 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!this.modified) {
return false;
} else {
@ -217,7 +217,7 @@ index 46976a0ef5098e6d794653078111a9dcc1a151d2..1e366262306aedcd4b3236a6895d30fb
this.modified = false;
return true;
}
@@ -1131,12 +1215,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1174,12 +1258,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected Iterable<ChunkHolder> getChunks() {

Datei anzeigen

@ -262,10 +262,10 @@ index 0511f1921193b78cbf4d8426136bf1f79746f955..e5f7f043cbdb28d85b8aa0eea7cbaeb5
@Override
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 1e366262306aedcd4b3236a6895d30fb35e3cc51..196c0722c15b169cecde139ddd75689298c80949 100644
index fbb58957c925fbefa623f7cf9856f2c427bd006d..719671e363af86023faae1e41bd5cacdea235908 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -606,6 +606,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -611,6 +611,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
MutableBoolean mutableboolean = new MutableBoolean();
do {

Datei anzeigen

@ -25,10 +25,10 @@ This successfully fixed a reoccurring and highly reproduceable crash
for heightmaps.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 196c0722c15b169cecde139ddd75689298c80949..874b7d4947d452c64b7a2f37c3091ba7aed18c4d 100644
index 719671e363af86023faae1e41bd5cacdea235908..c133b7784aa0ed496c08c6a4bb252e36faf173cb 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -190,6 +190,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -195,6 +195,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
};
// CraftBukkit end
@ -36,7 +36,7 @@ index 196c0722c15b169cecde139ddd75689298c80949..874b7d4947d452c64b7a2f37c3091ba7
// Paper start - distance maps
private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
// Paper start - no-tick view distance
@@ -1049,7 +1050,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1092,7 +1093,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return Either.left(chunk);
});
}, (runnable) -> {

Datei anzeigen

@ -28,10 +28,10 @@ receives a deterministic result, and should no longer require 1 tick
delays anymore.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 874b7d4947d452c64b7a2f37c3091ba7aed18c4d..b64a3dd03a22542b070eae34f0eaa9b321dca4ec 100644
index c133b7784aa0ed496c08c6a4bb252e36faf173cb..333c41812159df37c27b632686c836e6cd62885e 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1559,6 +1559,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1602,6 +1602,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
.printStackTrace();
return;
}

Datei anzeigen

@ -14,10 +14,10 @@ Use an ArrayDeque to store this Queue
We make sure to also implement a pattern that is recursion safe too.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index b64a3dd03a22542b070eae34f0eaa9b321dca4ec..218a20e85c9b6d31bcdf5432f4ea9cf0c0d7b952 100644
index 333c41812159df37c27b632686c836e6cd62885e..8c83a5ba2be36a113c3a7a694b075ac8bc070bd5 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -173,17 +173,29 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -178,17 +178,29 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public final CallbackExecutor callbackExecutor = new CallbackExecutor();
public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add phantom creative and insomniac controls
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 11a8b71fb3c7ba24f6e4986d241328ad369407c4..5fd9490f57109235d5eae0c0d51831646ee6cdc5 100644
index c26f08f6fd53cd44e5679f19bd3fdaa04f60a437..4acfd9aa46aed545591a46afe3fa162bf710d5c9 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -474,6 +474,13 @@ public class PaperWorldConfig {
@@ -513,6 +513,13 @@ public class PaperWorldConfig {
lightQueueSize = getInt("light-queue-size", lightQueueSize);
}

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen