Make Anti-Xray multithreaded (#3520)

Obfuscate multiple chunks at a time over the server thread pool.

Will speed up chunk processing when anti xray is enabled.

Co-authored-by: Aikar <aikar@aikar.co>
This commit is contained in:
stonar96 2020-06-09 10:12:20 +02:00 committed by GitHub
parent 531c4b3fd1
commit de6dfedfef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 100 additions and 93 deletions

View File

@ -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 48676152152faf7a7b9524ac37d8b4a8c32c4e2c..ca2ac17747d4f2acf1df056759c5c182be050125 100644
index 48676152152faf7a7b9524ac37d8b4a8c32c4e2c..f7c7c2871726e3a1673a693b9bd93910a28189b2 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -1,7 +1,9 @@
@ -18,13 +18,12 @@ index 48676152152faf7a7b9524ac37d8b4a8c32c4e2c..ca2ac17747d4f2acf1df056759c5c182
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.spigotmc.SpigotWorldConfig;
@@ -502,4 +504,33 @@ public class PaperWorldConfig {
@@ -502,4 +504,31 @@ public class PaperWorldConfig {
private void maxAutoSaveChunksPerTick() {
maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24);
}
+
+ public boolean antiXray;
+ public boolean asynchronous;
+ public EngineMode engineMode;
+ public int maxChunkSectionIndex;
+ public int updateRadius;
@ -32,7 +31,6 @@ index 48676152152faf7a7b9524ac37d8b4a8c32c4e2c..ca2ac17747d4f2acf1df056759c5c182
+ public List<String> replacementBlocks;
+ private void antiXray() {
+ antiXray = getBoolean("anti-xray.enabled", false);
+ asynchronous = true;
+ engineMode = EngineMode.getById(getInt("anti-xray.engine-mode", EngineMode.HIDE.getId()));
+ engineMode = engineMode == null ? EngineMode.HIDE : engineMode;
+ maxChunkSectionIndex = getInt("anti-xray.max-chunk-section-index", 3);
@ -100,18 +98,17 @@ index 0000000000000000000000000000000000000000..df7e4183d8842f5be8ae9d0698f8fa90
+}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
new file mode 100644
index 0000000000000000000000000000000000000000..9c017eb027ce52ea6a2414af2d0190b3bd52522c
index 0000000000000000000000000000000000000000..4ecd180fa84376319ef78bf9b21bf669b22ff817
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
@@ -0,0 +1,628 @@
@@ -0,0 +1,620 @@
+package com.destroystokyo.paper.antixray;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Executor;
+
+import net.minecraft.server.*;
+import org.bukkit.Bukkit;
@ -121,9 +118,7 @@ index 0000000000000000000000000000000000000000..9c017eb027ce52ea6a2414af2d0190b3
+
+public final class ChunkPacketBlockControllerAntiXray extends ChunkPacketBlockController {
+
+ private static ExecutorService executorServiceInstance = null;
+ private final ExecutorService executorService;
+ private final boolean asynchronous;
+ private final Executor executor;
+ private final EngineMode engineMode;
+ private final int maxChunkSectionIndex;
+ private final int updateRadius;
@ -140,17 +135,12 @@ index 0000000000000000000000000000000000000000..9c017eb027ce52ea6a2414af2d0190b3
+ private final ChunkSection[] emptyNearbyChunkSections = {Chunk.EMPTY_CHUNK_SECTION, Chunk.EMPTY_CHUNK_SECTION, Chunk.EMPTY_CHUNK_SECTION, Chunk.EMPTY_CHUNK_SECTION};
+ private final int maxBlockYUpdatePosition;
+
+ public ChunkPacketBlockControllerAntiXray(PaperWorldConfig paperWorldConfig) {
+ asynchronous = paperWorldConfig.asynchronous;
+ public ChunkPacketBlockControllerAntiXray(PaperWorldConfig paperWorldConfig, Executor executor) {
+ engineMode = paperWorldConfig.engineMode;
+ maxChunkSectionIndex = paperWorldConfig.maxChunkSectionIndex;
+ updateRadius = paperWorldConfig.updateRadius;
+
+ if (asynchronous) {
+ executorService = getExecutorServiceInstance();
+ } else {
+ executorService = null;
+ }
+ this.executor = executor;
+
+ List<String> toObfuscate;
+
@ -216,12 +206,8 @@ index 0000000000000000000000000000000000000000..9c017eb027ce52ea6a2414af2d0190b3
+ this.maxBlockYUpdatePosition = (maxChunkSectionIndex + 1) * 16 + updateRadius - 1;
+ }
+
+ private static ExecutorService getExecutorServiceInstance() {
+ if (executorServiceInstance == null) {
+ executorServiceInstance = Executors.newSingleThreadExecutor();
+ }
+
+ return executorServiceInstance;
+ private int getPredefinedBlockDataLength() {
+ return engineMode == EngineMode.HIDE ? 1 : predefinedBlockData.length;
+ }
+
+ @Override
@ -274,26 +260,30 @@ index 0000000000000000000000000000000000000000..9c017eb027ce52ea6a2414af2d0190b3
+ (Chunk) world.getChunkIfLoadedImmediately(x, z - 1),
+ (Chunk) world.getChunkIfLoadedImmediately(x, z + 1));
+
+ if (asynchronous) {
+ executorService.submit((ChunkPacketInfoAntiXray) chunkPacketInfo);
+ } else {
+ obfuscate((ChunkPacketInfoAntiXray) chunkPacketInfo);
+ }
+ executor.execute((ChunkPacketInfoAntiXray) chunkPacketInfo);
+ }
+
+ // Actually these fields should be variables inside the obfuscate method but in sync mode or with SingleThreadExecutor in async mode it's okay
+ private int[] predefinedBlockDataBits;
+ private final boolean[] solid = new boolean[Block.REGISTRY_ID.size()];
+ private final boolean[] obfuscate = new boolean[Block.REGISTRY_ID.size()];
+ // Actually these fields should be variables inside the obfuscate method but in sync mode or with SingleThreadExecutor in async mode it's okay (even without ThreadLocal)
+ // If an ExecutorService with multiple threads is used, ThreadLocal must be used here
+ private final ThreadLocal<int[]> predefinedBlockDataBits = ThreadLocal.withInitial(() -> new int[getPredefinedBlockDataLength()]);
+ private static final ThreadLocal<boolean[]> solid = ThreadLocal.withInitial(() -> new boolean[Block.REGISTRY_ID.size()]);
+ private static final ThreadLocal<boolean[]> obfuscate = ThreadLocal.withInitial(() -> new boolean[Block.REGISTRY_ID.size()]);
+ // These boolean arrays represent chunk layers, true means don't obfuscate, false means obfuscate
+ private boolean[][] current = new boolean[16][16];
+ private boolean[][] next = new boolean[16][16];
+ private boolean[][] nextNext = new boolean[16][16];
+ private final DataBitsReader dataBitsReader = new DataBitsReader();
+ private final DataBitsWriter dataBitsWriter = new DataBitsWriter();
+ private final ChunkSection[] nearbyChunkSections = new ChunkSection[4];
+ private static final ThreadLocal<boolean[][]> current = ThreadLocal.withInitial(() -> new boolean[16][16]);
+ private static final ThreadLocal<boolean[][]> next = ThreadLocal.withInitial(() -> new boolean[16][16]);
+ private static final ThreadLocal<boolean[][]> nextNext = ThreadLocal.withInitial(() -> new boolean[16][16]);
+
+ public void obfuscate(ChunkPacketInfoAntiXray chunkPacketInfoAntiXray) {
+ int[] predefinedBlockDataBits = this.predefinedBlockDataBits.get();
+ boolean[] solid = this.solid.get();
+ boolean[] obfuscate = this.obfuscate.get();
+ boolean[][] current = this.current.get();
+ boolean[][] next = this.next.get();
+ boolean[][] nextNext = this.nextNext.get();
+ // dataBitsReader, dataBitsWriter and nearbyChunkSections could also be reused (with ThreadLocal if necessary) but it's not worth it
+ DataBitsReader dataBitsReader = new DataBitsReader();
+ DataBitsWriter dataBitsWriter = new DataBitsWriter();
+ ChunkSection[] nearbyChunkSections = new ChunkSection[4];
+ boolean[] solidTemp = null;
+ boolean[] obfuscateTemp = null;
+ dataBitsReader.setDataBits(chunkPacketInfoAntiXray.getData());
@ -307,7 +297,7 @@ index 0000000000000000000000000000000000000000..9c017eb027ce52ea6a2414af2d0190b3
+ if (chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex) == ChunkSection.GLOBAL_PALETTE) {
+ predefinedBlockDataBitsTemp = engineMode == EngineMode.HIDE ? chunkPacketInfoAntiXray.getChunk().world.getWorld().getEnvironment() == Environment.NETHER ? predefinedBlockDataBitsNetherrackGlobal : chunkPacketInfoAntiXray.getChunk().world.getWorld().getEnvironment() == Environment.THE_END ? predefinedBlockDataBitsEndStoneGlobal : predefinedBlockDataBitsStoneGlobal : predefinedBlockDataBitsGlobal;
+ } else {
+ predefinedBlockDataBitsTemp = predefinedBlockDataBits == null ? predefinedBlockDataBits = engineMode == EngineMode.HIDE ? new int[1] : new int[predefinedBlockData.length] : predefinedBlockDataBits;
+ predefinedBlockDataBitsTemp = predefinedBlockDataBits;
+
+ for (int i = 0; i < predefinedBlockDataBitsTemp.length; i++) {
+ predefinedBlockDataBitsTemp[i] = chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex).getOrCreateIdFor(chunkPacketInfoAntiXray.getPredefinedObjects(chunkSectionIndex)[i]);
@ -1392,7 +1382,7 @@ index b740e82622e282bdf543a84a559af69dd5b8568c..6db6e74886943559e3582c350ffae548
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 69db339c29c8f06026f05b0b5bb8019099af3fdf..4608d5f50d3c572f56bcc20dae2d537a07d05202 100644
index 69db339c29c8f06026f05b0b5bb8019099af3fdf..479b87eaae67909768db1ba23854f05d2e61110c 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -2,6 +2,8 @@ package net.minecraft.server;
@ -1412,11 +1402,15 @@ index 69db339c29c8f06026f05b0b5bb8019099af3fdf..4608d5f50d3c572f56bcc20dae2d537a
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
public static BlockPosition lastPhysicsProblem; // Spigot
@@ -119,6 +122,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
protected World(WorldData worlddata, DimensionManager dimensionmanager, BiFunction<World, WorldProvider, IChunkProvider> bifunction, GameProfilerFiller gameprofilerfiller, boolean flag, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) {
@@ -116,9 +119,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return ((ChunkProviderServer) this.chunkProvider).getChunkAt(x, z, false);
}
- protected World(WorldData worlddata, DimensionManager dimensionmanager, BiFunction<World, WorldProvider, IChunkProvider> bifunction, GameProfilerFiller gameprofilerfiller, boolean flag, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) {
+ protected World(WorldData worlddata, DimensionManager dimensionmanager, java.util.concurrent.Executor executor, BiFunction<World, WorldProvider, IChunkProvider> bifunction, GameProfilerFiller gameprofilerfiller, boolean flag, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { // Paper - executor
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot
this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper
+ this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this.paperConfig) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
+ this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this.paperConfig, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
this.generator = gen;
if (dimensionmanager.world == null) dimensionmanager.world = (WorldServer) this; // Paper
this.world = new CraftWorld((WorldServer) this, gen, env);
@ -1428,6 +1422,19 @@ index 69db339c29c8f06026f05b0b5bb8019099af3fdf..4608d5f50d3c572f56bcc20dae2d537a
if (iblockdata1 == null) {
// CraftBukkit start - remove blockstate if failed (or the same)
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index a0484d8062ecfb817cfd5b996915dc8f9a4eb2bd..c019f0287711f8301b47a3c8f3740ff2aecb998b 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -84,7 +84,7 @@ public class WorldServer extends World {
// Add env and gen to constructor
public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
- super(worlddata, dimensionmanager, (world, worldprovider) -> {
+ super(worlddata, dimensionmanager, executor, (world, worldprovider) -> { // Paper - pass executor down
// CraftBukkit start
ChunkGenerator<?> chunkGenerator;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index a53bb7295c5d510f2976ff3787d68857548e11cc..47f1b970b9ba39f9050ac34a5ac15593c25f8a70 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java

View File

@ -17,7 +17,7 @@ This should fully solve all of the issues around it so that only natural
influences natural spawns.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index ca2ac17747d4f2acf1df056759c5c182be050125..a3fc76b512244ed6ca6b4d8f4babcb81f3cce226 100644
index f7c7c2871726e3a1673a693b9bd93910a28189b2..e8e61ce505cafccb3c8338bc5bbdf941f903bb27 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -505,6 +505,16 @@ public class PaperWorldConfig {
@ -35,10 +35,10 @@ index ca2ac17747d4f2acf1df056759c5c182be050125..a3fc76b512244ed6ca6b4d8f4babcb81
+ }
+
public boolean antiXray;
public boolean asynchronous;
public EngineMode engineMode;
public int maxChunkSectionIndex;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index a0484d8062ecfb817cfd5b996915dc8f9a4eb2bd..36a951cfcd617baf1a840f394e639567bd044308 100644
index c019f0287711f8301b47a3c8f3740ff2aecb998b..702dcc0387f85ebae8f1cfe9a8e79affef24281b 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -960,6 +960,13 @@ public class WorldServer extends World {

View File

@ -25,10 +25,10 @@ P3) Solutions for 1) and especially 2) might not be future-proof, while this
server-internal fix makes this change future-proof.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index a3fc76b512244ed6ca6b4d8f4babcb81f3cce226..90ba51e05bbed0366b43bc9315f6dfa9e39eee03 100644
index e8e61ce505cafccb3c8338bc5bbdf941f903bb27..7101ef0912221bdb1c32d2cafbac5d9d53e7037d 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -543,4 +543,9 @@ public class PaperWorldConfig {
@@ -541,4 +541,9 @@ public class PaperWorldConfig {
}
log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius);
}

View File

@ -3933,7 +3933,7 @@ index c999f8c9bf8a59e19b3d6d1b7ad8b5fb6e48b928..1a5ec6152c15a6ece227d4bac00c3b02
HAS_SPACE(VillagePlaceRecord::d), IS_OCCUPIED(VillagePlaceRecord::e), ANY((villageplacerecord) -> {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 58018bfcee5396d440b0f022a7aa9ed452e67ec5..f84248ad9f90aaaf02afa35a4147fb11f703fdcb 100644
index 83585f3ba7ef9e72f3702079a82f62c8b17e4077..83e6c872028107a17de1c08a5f6e8a02d62277ea 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -82,6 +82,79 @@ public class WorldServer extends World {
@ -4015,7 +4015,7 @@ index 58018bfcee5396d440b0f022a7aa9ed452e67ec5..f84248ad9f90aaaf02afa35a4147fb11
+
// Add env and gen to constructor
public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
super(worlddata, dimensionmanager, (world, worldprovider) -> {
super(worlddata, dimensionmanager, executor, (world, worldprovider) -> { // Paper - pass executor down
@@ -125,6 +198,8 @@ public class WorldServer extends World {
this.mobSpawnerTrader = this.worldProvider.getDimensionManager().getType() == DimensionManager.OVERWORLD ? new MobSpawnerTrader(this) : null; // CraftBukkit - getType()

View File

@ -8,7 +8,7 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk
load in that case).
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index c626134752f685d6357f2ee4d4e9f64eb0dbb8bf..5d9bca7a87f463ede1ff0a478d5d6d524ccb877b 100644
index 6a7bdf8c5f38ca4eb578e1104375e5773269330c..ee186ed5a076ede4d89702aeb5a2128d6e7ac8cf 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -996,7 +996,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -21,7 +21,7 @@ index c626134752f685d6357f2ee4d4e9f64eb0dbb8bf..5d9bca7a87f463ede1ff0a478d5d6d52
return;
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 7faaef50a5430c8bdf85ca0e37a4ad24ad56b1ef..21bb992cad2fd2692940ebe26360b8014c1df136 100644
index 479b87eaae67909768db1ba23854f05d2e61110c..8e5c54af26d2c7abf2daae081af97caee7fd9f7a 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -116,8 +116,16 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@ -40,7 +40,7 @@ index 7faaef50a5430c8bdf85ca0e37a4ad24ad56b1ef..21bb992cad2fd2692940ebe26360b801
+
+ // Paper end
protected World(WorldData worlddata, DimensionManager dimensionmanager, BiFunction<World, WorldProvider, IChunkProvider> bifunction, GameProfilerFiller gameprofilerfiller, boolean flag, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) {
protected World(WorldData worlddata, DimensionManager dimensionmanager, java.util.concurrent.Executor executor, BiFunction<World, WorldProvider, IChunkProvider> bifunction, GameProfilerFiller gameprofilerfiller, boolean flag, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { // Paper - executor
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot
@@ -1110,14 +1118,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
}

View File

@ -5,7 +5,7 @@ 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 90ba51e05bbed0366b43bc9315f6dfa9e39eee03..b1d09eb457cfd1be7590f200abfa8cb2236600ef 100644
index 7101ef0912221bdb1c32d2cafbac5d9d53e7037d..9b43b4172ae5df253479a412ec0d83fed08d70f1 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -1,10 +1,15 @@
@ -24,7 +24,7 @@ index 90ba51e05bbed0366b43bc9315f6dfa9e39eee03..b1d09eb457cfd1be7590f200abfa8cb2
import org.bukkit.configuration.file.YamlConfiguration;
import org.spigotmc.SpigotWorldConfig;
@@ -548,4 +553,52 @@ public class PaperWorldConfig {
@@ -546,4 +551,52 @@ public class PaperWorldConfig {
private void disableRelativeProjectileVelocity() {
disableRelativeProjectileVelocity = getBoolean("game-mechanics.disable-relative-projectile-velocity", false);
}

View File

@ -25,10 +25,10 @@ index 98acbfa44dd9042b26fdf719d7748f92d201c928..a94ebf7c76f167d3b66f7d243910c13d
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 b1d09eb457cfd1be7590f200abfa8cb2236600ef..515673e0fec1dc5c8a188d594f5c9b698c47d0e1 100644
index 9b43b4172ae5df253479a412ec0d83fed08d70f1..c148a57a9c3d44f2a0a2edfed4f96211745cc3e7 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -601,4 +601,9 @@ public class PaperWorldConfig {
@@ -599,4 +599,9 @@ public class PaperWorldConfig {
}
}
}
@ -755,7 +755,7 @@ index fdac5bb3a2d4a73035e1d914979b87fc224b6b20..58bbf2f9d2ec91715051d40e108e1606
@Nullable
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 469f4e718ba123c65b9743877555f14d8d218589..1838add259a1a2919a80cc5d773ed89ed5d73c01 100644
index 135d1211525f499198122e500626ce463c263088..80e2a15bebe93939dc7b43b17b8116965438c062 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1031,7 +1031,20 @@ public class WorldServer extends World {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Generator Settings
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 515673e0fec1dc5c8a188d594f5c9b698c47d0e1..928fefb4195bd5d629b59b2b3c7d005b79bdf161 100644
index c148a57a9c3d44f2a0a2edfed4f96211745cc3e7..62fe175dc4f00cc9cab6cbd828b57e25740b3793 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -606,4 +606,9 @@ public class PaperWorldConfig {
@@ -604,4 +604,9 @@ public class PaperWorldConfig {
private void perPlayerMobSpawns() {
perPlayerMobSpawns = getBoolean("per-player-mob-spawns", false);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix zero-tick instant grow farms MC-113809
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 928fefb4195bd5d629b59b2b3c7d005b79bdf161..442108555604b06c6217f4330c19b4997451126c 100644
index 62fe175dc4f00cc9cab6cbd828b57e25740b3793..f6f5f9dea6284582e9a175c0875273ee1db76076 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -554,6 +554,11 @@ public class PaperWorldConfig {
@@ -552,6 +552,11 @@ public class PaperWorldConfig {
disableRelativeProjectileVelocity = getBoolean("game-mechanics.disable-relative-projectile-velocity", false);
}
@ -81,7 +81,7 @@ index 55b07444e1d769952f2a411b1b5d1032565af8a1..3bc3c5aa29f45cd2ee1c0401b1ee1b1d
for (i = 1; worldserver.getType(blockposition.down(i)).getBlock() == this; ++i) {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 1838add259a1a2919a80cc5d773ed89ed5d73c01..fe84d8b33733391cf58215d92f8f31d6ac107f0a 100644
index 80e2a15bebe93939dc7b43b17b8116965438c062..3ecc73d021c09fbcad74dd62aced460771f86038 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -589,7 +589,9 @@ public class WorldServer extends World {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add option to disable pillager patrols
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 442108555604b06c6217f4330c19b4997451126c..1c703e48e99cd93be76bfeb0d9223507ba072b41 100644
index f6f5f9dea6284582e9a175c0875273ee1db76076..19f355d00ebe7065ae2d2df8156ea4b6459a6598 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -616,4 +616,9 @@ public class PaperWorldConfig {
@@ -614,4 +614,9 @@ public class PaperWorldConfig {
private void generatorSettings() {
generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", false);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] MC-145656 Fix Follow Range Initial Target
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 1c703e48e99cd93be76bfeb0d9223507ba072b41..e89ad807ed96205a7bf1110d849c3459a995188d 100644
index 19f355d00ebe7065ae2d2df8156ea4b6459a6598..a26848df994ffb0dc02d6a6051971439613dd0ba 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -621,4 +621,9 @@ public class PaperWorldConfig {
@@ -619,4 +619,9 @@ public class PaperWorldConfig {
private void pillagerSettings() {
disablePillagerPatrols = getBoolean("game-mechanics.disable-pillager-patrols", disablePillagerPatrols);
}

View File

@ -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 e89ad807ed96205a7bf1110d849c3459a995188d..fca4b6e20ab407ecaef3c5909c3d5e23a944e01b 100644
index a26848df994ffb0dc02d6a6051971439613dd0ba..cab503bd5c34d12b38a2f5deed6d3feb9287b370 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -626,4 +626,13 @@ public class PaperWorldConfig {
@@ -624,4 +624,13 @@ public class PaperWorldConfig {
private void entitiesTargetWithFollowRange() {
entitiesTargetWithFollowRange = getBoolean("entities-target-with-follow-range", entitiesTargetWithFollowRange);
}
@ -73,7 +73,7 @@ index d953cdef14a9b62833a35a4fe94a22b5e9b19c2d..d6e43313bf0c678cf78fe77de2f8f4b6
itemstack.d(this.C());
if (this.tag != null) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index aadc4635ecef4e5ba19ff56c37ecbdc5a1721ec6..e9c3d1507317e38272305e157e889a033c5d2803 100644
index 9450e27e5ce9295d87b95be2797fc27984ca2b0b..8c08a542a97edd76c07ef7d64834bdbd70345876 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1222,6 +1222,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -481,7 +481,7 @@ index d4cbce3243fe1f4973c9c0ae0dbdab10e3390897..3b394c2726e0fbe595641a022e59c896
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index d46f09f684b0b49e84b86fab5f10ac83b4b64d0b..6b6612de65081895825858f52d0f1c6f23c8edb6 100644
index 045e449c7e411dec7ef415c76c808cda426db652..2beb1374b105381d4467de4989c207339cb5dca1 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1206,8 +1206,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable {

View File

@ -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 ade7af40effbfff72e731628ac45c5fc40507c99..47c6d66b78ed312ef85dd90178c7d6059bc94661 100644
index 2ab810f71beaa608af2194165696817a2cde4b92..578d81337394e5279c99937890c3ce35bf58404c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -641,4 +641,9 @@ public class PaperWorldConfig {
@@ -639,4 +639,9 @@ public class PaperWorldConfig {
disableHopperMoveEvents = getBoolean("hopper.disable-move-event", disableHopperMoveEvents);
log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled"));
}

View File

@ -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 b773b750ae4cd41708e3fde4c88b5cf1af7098cb..c3af4c9a9fe67b7a9c0eda5606e1c97bad778927 100644
index 7d39028c930cbd66c867649d5148be2fb96bc579..0ff4475625e93d6f7a41345149e7c1fed0220bbb 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -651,4 +651,9 @@ public class PaperWorldConfig {
@@ -649,4 +649,9 @@ public class PaperWorldConfig {
private void nerfNetherPortalPigmen() {
nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen);
}

View File

@ -1161,7 +1161,7 @@ index f533860bbed19ff2915c90186c259b466f41ce90..3f1aa5ced697490b5481ba992cf5af5d
}
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 5519fb529dd8e1f93aab79dbc434715e08edb94f..be61f898cc96afeffe6ff2eb0ae3c4ce8da10b80 100644
index 7fded15f14a3f5c04a676e9e25413718b9922c13..642b5b485df28149f255ae9b5e43083821b20a0a 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -170,6 +170,15 @@ public class WorldServer extends World {
@ -1179,7 +1179,7 @@ index 5519fb529dd8e1f93aab79dbc434715e08edb94f..be61f898cc96afeffe6ff2eb0ae3c4ce
+
// Add env and gen to constructor
public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
super(worlddata, dimensionmanager, (world, worldprovider) -> {
super(worlddata, dimensionmanager, executor, (world, worldprovider) -> { // Paper - pass executor down
@@ -190,12 +199,22 @@ public class WorldServer extends World {
this.pvpMode = minecraftserver.getPVP();
worlddata.world = this;

View File

@ -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 c3af4c9a9fe67b7a9c0eda5606e1c97bad778927..3f44be577e32af4122b2c8b6c2849e650f4541f5 100644
index 0ff4475625e93d6f7a41345149e7c1fed0220bbb..598f27bc1b95132ded224dd5c7a0e2639ab2bd12 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -629,10 +629,21 @@ public class PaperWorldConfig {
@@ -627,10 +627,21 @@ public class PaperWorldConfig {
}
public boolean disablePillagerPatrols = false;

View File

@ -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 3f44be577e32af4122b2c8b6c2849e650f4541f5..a4815f5e69c00c4471bf7354222d9cf175ceafcd 100644
index 598f27bc1b95132ded224dd5c7a0e2639ab2bd12..ea5f306ef57fe5958a554f4bdf866a36d2b185e0 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -667,4 +667,9 @@ public class PaperWorldConfig {
@@ -665,4 +665,9 @@ public class PaperWorldConfig {
private void zombieVillagerInfectionChance() {
zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance);
}
@ -28,7 +28,7 @@ index 3f44be577e32af4122b2c8b6c2849e650f4541f5..a4815f5e69c00c4471bf7354222d9cf1
+ }
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index dcc5781d99d760e1d1fe6194db8fd49b23091404..f9faa30ef914b1dd2dada9b7d89e80b34d2f1d0d 100644
index 234c6f1854d4a491f6233fbd4677719a0503d3a1..508aa4866e47f3865a8c51f7c8e3b842be216923 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -637,7 +637,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas

View File

@ -30,7 +30,7 @@ In a view distance of 15, chunk loading performance was visually faster on the c
Flying at high speed in spectator mode was able to keep up with chunk loading (as long as they are already generated)
diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
index 11c5f8e033689f483a64486d2f8c206ca26ff9da..48e1c500695696ee6d2b7ed0ab01590c3623a608 100644
index a58ef60d9976b3afc50e94364cf474bd2e5fdfd6..dd07223978c9aa648673d96ba7b3db1160d43bbf 100644
--- a/src/main/java/co/aikar/timings/MinecraftTimings.java
+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java
@@ -13,6 +13,7 @@ import java.util.Map;
@ -226,7 +226,7 @@ index 508aa4866e47f3865a8c51f7c8e3b842be216923..11349565e71d97384d3dcab9cdf6ea16
// Spigot Start
CrashReport crashreport;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index c1e3c5ad7bbadedf01f7bd9162602398b81005a2..a4a2882d32d0167738f8367209dbfd3ca4f5b953 100644
index dfc9f4d5738b01e3f80af8f3d25aec51b6e9d8d9..69e6614049e490dc70baf745761c62b173cf693e 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -432,6 +432,7 @@ public class WorldServer extends World {

View File

@ -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 a4815f5e69c00c4471bf7354222d9cf175ceafcd..4612697569fd6e3683b0e58453b61a9a8d077229 100644
index ea5f306ef57fe5958a554f4bdf866a36d2b185e0..9db76eae1649fe2ce0856ff4bdcb15569bf58d93 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -672,4 +672,11 @@ public class PaperWorldConfig {
@@ -670,4 +670,11 @@ public class PaperWorldConfig {
private void lightQueueSize() {
lightQueueSize = getInt("light-queue-size", lightQueueSize);
}

View File

@ -23,10 +23,10 @@ index d4ebcf8f66197299256bd6b65710a1488c90ea41..a3b41ce5fc70948d4804659a472cb622
}));
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 4612697569fd6e3683b0e58453b61a9a8d077229..5c8a946d5c895fc2622c7df656cc462c58104cf7 100644
index 9db76eae1649fe2ce0856ff4bdcb15569bf58d93..c3f7717869c86d9ac6395615bceda324aea16b27 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -679,4 +679,9 @@ public class PaperWorldConfig {
@@ -677,4 +677,9 @@ public class PaperWorldConfig {
phantomIgnoreCreative = getBoolean("phantoms-do-not-spawn-on-creative-players", phantomIgnoreCreative);
phantomOnlyAttackInsomniacs = getBoolean("phantoms-only-attack-insomniacs", phantomOnlyAttackInsomniacs);
}
@ -584,7 +584,7 @@ index d7a9ec78db5994259bd6de289a8b4996349b2559..6daca5c0ffd1d84f9a25cd106e8992a0
while (iterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 9f4268202653f6f0ebed49cd67ae691a8b18ccd2..5535f98ac0ec1668b162cb652e88a122bcadac0c 100644
index 1c7955d3ae7ddd1c2d924cec20a91202cf090f40..7bd3f789b6055d73f3a6c0628652cca241147887 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -444,8 +444,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {

View File

@ -101,7 +101,7 @@ index b19bbbbc81376177751396a2de9452ce1f84c06b..296b41bf36ee1ace5bd9db2b810bf926
public Material getMaterial() {
return this.getBlock().k(this);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 5535f98ac0ec1668b162cb652e88a122bcadac0c..9de505d01fa30f31f2528265cb0d6af7ff59961f 100644
index 7bd3f789b6055d73f3a6c0628652cca241147887..032b7acee8c8af70c0283f5551ce2875607f6c98 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -342,6 +342,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable {

View File

@ -17,10 +17,10 @@ This allows servers with smaller worlds who do less long distance exploring to s
wasting cpu cycles on saving/unloading/reloading chunks repeatedly.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 5c8a946d5c895fc2622c7df656cc462c58104cf7..d64e996dde2c7665119c4bc1d907c40a8e3a63bc 100644
index c3f7717869c86d9ac6395615bceda324aea16b27..ecacb72b922927f06883b75e7d2cc1f904eb9f03 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -684,4 +684,13 @@ public class PaperWorldConfig {
@@ -682,4 +682,13 @@ public class PaperWorldConfig {
private void viewDistance() {
this.noTickViewDistance = this.getInt("viewdistances.no-tick-view-distance", -1);
}