diff --git a/patches/unapplied/server/Add-packet-limiter-config.patch b/patches/server/Add-packet-limiter-config.patch similarity index 100% rename from patches/unapplied/server/Add-packet-limiter-config.patch rename to patches/server/Add-packet-limiter-config.patch diff --git a/patches/unapplied/server/Attempt-to-recalculate-regionfile-header-if-it-is-co.patch b/patches/server/Attempt-to-recalculate-regionfile-header-if-it-is-co.patch similarity index 99% rename from patches/unapplied/server/Attempt-to-recalculate-regionfile-header-if-it-is-co.patch rename to patches/server/Attempt-to-recalculate-regionfile-header-if-it-is-co.patch index c483d34a65..f691394c5a 100644 --- a/patches/unapplied/server/Attempt-to-recalculate-regionfile-header-if-it-is-co.patch +++ b/patches/server/Attempt-to-recalculate-regionfile-header-if-it-is-co.patch @@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end - public static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codec(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), null); // Paper - Anti-Xray - Add preset block states + public static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), null); // Paper - Anti-Xray - Add preset block states private static final Logger LOGGER = LogUtils.getLogger(); @@ -0,0 +0,0 @@ public class ChunkSerializer { nbttagcompound.putInt("xPos", chunkcoordintpair.x); diff --git a/patches/unapplied/server/Consolidate-flush-calls-for-entity-tracker-packets.patch b/patches/server/Consolidate-flush-calls-for-entity-tracker-packets.patch similarity index 100% rename from patches/unapplied/server/Consolidate-flush-calls-for-entity-tracker-packets.patch rename to patches/server/Consolidate-flush-calls-for-entity-tracker-packets.patch diff --git a/patches/unapplied/server/Custom-table-implementation-for-blockstate-state-loo.patch b/patches/server/Custom-table-implementation-for-blockstate-state-loo.patch similarity index 99% rename from patches/unapplied/server/Custom-table-implementation-for-blockstate-state-loo.patch rename to patches/server/Custom-table-implementation-for-blockstate-state-loo.patch index 5a4c1c382c..1d1dd2dbf5 100644 --- a/patches/unapplied/server/Custom-table-implementation-for-blockstate-state-loo.patch +++ b/patches/server/Custom-table-implementation-for-blockstate-state-loo.patch @@ -318,7 +318,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + protected IntegerProperty(String name, int min, int max) { super(name, Integer.class); - this.min = min; + if (min < 0) { diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java diff --git a/patches/unapplied/server/Detail-more-information-in-watchdog-dumps.patch b/patches/server/Detail-more-information-in-watchdog-dumps.patch similarity index 99% rename from patches/unapplied/server/Detail-more-information-in-watchdog-dumps.patch rename to patches/server/Detail-more-information-in-watchdog-dumps.patch index 4a7e13d149..402be9fce0 100644 --- a/patches/unapplied/server/Detail-more-information-in-watchdog-dumps.patch +++ b/patches/server/Detail-more-information-in-watchdog-dumps.patch @@ -194,8 +194,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void setDeltaMovement(double x, double y, double z) { @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { - } - // Paper end - fix MC-4 + public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) { + // Paper end if (this.position.x != x || this.position.y != y || this.position.z != z) { + synchronized (this.posLock) { // Paper this.position = new Vec3(x, y, z); diff --git a/patches/unapplied/server/Distance-manager-tick-timings.patch b/patches/server/Distance-manager-tick-timings.patch similarity index 100% rename from patches/unapplied/server/Distance-manager-tick-timings.patch rename to patches/server/Distance-manager-tick-timings.patch diff --git a/patches/unapplied/server/Do-not-copy-visible-chunks.patch b/patches/server/Do-not-copy-visible-chunks.patch similarity index 97% rename from patches/unapplied/server/Do-not-copy-visible-chunks.patch rename to patches/server/Do-not-copy-visible-chunks.patch index 773bb5c978..e030df9418 100644 --- a/patches/unapplied/server/Do-not-copy-visible-chunks.patch +++ b/patches/server/Do-not-copy-visible-chunks.patch @@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public final ServerLevel level; @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider boolean unloadingPlayerChunk = false; // Paper - do not allow ticket level changes while unloading chunks - public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory, int viewDistance, boolean dsync) { + public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor executor, BlockableEventLoop mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory, int viewDistance, boolean dsync) { super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); - this.visibleChunkMap = this.updatingChunkMap.clone(); + // Paper - don't copy diff --git a/patches/unapplied/server/Don-t-lookup-fluid-state-when-raytracing.patch b/patches/server/Don-t-lookup-fluid-state-when-raytracing.patch similarity index 100% rename from patches/unapplied/server/Don-t-lookup-fluid-state-when-raytracing.patch rename to patches/server/Don-t-lookup-fluid-state-when-raytracing.patch diff --git a/patches/unapplied/server/Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch b/patches/server/Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch similarity index 94% rename from patches/unapplied/server/Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch rename to patches/server/Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch index ea14812e17..f01e20cd03 100644 --- a/patches/unapplied/server/Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch +++ b/patches/server/Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ChunkStorage implements AutoCloseable { // CraftBukkit start - private boolean check(ServerChunkCache cps, int x, int z) throws IOException { + private boolean check(ServerChunkCache cps, int x, int z) { + if (true) return true; // Paper - this isn't even needed anymore, light is purged updating to 1.14+, why are we holding up the conversion process reading chunk data off disk - return true, we need to set light populated to true so the converter recognizes the chunk as being "full" ChunkPos pos = new ChunkPos(x, z); if (cps != null) { diff --git a/patches/unapplied/server/Execute-chunk-tasks-mid-tick.patch b/patches/server/Execute-chunk-tasks-mid-tick.patch similarity index 96% rename from patches/unapplied/server/Execute-chunk-tasks-mid-tick.patch rename to patches/server/Execute-chunk-tasks-mid-tick.patch index 8a15d93c55..4899362e6a 100644 --- a/patches/unapplied/server/Execute-chunk-tasks-mid-tick.patch +++ b/patches/server/Execute-chunk-tasks-mid-tick.patch @@ -130,16 +130,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { - private final StructureFeatureManager structureFeatureManager; + private final StructureManager structureManager; private final StructureCheck structureCheck; private final boolean tickTime; -- -+ // Paper start - execute chunk tasks mid tick -+ public long lastMidTickExecuteFailure; -+ // Paper end - execute chunk tasks mid tick ++ public long lastMidTickExecuteFailure; // Paper - execute chunk tasks mid tick // CraftBukkit start - private int tickPosition; + public final LevelStorageSource.LevelStorageAccess convertable; @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { if (fluid1.is(fluid)) { fluid1.tick(this, pos); @@ -162,7 +159,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // Spigot end - } else if (this.shouldTickBlocksAt(ChunkPos.asLong(tickingblockentity.getPos()))) { + } else if (this.shouldTickBlocksAt(tickingblockentity.getPos())) { tickingblockentity.tick(); + // Paper start - execute chunk tasks during tick + if ((this.tileTickPosition & 7) == 0) { diff --git a/patches/unapplied/server/Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch b/patches/server/Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch similarity index 100% rename from patches/unapplied/server/Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch rename to patches/server/Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch diff --git a/patches/unapplied/server/Manually-inline-methods-in-BlockPosition.patch b/patches/server/Manually-inline-methods-in-BlockPosition.patch similarity index 100% rename from patches/unapplied/server/Manually-inline-methods-in-BlockPosition.patch rename to patches/server/Manually-inline-methods-in-BlockPosition.patch diff --git a/patches/unapplied/server/Name-craft-scheduler-threads-according-to-the-plugin.patch b/patches/server/Name-craft-scheduler-threads-according-to-the-plugin.patch similarity index 100% rename from patches/unapplied/server/Name-craft-scheduler-threads-according-to-the-plugin.patch rename to patches/server/Name-craft-scheduler-threads-according-to-the-plugin.patch diff --git a/patches/unapplied/server/Optimise-chunk-tick-iteration.patch b/patches/server/Optimise-chunk-tick-iteration.patch similarity index 97% rename from patches/unapplied/server/Optimise-chunk-tick-iteration.patch rename to patches/server/Optimise-chunk-tick-iteration.patch index 46b0b61ee0..ab0297f5a6 100644 --- a/patches/unapplied/server/Optimise-chunk-tick-iteration.patch +++ b/patches/server/Optimise-chunk-tick-iteration.patch @@ -41,13 +41,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @@ -0,0 +0,0 @@ public class ChunkHolder { - int k = this.lightEngine.getMaxLightSection(); + int k = this.lightEngine.getMaxLightSection(); - if (y >= j && y <= k) { + if (y >= j && y <= k) { + this.addToBroadcastMap(); // Paper - optimise chunk tick iteration - int l = y - j; + int l = y - j; - if (lightType == LightLayer.SKY) { + if (lightType == LightLayer.SKY) { @@ -0,0 +0,0 @@ public class ChunkHolder { } } @@ -85,7 +85,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/sr index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -0,0 +0,0 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana +@@ -0,0 +0,0 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.storage.LevelData; import net.minecraft.world.level.storage.LevelStorageSource; diff --git a/patches/unapplied/server/Time-scoreboard-search.patch b/patches/server/Time-scoreboard-search.patch similarity index 100% rename from patches/unapplied/server/Time-scoreboard-search.patch rename to patches/server/Time-scoreboard-search.patch diff --git a/patches/unapplied/server/Use-correct-LevelStem-registry-when-loading-default-.patch b/patches/server/Use-correct-LevelStem-registry-when-loading-default-.patch similarity index 88% rename from patches/unapplied/server/Use-correct-LevelStem-registry-when-loading-default-.patch rename to patches/server/Use-correct-LevelStem-registry-when-loading-default-.patch index b673862323..80f0117697 100644 --- a/patches/unapplied/server/Use-correct-LevelStem-registry-when-loading-default-.patch +++ b/patches/server/Use-correct-LevelStem-registry-when-loading-default-.patch @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end return dataResult; } else { - Holder holder = registry.getOrCreateHolder(entryKey); + Holder holder = registry.getOrCreateHolderOrThrow(entryKey); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -40,6 +40,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + worlddimension = iregistry.get(dimensionKey); + } + // Paper end - Holder holder; - ChunkGenerator chunkgenerator; + org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), worlddimension.typeHolder().value()); + if (biomeProvider == null && gen != null) { diff --git a/patches/unapplied/server/Lag-compensate-block-breaking.patch b/patches/unapplied/server/Lag-compensate-block-breaking.patch deleted file mode 100644 index a4b64c63cb..0000000000 --- a/patches/unapplied/server/Lag-compensate-block-breaking.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Fri, 14 Feb 2020 22:16:34 -0800 -Subject: [PATCH] Lag compensate block breaking - -Use time instead of ticks if ticks fall behind - -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -0,0 +0,0 @@ public class PaperConfig { - } - } - } -+ -+ public static boolean lagCompensateBlockBreaking; -+ -+ private static void lagCompensateBlockBreaking() { -+ lagCompensateBlockBreaking = getBoolean("settings.lag-compensate-block-breaking", true); -+ } - } -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -0,0 +0,0 @@ public class ServerPlayerGameMode { - @Nullable - private GameType previousGameModeForPlayer; - private boolean isDestroyingBlock; -- private int destroyProgressStart; -+ private int destroyProgressStart; private long lastDigTime; // Paper - lag compensate block breaking - private BlockPos destroyPos; - private int gameTicks; - private boolean hasDelayedDestroy; - private BlockPos delayedDestroyPos; -- private int delayedTickStart; -+ private int delayedTickStart; private long hasDestroyedTooFastStartTime; // Paper - lag compensate block breaking - private int lastSentState; - -+ // Paper start - lag compensate block breaking -+ private int getTimeDiggingLagCompensate() { -+ int lagCompensated = (int)((System.nanoTime() - this.lastDigTime) / (50L * 1000L * 1000L)); -+ int tickDiff = this.gameTicks - this.destroyProgressStart; -+ return (com.destroystokyo.paper.PaperConfig.lagCompensateBlockBreaking && lagCompensated > (tickDiff + 1)) ? lagCompensated : tickDiff; // add one to ensure we don't lag compensate unless we need to -+ } -+ -+ private int getTimeDiggingTooFastLagCompensate() { -+ int lagCompensated = (int)((System.nanoTime() - this.hasDestroyedTooFastStartTime) / (50L * 1000L * 1000L)); -+ int tickDiff = this.gameTicks - this.delayedTickStart; -+ return (com.destroystokyo.paper.PaperConfig.lagCompensateBlockBreaking && lagCompensated > (tickDiff + 1)) ? lagCompensated : tickDiff; // add one to ensure we don't lag compensate unless we need to -+ } -+ // Paper end -+ - public ServerPlayerGameMode(ServerPlayer player) { - this.gameModeForPlayer = GameType.DEFAULT_MODE; - this.destroyPos = BlockPos.ZERO; -@@ -0,0 +0,0 @@ public class ServerPlayerGameMode { - if (iblockdata == null || iblockdata.isAir()) { // Paper - this.hasDelayedDestroy = false; - } else { -- float f = this.incrementDestroyProgress(iblockdata, this.delayedDestroyPos, this.delayedTickStart); -+ float f = this.updateBlockBreakAnimation(iblockdata, this.delayedDestroyPos, this.getTimeDiggingTooFastLagCompensate()); // Paper - lag compensate destroying blocks - - if (f >= 1.0F) { - this.hasDelayedDestroy = false; -@@ -0,0 +0,0 @@ public class ServerPlayerGameMode { - this.lastSentState = -1; - this.isDestroyingBlock = false; - } else { -- this.incrementDestroyProgress(iblockdata, this.destroyPos, this.destroyProgressStart); -+ this.updateBlockBreakAnimation(iblockdata, this.destroyPos, this.getTimeDiggingLagCompensate()); // Paper - lag compensate destroying - } - } - -@@ -0,0 +0,0 @@ public class ServerPlayerGameMode { - - private float incrementDestroyProgress(BlockState state, BlockPos pos, int i) { - int j = this.gameTicks - i; -+ // Paper start - change i (startTime) to totalTime -+ return this.updateBlockBreakAnimation(state, pos, j); -+ } -+ private float updateBlockBreakAnimation(BlockState state, BlockPos pos, int totalTime) { -+ int j = totalTime; -+ // Paper end - float f = state.getDestroyProgress(this.player, this.player.level, pos) * (float) (j + 1); - int k = (int) (f * 10.0F); - -@@ -0,0 +0,0 @@ public class ServerPlayerGameMode { - return; - } - -- this.destroyProgressStart = this.gameTicks; -+ this.destroyProgressStart = this.gameTicks; this.lastDigTime = System.nanoTime(); // Paper - lag compensate block breaking - float f = 1.0F; - - iblockdata1 = this.level.getBlockState(pos); -@@ -0,0 +0,0 @@ public class ServerPlayerGameMode { - int j = (int) (f * 10.0F); - - this.level.destroyBlockProgress(this.player.getId(), pos, j); -- this.player.connection.send(new ClientboundBlockBreakAckPacket(pos, this.level.getBlockState(pos), action, true, "actual start of destroying")); -+ if (!com.destroystokyo.paper.PaperConfig.lagCompensateBlockBreaking) this.player.connection.send(new ClientboundBlockBreakAckPacket(pos, this.level.getBlockState(pos), action, true, "actual start of destroying")); - this.lastSentState = j; - } - } else if (action == ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK) { - if (pos.equals(this.destroyPos)) { -- int k = this.gameTicks - this.destroyProgressStart; -+ int k = this.getTimeDiggingLagCompensate(); // Paper - lag compensate block breaking - - iblockdata1 = this.level.getBlockState(pos); - if (!iblockdata1.isAir()) { -@@ -0,0 +0,0 @@ public class ServerPlayerGameMode { - this.isDestroyingBlock = false; - this.hasDelayedDestroy = true; - this.delayedDestroyPos = pos; -- this.delayedTickStart = this.destroyProgressStart; -+ this.delayedTickStart = this.destroyProgressStart; this.hasDestroyedTooFastStartTime = this.lastDigTime; // Paper - lag compensate block breaking - } - } - } - -+ // Paper start - this can cause clients on a lagging server to think they're not currently destroying a block -+ if (com.destroystokyo.paper.PaperConfig.lagCompensateBlockBreaking) { -+ this.player.connection.send(new ClientboundBlockUpdatePacket(this.level, pos)); -+ } else { - this.player.connection.send(new ClientboundBlockBreakAckPacket(pos, this.level.getBlockState(pos), action, true, "stopped destroying")); -+ } -+ // Paper end - this can cause clients on a lagging server to think they're not currently destroying a block - } else if (action == ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK) { - this.isDestroyingBlock = false; - if (!Objects.equals(this.destroyPos, pos) && !BlockPos.ZERO.equals(this.destroyPos)) { -@@ -0,0 +0,0 @@ public class ServerPlayerGameMode { - } - - this.level.destroyBlockProgress(this.player.getId(), pos, -1); -- this.player.connection.send(new ClientboundBlockBreakAckPacket(pos, this.level.getBlockState(pos), action, true, "aborted destroying")); -+ if (!com.destroystokyo.paper.PaperConfig.lagCompensateBlockBreaking) this.player.connection.send(new ClientboundBlockBreakAckPacket(pos, this.level.getBlockState(pos), action, true, "aborted destroying")); // Paper - this can cause clients on a lagging server to think they stopped destroying a block they're currently destroying - - CraftEventFactory.callBlockDamageAbortEvent(this.player, pos, this.player.getInventory().getSelected()); // CraftBukkit - } -@@ -0,0 +0,0 @@ public class ServerPlayerGameMode { - - public void destroyAndAck(BlockPos pos, ServerboundPlayerActionPacket.Action action, String reason) { - if (this.destroyBlock(pos)) { -+ // Paper start - this can cause clients on a lagging server to think they're not currently destroying a block -+ if (com.destroystokyo.paper.PaperConfig.lagCompensateBlockBreaking) { -+ this.player.connection.send(new ClientboundBlockUpdatePacket(this.level, pos)); -+ } else { - this.player.connection.send(new ClientboundBlockBreakAckPacket(pos, this.level.getBlockState(pos), action, true, reason)); -+ } -+ // Paper end - this can cause clients on a lagging server to think they're not currently destroying a block - } else { - this.player.connection.send(new ClientboundBlockUpdatePacket(this.level, pos)); // CraftBukkit - SPIGOT-5196 - }