diff --git a/patches/unapplied/server/0726-Add-Raw-Byte-Entity-Serialization.patch b/patches/removed/1.18/0726-Add-Raw-Byte-Entity-Serialization.patch similarity index 100% rename from patches/unapplied/server/0726-Add-Raw-Byte-Entity-Serialization.patch rename to patches/removed/1.18/0726-Add-Raw-Byte-Entity-Serialization.patch diff --git a/patches/unapplied/server/0747-Prevent-unload-calls-removing-tickets-for-sync-loads.patch b/patches/removed/1.18/0747-Prevent-unload-calls-removing-tickets-for-sync-loads.patch similarity index 100% rename from patches/unapplied/server/0747-Prevent-unload-calls-removing-tickets-for-sync-loads.patch rename to patches/removed/1.18/0747-Prevent-unload-calls-removing-tickets-for-sync-loads.patch diff --git a/patches/unapplied/server/0803-Add-paper-mobcaps-and-paper-playermobcaps.patch b/patches/removed/1.18/0755-Add-paper-mobcaps-and-paper-playermobcaps.patch similarity index 97% rename from patches/unapplied/server/0803-Add-paper-mobcaps-and-paper-playermobcaps.patch rename to patches/removed/1.18/0755-Add-paper-mobcaps-and-paper-playermobcaps.patch index b03a1ed147b..c51bf951d8d 100644 --- a/patches/unapplied/server/0803-Add-paper-mobcaps-and-paper-playermobcaps.patch +++ b/patches/removed/1.18/0755-Add-paper-mobcaps-and-paper-playermobcaps.patch @@ -10,7 +10,7 @@ Also has a hover text on each mob category listing what entity types are in said category diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index 2ef4b4c2ff81d0fa33d4630593266066d8e6a6f3..34bc24403a83ae578d2fc3956b4883894c618747 100644 +index 85beb460aa59313cf2ace2d6a6bf24938e3e2b80..f9064589216c679d9305988534aba8ef94b9a5fe 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -3,6 +3,7 @@ package com.destroystokyo.paper; @@ -85,7 +85,7 @@ index 2ef4b4c2ff81d0fa33d4630593266066d8e6a6f3..34bc24403a83ae578d2fc3956b488389 case "ver": if (!testPermission(sender, "version")) break; // "ver" needs a special check because it's an alias. All other commands are checked up before the switch statement (because they are present in the SUBCOMMANDS set) case "version": -@@ -246,6 +266,183 @@ public class PaperCommand extends Command { +@@ -246,6 +266,184 @@ public class PaperCommand extends Command { } } @@ -93,6 +93,7 @@ index 2ef4b4c2ff81d0fa33d4630593266066d8e6a6f3..34bc24403a83ae578d2fc3956b488389 + .put(MobCategory.MONSTER, NamedTextColor.RED) + .put(MobCategory.CREATURE, NamedTextColor.GREEN) + .put(MobCategory.AMBIENT, NamedTextColor.GRAY) ++ .put(MobCategory.AXOLOTLS, TextColor.color(0x7324FF)) + .put(MobCategory.UNDERGROUND_WATER_CREATURE, TextColor.color(0x3541E6)) + .put(MobCategory.WATER_CREATURE, TextColor.color(0x006EFF)) + .put(MobCategory.WATER_AMBIENT, TextColor.color(0x00B3FF)) @@ -270,10 +271,10 @@ index 2ef4b4c2ff81d0fa33d4630593266066d8e6a6f3..34bc24403a83ae578d2fc3956b488389 List worlds; if (args.length < 2 || args[1].equals("*")) { diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 55dd04816886d27a62856ac952d2fc5d15bf40e6..790999fea74e4d03a80a4c0c9665af87bd683577 100644 +index 63ba93538d990fdd4c9e8c491bb715adc8d57986..928025438af179711c42381fc3eaeac74cd20c59 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -@@ -145,32 +145,16 @@ public final class NaturalSpawner { +@@ -148,32 +148,16 @@ public final class NaturalSpawner { MobCategory enumcreaturetype = aenumcreaturetype[j]; // CraftBukkit start - Use per-world spawn limits boolean spawnThisTick = true; @@ -315,7 +316,7 @@ index 55dd04816886d27a62856ac952d2fc5d15bf40e6..790999fea74e4d03a80a4c0c9665af87 } if (!spawnThisTick || limit == 0) { -@@ -209,6 +193,28 @@ public final class NaturalSpawner { +@@ -211,6 +195,28 @@ public final class NaturalSpawner { world.getProfiler().pop(); } diff --git a/patches/unapplied/server/0762-Rewrite-the-light-engine.patch b/patches/removed/1.18/0762-Rewrite-the-light-engine.patch similarity index 100% rename from patches/unapplied/server/0762-Rewrite-the-light-engine.patch rename to patches/removed/1.18/0762-Rewrite-the-light-engine.patch diff --git a/patches/unapplied/server/0764-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch b/patches/removed/1.18/0764-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch similarity index 100% rename from patches/unapplied/server/0764-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch rename to patches/removed/1.18/0764-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch diff --git a/patches/unapplied/server/0765-Optimise-chunk-tick-iteration.patch b/patches/removed/1.18/0765-Optimise-chunk-tick-iteration.patch similarity index 100% rename from patches/unapplied/server/0765-Optimise-chunk-tick-iteration.patch rename to patches/removed/1.18/0765-Optimise-chunk-tick-iteration.patch diff --git a/patches/unapplied/server/0769-Replace-player-chunk-loader-system.patch b/patches/removed/1.18/0769-Replace-player-chunk-loader-system.patch similarity index 100% rename from patches/unapplied/server/0769-Replace-player-chunk-loader-system.patch rename to patches/removed/1.18/0769-Replace-player-chunk-loader-system.patch diff --git a/patches/unapplied/server/0770-Replace-ticket-level-propagator.patch b/patches/removed/1.18/0770-Replace-ticket-level-propagator.patch similarity index 100% rename from patches/unapplied/server/0770-Replace-ticket-level-propagator.patch rename to patches/removed/1.18/0770-Replace-ticket-level-propagator.patch diff --git a/patches/unapplied/server/0774-Optimise-collision-checking-in-player-move-packet-ha.patch b/patches/removed/1.18/0774-Optimise-collision-checking-in-player-move-packet-ha.patch similarity index 100% rename from patches/unapplied/server/0774-Optimise-collision-checking-in-player-move-packet-ha.patch rename to patches/removed/1.18/0774-Optimise-collision-checking-in-player-move-packet-ha.patch diff --git a/patches/unapplied/server/0781-Use-hash-table-for-maintaing-changed-block-set.patch b/patches/removed/1.18/No longer needed/0781-Use-hash-table-for-maintaing-changed-block-set.patch similarity index 100% rename from patches/unapplied/server/0781-Use-hash-table-for-maintaing-changed-block-set.patch rename to patches/removed/1.18/No longer needed/0781-Use-hash-table-for-maintaing-changed-block-set.patch diff --git a/patches/unapplied/server/0772-Custom-table-implementation-for-blockstate-state-loo.patch b/patches/server/0746-Custom-table-implementation-for-blockstate-state-loo.patch similarity index 96% rename from patches/unapplied/server/0772-Custom-table-implementation-for-blockstate-state-loo.patch rename to patches/server/0746-Custom-table-implementation-for-blockstate-state-loo.patch index acc55358021..9b556d7fe87 100644 --- a/patches/unapplied/server/0772-Custom-table-implementation-for-blockstate-state-loo.patch +++ b/patches/server/0746-Custom-table-implementation-for-blockstate-state-loo.patch @@ -173,7 +173,7 @@ index 0000000000000000000000000000000000000000..57d0cd3ad6f972e986c72a57f1a6e360 + } +} diff --git a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java -index baf1cb77eb170a44d821eae572d059f18ea46d7e..11c05776c051ba6a7e8416fd8591babafda35a80 100644 +index 5c30f43ba7db43cc2613ddaf6ea0d0810d3d08d7..5be5eabc222b9e20c083ff83fae52010b19ea854 100644 --- a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java +++ b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java @@ -40,11 +40,13 @@ public abstract class StateHolder { @@ -264,10 +264,10 @@ index ff1a0d125edd2ea10c870cbb62ae9aa23644b6dc..233215280f8494dbc33a2fd0b14e37e5 super(name, Boolean.class); } diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java -index bcf8b24e9f9e9870c1a1d27c721a6a433305d55a..6b05e766162b2cf8b499e5b0effb2cd15e57bea3 100644 +index 0bca0f971dac994bd8b6ecd87e8b33e26c0f18f9..edd3c745efb40ee79a1393199c7a27ddaa2f8026 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java -@@ -17,6 +17,15 @@ public class EnumProperty & StringRepresentable> extends Prope +@@ -15,6 +15,15 @@ public class EnumProperty & StringRepresentable> extends Prope private final ImmutableSet values; private final Map names = Maps.newHashMap(); @@ -283,7 +283,7 @@ index bcf8b24e9f9e9870c1a1d27c721a6a433305d55a..6b05e766162b2cf8b499e5b0effb2cd1 protected EnumProperty(String name, Class type, Collection values) { super(name, type); this.values = ImmutableSet.copyOf(values); -@@ -31,6 +40,14 @@ public class EnumProperty & StringRepresentable> extends Prope +@@ -28,6 +37,14 @@ public class EnumProperty & StringRepresentable> extends Prope this.names.put(string, enum_); } @@ -320,10 +320,10 @@ index 72f508321ebffcca31240fbdd068b4d185454cbc..d16156f8a4a2507e114dc651fd0af9cd super(name, Integer.class); this.min = min; 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 81b43e0b0146729a8a1c6ade82634c86cde67857..44118dbd1ed212a0911f1244e7fea78cee275aad 100644 +index 1d0f0099571e7295f5f83004c45b6e992a4af83a..bf4a39671425b56e7096008a8e43094eebbb2d05 100644 --- 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 -@@ -20,6 +20,17 @@ public abstract class Property> { +@@ -22,6 +22,17 @@ public abstract class Property> { }, this::getName); private final Codec> valueCodec = this.codec.xmap(this::value, Property.Value::value); diff --git a/patches/unapplied/server/0773-Detail-more-information-in-watchdog-dumps.patch b/patches/server/0747-Detail-more-information-in-watchdog-dumps.patch similarity index 93% rename from patches/unapplied/server/0773-Detail-more-information-in-watchdog-dumps.patch rename to patches/server/0747-Detail-more-information-in-watchdog-dumps.patch index 7af32a532d9..f03e054f56f 100644 --- a/patches/unapplied/server/0773-Detail-more-information-in-watchdog-dumps.patch +++ b/patches/server/0747-Detail-more-information-in-watchdog-dumps.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Detail more information in watchdog dumps - Dump player name, player uuid, position, and world for packet handling diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 23757f466da571aec35a373112dcbba0d1f46dcb..3321bb7582a3e0227fbc1d41982529c23548269b 100644 +index a6b438543a12f5ecf05fb631ef53b18d4d253dff..c2642f798c49f79d34e599517d64d73b6e7676c6 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -481,7 +481,14 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -452,7 +452,14 @@ public class Connection extends SimpleChannelInboundHandler> { } if (this.packetListener instanceof ServerGamePacketListenerImpl) { @@ -77,10 +77,10 @@ index bcf53ec07b8eeec7a88fb67e6fb908362e6f51b0..acc12307f61e1e055896b68fe16654c9 }); throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 9c69855874da2c18e9c80decf4244a0f50021a28..a999fece43b1b3f687061b541a975d889886db60 100644 +index 5d4f20a31ad99b4e808bb9a7aaa2153666af493f..928ac2d5b93b93aa7494374f4f3446557ebebd6d 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -962,7 +962,26 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -973,7 +973,26 @@ public class ServerLevel extends Level implements WorldGenLevel { } @@ -107,7 +107,7 @@ index 9c69855874da2c18e9c80decf4244a0f50021a28..a999fece43b1b3f687061b541a975d88 ++TimingHistory.entityTicks; // Paper - timings // Spigot start co.aikar.timings.Timing timer; // Paper -@@ -1002,7 +1021,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1013,7 +1032,13 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickPassenger(entity, entity1); } // } finally { timer.stopTiming(); } // Paper - timings - move up @@ -123,10 +123,10 @@ index 9c69855874da2c18e9c80decf4244a0f50021a28..a999fece43b1b3f687061b541a975d88 private void tickPassenger(Entity vehicle, Entity passenger) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 481e84fda6dccfaf684c922a12fa19ed35c87b3c..94857a736d2a16e8ade286c6f2ddf8bd798008eb 100644 +index db6c11694e6316c50a3f0a138e09542fdae45718..62fe626aa198d19ccfb48f47b8f771b6037cff9c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -888,7 +888,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -860,7 +860,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i return this.onGround; } @@ -169,7 +169,7 @@ index 481e84fda6dccfaf684c922a12fa19ed35c87b3c..94857a736d2a16e8ade286c6f2ddf8bd if (this.noPhysics) { this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); } else { -@@ -1079,6 +1114,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -1022,6 +1057,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i this.level.getProfiler().pop(); } } @@ -182,8 +182,8 @@ index 481e84fda6dccfaf684c922a12fa19ed35c87b3c..94857a736d2a16e8ade286c6f2ddf8bd + // Paper end - detailed watchdog information } - protected void tryCheckInsideBlocks() { -@@ -3896,7 +3938,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n + protected boolean isHorizontalCollisionMinor(Vec3 adjustedMovement) { +@@ -3798,7 +3840,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public void setDeltaMovement(Vec3 velocity) { @@ -193,7 +193,7 @@ index 481e84fda6dccfaf684c922a12fa19ed35c87b3c..94857a736d2a16e8ade286c6f2ddf8bd } public void setDeltaMovement(double x, double y, double z) { -@@ -3972,7 +4016,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3874,7 +3918,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } // Paper end - fix MC-4 if (this.position.x != x || this.position.y != y || this.position.z != z) { diff --git a/patches/unapplied/server/0775-Manually-inline-methods-in-BlockPosition.patch b/patches/server/0748-Manually-inline-methods-in-BlockPosition.patch similarity index 79% rename from patches/unapplied/server/0775-Manually-inline-methods-in-BlockPosition.patch rename to patches/server/0748-Manually-inline-methods-in-BlockPosition.patch index 547ad977083..0d800a81006 100644 --- a/patches/unapplied/server/0775-Manually-inline-methods-in-BlockPosition.patch +++ b/patches/server/0748-Manually-inline-methods-in-BlockPosition.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Manually inline methods in BlockPosition diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index b70aa66732fb5e957aed0901f4c76358b2c56f8e..0cc0242d981586413bcc349df6e6fd3bc09710f1 100644 +index 0dcf75c5c792650d7a5b9354222df16bcd1cfbd2..14610e6144ec144ebbec6fb0945c67bb0ea86795 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java -@@ -478,9 +478,9 @@ public class BlockPos extends Vec3i { +@@ -484,9 +484,9 @@ public class BlockPos extends Vec3i { } public BlockPos.MutableBlockPos set(int x, int y, int z) { @@ -21,7 +21,7 @@ index b70aa66732fb5e957aed0901f4c76358b2c56f8e..0cc0242d981586413bcc349df6e6fd3b return this; } -@@ -544,19 +544,19 @@ public class BlockPos extends Vec3i { +@@ -550,19 +550,19 @@ public class BlockPos extends Vec3i { // Paper start - comment out useless overrides @Override - TODO figure out why this is suddenly important to keep @Override public BlockPos.MutableBlockPos setX(int i) { @@ -45,10 +45,10 @@ index b70aa66732fb5e957aed0901f4c76358b2c56f8e..0cc0242d981586413bcc349df6e6fd3b } // Paper end diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java -index dc7598a011c2b290a42df35593de0b6689c99c57..a90085cfb2e3944c40bf15812320ff5e2690d3b1 100644 +index 6de2ea6641433206027015695a0d10c80fe0e2f5..b9d30deecb63efd4cd8c840b710edba5b956bd93 100644 --- a/src/main/java/net/minecraft/core/Vec3i.java +++ b/src/main/java/net/minecraft/core/Vec3i.java -@@ -17,9 +17,9 @@ public class Vec3i implements Comparable { +@@ -19,9 +19,9 @@ public class Vec3i implements Comparable { return IntStream.of(vec3i.getX(), vec3i.getY(), vec3i.getZ()); }); public static final Vec3i ZERO = new Vec3i(0, 0, 0); @@ -59,5 +59,5 @@ index dc7598a011c2b290a42df35593de0b6689c99c57..a90085cfb2e3944c40bf15812320ff5e + protected int y; // Paper - protected + protected int z; // Paper - protected - // Paper start - public boolean isValidLocation(net.minecraft.world.level.LevelHeightAccessor levelHeightAccessor) { + private static Function> checkOffsetAxes(int maxAbsValue) { + return (vec) -> { diff --git a/patches/unapplied/server/0776-Distance-manager-tick-timings.patch b/patches/server/0749-Distance-manager-tick-timings.patch similarity index 87% rename from patches/unapplied/server/0776-Distance-manager-tick-timings.patch rename to patches/server/0749-Distance-manager-tick-timings.patch index 8825901f21a..8b5b3e68ec6 100644 --- a/patches/unapplied/server/0776-Distance-manager-tick-timings.patch +++ b/patches/server/0749-Distance-manager-tick-timings.patch @@ -19,18 +19,18 @@ index eada966d7f108a6081be7a848f5c1dfcb1eed676..a977f7483f37df473096b2234dc1308b public static final Timing midTickChunkTasks = Timings.ofSafe("Mid Tick Chunk Tasks"); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 6db8c95693772296d947fbc051b97937fd184685..6589baa5680a154e47e7e28223e2214ca36790f3 100644 +index 7908e35a5842beb422edfed624561caffe08e6ef..8cad7941263bb1c48884c4fd883200eb2634db5d 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -843,6 +843,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -788,6 +788,7 @@ public class ServerChunkCache extends ChunkSource { + public boolean runDistanceManagerUpdates() { - if (distanceManager.delayDistanceManagerTick) return false; // Paper - Chunk priority if (this.chunkMap.unloadingPlayerChunk) { net.minecraft.server.MinecraftServer.LOGGER.fatal("Cannot tick distance manager while unloading playerchunks", new Throwable()); throw new IllegalStateException("Cannot tick distance manager while unloading playerchunks"); } // Paper + co.aikar.timings.MinecraftTimings.distanceManagerTick.startTiming(); try { // Paper - add timings for distance manager boolean flag = this.distanceManager.runAllUpdates(this.chunkMap); boolean flag1 = this.chunkMap.promoteChunkMap(); -@@ -852,6 +853,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -797,6 +798,7 @@ public class ServerChunkCache extends ChunkSource { this.clearCache(); return true; } diff --git a/patches/unapplied/server/0777-Name-craft-scheduler-threads-according-to-the-plugin.patch b/patches/server/0750-Name-craft-scheduler-threads-according-to-the-plugin.patch similarity index 100% rename from patches/unapplied/server/0777-Name-craft-scheduler-threads-according-to-the-plugin.patch rename to patches/server/0750-Name-craft-scheduler-threads-according-to-the-plugin.patch diff --git a/patches/unapplied/server/0778-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch b/patches/server/0751-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch similarity index 90% rename from patches/unapplied/server/0778-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch rename to patches/server/0751-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch index f395f91274e..7ceb975f801 100644 --- a/patches/unapplied/server/0778-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch +++ b/patches/server/0751-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch @@ -13,10 +13,10 @@ Paper recently reverted this optimisation, so it's been reintroduced here. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 41be326b8ea5b7419dc09578e48c7c7f378e22cc..30f42ed54d01b819fc9c6a6a10324108d36348b4 100644 +index 9cc34ff8ec5db5a87faf0afb574543f01c8381c2..367c932ae6abfbc73a42afaa143cefcedea52ffb 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -400,6 +400,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -395,6 +395,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @Override public final LevelChunk getChunk(int chunkX, int chunkZ) { // Paper - final to help inline diff --git a/patches/unapplied/server/0779-Add-packet-limiter-config.patch b/patches/server/0752-Add-packet-limiter-config.patch similarity index 94% rename from patches/unapplied/server/0779-Add-packet-limiter-config.patch rename to patches/server/0752-Add-packet-limiter-config.patch index a273c156dd2..109cd8e1653 100644 --- a/patches/unapplied/server/0779-Add-packet-limiter-config.patch +++ b/patches/server/0752-Add-packet-limiter-config.patch @@ -24,12 +24,12 @@ and an action can be defined: DROP or KICK If interval or rate are less-than 0, the limit is ignored diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index a72f15c10410508ff344caf3ca376fd3d7317518..5ccc86d714d5e6e40df853bb30be11662cd53809 100644 +index ce2cc249439d525d2089302f3febde758aa96929..e311e1dd8b0e07b8787ec42a58c4e6559ac661ed 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -550,4 +550,102 @@ public class PaperConfig { - playerMaxConcurrentChunkLoads = getDouble("settings.chunk-loading.player-max-concurrent-loads", 4.0); - globalMaxConcurrentChunkLoads = getDouble("settings.chunk-loading.global-max-concurrent-loads", 500.0); +@@ -507,4 +507,102 @@ public class PaperConfig { + itemValidationBookAuthorLength = getInt("settings.item-validation.book.author", itemValidationBookAuthorLength); + itemValidationBookPageLength = getInt("settings.item-validation.book.page", itemValidationBookPageLength); } + + public static final class PacketLimit { @@ -131,10 +131,10 @@ index a72f15c10410508ff344caf3ca376fd3d7317518..5ccc86d714d5e6e40df853bb30be1166 + } } diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 3321bb7582a3e0227fbc1d41982529c23548269b..73457ae24ba6f605dd831a870499f1a990570e53 100644 +index c2642f798c49f79d34e599517d64d73b6e7676c6..241b086bd096a4bc2175835b2505deda1c143f09 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -148,6 +148,22 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -126,6 +126,22 @@ public class Connection extends SimpleChannelInboundHandler> { } } // Paper end - allow controlled flushing @@ -157,7 +157,7 @@ index 3321bb7582a3e0227fbc1d41982529c23548269b..73457ae24ba6f605dd831a870499f1a9 public Connection(PacketFlow side) { this.receiving = side; -@@ -228,6 +244,45 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -206,6 +222,45 @@ public class Connection extends SimpleChannelInboundHandler> { protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet packet) { if (this.channel.isOpen()) { diff --git a/patches/unapplied/server/0780-Lag-compensate-block-breaking.patch b/patches/server/0753-Lag-compensate-block-breaking.patch similarity index 91% rename from patches/unapplied/server/0780-Lag-compensate-block-breaking.patch rename to patches/server/0753-Lag-compensate-block-breaking.patch index 18f58cddecb..a11901e0ec5 100644 --- a/patches/unapplied/server/0780-Lag-compensate-block-breaking.patch +++ b/patches/server/0753-Lag-compensate-block-breaking.patch @@ -6,10 +6,10 @@ 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 5ccc86d714d5e6e40df853bb30be11662cd53809..cf9a72b7fe0b41e1ca68bbae2164162447405fc5 100644 +index e311e1dd8b0e07b8787ec42a58c4e6559ac661ed..dbf8f1b605b8abbfd668e05a3e6fc004784f934a 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -648,4 +648,10 @@ public class PaperConfig { +@@ -605,4 +605,10 @@ public class PaperConfig { } } } @@ -21,10 +21,10 @@ index 5ccc86d714d5e6e40df853bb30be11662cd53809..cf9a72b7fe0b41e1ca68bbae21641624 + } } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 35d05cc4bddea5b168a6498add1de9bcbdbfc1cb..12998d0e9ae0e148a155faa4468b0f78b8462cc9 100644 +index 3ab74a721d9d9bec82a68a30bf523292a3038587..17a59fba538f8a7bdd96964c6acda94b33655d27 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -56,14 +56,28 @@ public class ServerPlayerGameMode { +@@ -54,14 +54,28 @@ public class ServerPlayerGameMode { @Nullable private GameType previousGameModeForPlayer; private boolean isDestroyingBlock; @@ -55,7 +55,7 @@ index 35d05cc4bddea5b168a6498add1de9bcbdbfc1cb..12998d0e9ae0e148a155faa4468b0f78 public ServerPlayerGameMode(ServerPlayer player) { this.gameModeForPlayer = GameType.DEFAULT_MODE; this.destroyPos = BlockPos.ZERO; -@@ -130,7 +144,7 @@ public class ServerPlayerGameMode { +@@ -128,7 +142,7 @@ public class ServerPlayerGameMode { if (iblockdata == null || iblockdata.isAir()) { // Paper this.hasDelayedDestroy = false; } else { @@ -64,7 +64,7 @@ index 35d05cc4bddea5b168a6498add1de9bcbdbfc1cb..12998d0e9ae0e148a155faa4468b0f78 if (f >= 1.0F) { this.hasDelayedDestroy = false; -@@ -150,7 +164,7 @@ public class ServerPlayerGameMode { +@@ -148,7 +162,7 @@ public class ServerPlayerGameMode { this.lastSentState = -1; this.isDestroyingBlock = false; } else { @@ -73,7 +73,7 @@ index 35d05cc4bddea5b168a6498add1de9bcbdbfc1cb..12998d0e9ae0e148a155faa4468b0f78 } } -@@ -158,6 +172,12 @@ public class ServerPlayerGameMode { +@@ -156,6 +170,12 @@ public class ServerPlayerGameMode { private float incrementDestroyProgress(BlockState state, BlockPos pos, int i) { int j = this.gameTicks - i; @@ -86,7 +86,7 @@ index 35d05cc4bddea5b168a6498add1de9bcbdbfc1cb..12998d0e9ae0e148a155faa4468b0f78 float f = state.getDestroyProgress(this.player, this.player.level, pos) * (float) (j + 1); int k = (int) (f * 10.0F); -@@ -226,7 +246,7 @@ public class ServerPlayerGameMode { +@@ -224,7 +244,7 @@ public class ServerPlayerGameMode { return; } @@ -95,7 +95,7 @@ index 35d05cc4bddea5b168a6498add1de9bcbdbfc1cb..12998d0e9ae0e148a155faa4468b0f78 float f = 1.0F; iblockdata = this.level.getBlockState(pos); -@@ -279,12 +299,12 @@ public class ServerPlayerGameMode { +@@ -277,12 +297,12 @@ public class ServerPlayerGameMode { int j = (int) (f * 10.0F); this.level.destroyBlockProgress(this.player.getId(), pos, j); @@ -110,7 +110,7 @@ index 35d05cc4bddea5b168a6498add1de9bcbdbfc1cb..12998d0e9ae0e148a155faa4468b0f78 iblockdata = this.level.getBlockState(pos); if (!iblockdata.isAir()) { -@@ -301,12 +321,18 @@ public class ServerPlayerGameMode { +@@ -299,12 +319,18 @@ public class ServerPlayerGameMode { this.isDestroyingBlock = false; this.hasDelayedDestroy = true; this.delayedDestroyPos = pos; @@ -130,7 +130,7 @@ index 35d05cc4bddea5b168a6498add1de9bcbdbfc1cb..12998d0e9ae0e148a155faa4468b0f78 } else if (action == ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK) { this.isDestroyingBlock = false; if (!Objects.equals(this.destroyPos, pos) && !BlockPos.ZERO.equals(this.destroyPos)) { -@@ -318,7 +344,7 @@ public class ServerPlayerGameMode { +@@ -316,7 +342,7 @@ public class ServerPlayerGameMode { } this.level.destroyBlockProgress(this.player.getId(), pos, -1); @@ -139,7 +139,7 @@ index 35d05cc4bddea5b168a6498add1de9bcbdbfc1cb..12998d0e9ae0e148a155faa4468b0f78 } } -@@ -328,7 +354,13 @@ public class ServerPlayerGameMode { +@@ -324,7 +350,13 @@ public class ServerPlayerGameMode { public void destroyAndAck(BlockPos pos, ServerboundPlayerActionPacket.Action action, String reason) { if (this.destroyBlock(pos)) { diff --git a/patches/unapplied/server/0826-Use-correct-LevelStem-registry-when-loading-default-.patch b/patches/server/0754-Use-correct-LevelStem-registry-when-loading-default-.patch similarity index 89% rename from patches/unapplied/server/0826-Use-correct-LevelStem-registry-when-loading-default-.patch rename to patches/server/0754-Use-correct-LevelStem-registry-when-loading-default-.patch index 1fdfe05599f..be669ea4568 100644 --- a/patches/unapplied/server/0826-Use-correct-LevelStem-registry-when-loading-default-.patch +++ b/patches/server/0754-Use-correct-LevelStem-registry-when-loading-default-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Use correct LevelStem registry when loading default diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 57cb2722e973cfc8edc845bc7154b8b8bbb11e12..5a4172faaf960d48939d6a485719041987df9242 100644 +index 86b57776a42261053237d62f3b666793457c5e2f..58fa998b07d08c8ca3fd1e3f6fb7ee94de359cd6 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -641,7 +641,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(iworlddataserver)); diff --git a/patches/removed/1.18/0767-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch b/patches/server/0755-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch similarity index 88% rename from patches/removed/1.18/0767-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch rename to patches/server/0755-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch index dbf1b0db95d..0f50eb9e0a6 100644 --- a/patches/removed/1.18/0767-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch +++ b/patches/server/0755-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch @@ -8,10 +8,10 @@ Lighting is purged on update anyways, so let's not add more into the conversion process diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java -index 176610b31f66b890afe61f4de46c412382bb8d22..037bbd562e2f35e17c324cd200c55c5e6cb5d768 100644 +index 3c1724a86cccd3d66459f6c21ed358b47d2d0eac..e490116a75c5a07e501339ca5e299fb425af84f4 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java -@@ -40,6 +40,7 @@ public class ChunkStorage implements AutoCloseable { +@@ -44,6 +44,7 @@ public class ChunkStorage implements AutoCloseable { // CraftBukkit start private boolean check(ServerChunkCache cps, int x, int z) throws IOException { diff --git a/patches/server/0756-Consolidate-flush-calls-for-entity-tracker-packets.patch b/patches/server/0756-Consolidate-flush-calls-for-entity-tracker-packets.patch new file mode 100644 index 00000000000..f4977cc6307 --- /dev/null +++ b/patches/server/0756-Consolidate-flush-calls-for-entity-tracker-packets.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Sat, 4 Apr 2020 17:00:20 -0700 +Subject: [PATCH] Consolidate flush calls for entity tracker packets + +Most server packets seem to be sent from here, so try to avoid +expensive flush calls from them. + +This change was motivated due to local testing: + +- My server spawn has 130 cows in it (for testing a prev. patch) +- Try to let 200 players join spawn + +Without this change, I could only get 20 players on before they +all started timing out due to the load put on the Netty I/O threads. + +With this change I could get all 200 on at 0ms ping. + +(one of the primary issues is that my CPU is kinda trash, and having +4 extra threads at 100% is just too much for it). + +So in general this patch should reduce Netty I/O thread load. + +diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +index 8cad7941263bb1c48884c4fd883200eb2634db5d..7c8198009de30229dcce73ae5c0ca60ba7224cef 100644 +--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java ++++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +@@ -975,7 +975,24 @@ public class ServerChunkCache extends ChunkSource { + }); + gameprofilerfiller.pop(); + gameprofilerfiller.pop(); ++ // Paper start - controlled flush for entity tracker packets ++ List disabledFlushes = new java.util.ArrayList<>(this.level.players.size()); ++ for (ServerPlayer player : this.level.players) { ++ net.minecraft.server.network.ServerGamePacketListenerImpl connection = player.connection; ++ if (connection != null) { ++ connection.connection.disableAutomaticFlush(); ++ disabledFlushes.add(connection.connection); ++ } ++ } ++ try { // Paper end - controlled flush for entity tracker packets + this.chunkMap.tick(); ++ // Paper start - controlled flush for entity tracker packets ++ } finally { ++ for (net.minecraft.network.Connection networkManager : disabledFlushes) { ++ networkManager.enableAutomaticFlush(); ++ } ++ } ++ // Paper end - controlled flush for entity tracker packets + } + } + diff --git a/patches/unapplied/server/0783-Don-t-lookup-fluid-state-when-raytracing.patch b/patches/server/0757-Don-t-lookup-fluid-state-when-raytracing.patch similarity index 92% rename from patches/unapplied/server/0783-Don-t-lookup-fluid-state-when-raytracing.patch rename to patches/server/0757-Don-t-lookup-fluid-state-when-raytracing.patch index bf4e1f243f3..a1ddcdaa79f 100644 --- a/patches/unapplied/server/0783-Don-t-lookup-fluid-state-when-raytracing.patch +++ b/patches/server/0757-Don-t-lookup-fluid-state-when-raytracing.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Don't lookup fluid state when raytracing Just use the iblockdata already retrieved, removes a getType call. diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java -index fe4dba491b586757a16aa36e62682f364daa2602..b087dd208f62856c03db3aa2ae28ffc98d76e649 100644 +index 3bf658ad473ebfcb4f4ca6efff2ee068167b1a62..7ad35b3586ae670602cc63e67d2f01fc5d10b638 100644 --- a/src/main/java/net/minecraft/world/level/BlockGetter.java +++ b/src/main/java/net/minecraft/world/level/BlockGetter.java @@ -84,7 +84,7 @@ public interface BlockGetter extends LevelHeightAccessor { diff --git a/patches/unapplied/server/0784-Time-scoreboard-search.patch b/patches/server/0758-Time-scoreboard-search.patch similarity index 100% rename from patches/unapplied/server/0784-Time-scoreboard-search.patch rename to patches/server/0758-Time-scoreboard-search.patch diff --git a/patches/unapplied/server/0785-Send-full-pos-packets-for-hard-colliding-entities.patch b/patches/server/0759-Send-full-pos-packets-for-hard-colliding-entities.patch similarity index 88% rename from patches/unapplied/server/0785-Send-full-pos-packets-for-hard-colliding-entities.patch rename to patches/server/0759-Send-full-pos-packets-for-hard-colliding-entities.patch index 79c80daacc7..6810016b6c9 100644 --- a/patches/unapplied/server/0785-Send-full-pos-packets-for-hard-colliding-entities.patch +++ b/patches/server/0759-Send-full-pos-packets-for-hard-colliding-entities.patch @@ -9,10 +9,10 @@ Configurable under `send-full-pos-for-hard-colliding-entities` diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index cf9a72b7fe0b41e1ca68bbae2164162447405fc5..0940655792402ed29a1ec80a2a6fb2f100de4659 100644 +index dbf8f1b605b8abbfd668e05a3e6fc004784f934a..95b52e9f6d2b87c525b9eac88fae2e73b08bca82 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -654,4 +654,10 @@ public class PaperConfig { +@@ -611,4 +611,10 @@ public class PaperConfig { private static void lagCompensateBlockBreaking() { lagCompensateBlockBreaking = getBoolean("settings.lag-compensate-block-breaking", true); } @@ -24,10 +24,10 @@ index cf9a72b7fe0b41e1ca68bbae2164162447405fc5..0940655792402ed29a1ec80a2a6fb2f1 + } } diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 9950541e0432240207458274b76b1c5d402ac704..b7c9294fdd3d799d410afba4a1118aa371c98533 100644 +index 94704a258ce7183aeb0ccec0b9106e40efd08821..703ac671b19636859648f16a5431b2700791e7d5 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -173,7 +173,7 @@ public class ServerEntity { +@@ -172,7 +172,7 @@ public class ServerEntity { // Paper end - remove allocation of Vec3D here boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L; diff --git a/patches/unapplied/server/0786-Do-not-run-raytrace-logic-for-AIR.patch b/patches/server/0760-Do-not-run-raytrace-logic-for-AIR.patch similarity index 92% rename from patches/unapplied/server/0786-Do-not-run-raytrace-logic-for-AIR.patch rename to patches/server/0760-Do-not-run-raytrace-logic-for-AIR.patch index f8c4d1a7afe..8517a67d895 100644 --- a/patches/unapplied/server/0786-Do-not-run-raytrace-logic-for-AIR.patch +++ b/patches/server/0760-Do-not-run-raytrace-logic-for-AIR.patch @@ -9,7 +9,7 @@ easy win. The remaining problems with this function are mostly with the block getting itself. diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java -index b087dd208f62856c03db3aa2ae28ffc98d76e649..6200a8ab4f7b2c40e7139cfb90a62f42c5828de2 100644 +index 7ad35b3586ae670602cc63e67d2f01fc5d10b638..ae8800a37ecd117126d976bcce1b91d56e7587b8 100644 --- a/src/main/java/net/minecraft/world/level/BlockGetter.java +++ b/src/main/java/net/minecraft/world/level/BlockGetter.java @@ -84,6 +84,7 @@ public interface BlockGetter extends LevelHeightAccessor { diff --git a/patches/unapplied/server/0787-Oprimise-map-impl-for-tracked-players.patch b/patches/server/0761-Oprimise-map-impl-for-tracked-players.patch similarity index 79% rename from patches/unapplied/server/0787-Oprimise-map-impl-for-tracked-players.patch rename to patches/server/0761-Oprimise-map-impl-for-tracked-players.patch index 62ec327fe7d..49845d7d97b 100644 --- a/patches/unapplied/server/0787-Oprimise-map-impl-for-tracked-players.patch +++ b/patches/server/0761-Oprimise-map-impl-for-tracked-players.patch @@ -7,18 +7,18 @@ Reference2BooleanOpenHashMap is going to have better lookups than HashMap. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 9b4d689c04c59056f0a2ec39cf26e173cb722641..87172ee94f5796a23c22c58bbb591dede2b2dc3c 100644 +index b244713d4a5bc6eb3d9536a56fdc9d688ca0d756..925da0baa59f742dbe727c6323cc90b65159f314 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -103,6 +103,7 @@ import org.apache.logging.log4j.LogManager; +@@ -105,6 +105,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; - - import org.bukkit.entity.Player; // CraftBukkit + import org.bukkit.entity.Player; + // CraftBukkit end +import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; // Paper public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider { -@@ -2167,7 +2168,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially +@@ -1828,7 +1829,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final Entity entity; private final int range; SectionPos lastSectionPos; diff --git a/patches/unapplied/server/0788-Optimise-BlockSoil-nearby-water-lookup.patch b/patches/server/0762-Optimise-BlockSoil-nearby-water-lookup.patch similarity index 95% rename from patches/unapplied/server/0788-Optimise-BlockSoil-nearby-water-lookup.patch rename to patches/server/0762-Optimise-BlockSoil-nearby-water-lookup.patch index a3213ee164b..54639ad2a8a 100644 --- a/patches/unapplied/server/0788-Optimise-BlockSoil-nearby-water-lookup.patch +++ b/patches/server/0762-Optimise-BlockSoil-nearby-water-lookup.patch @@ -7,7 +7,7 @@ Apparently the abstract block iteration was taking about 75% of the method call. diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java -index aa1ba8b74ab70b6cede99e4853ac0203f388ab06..5955c95efbfa3e614ecf03de3e485a1ea88b7859 100644 +index afd4dc6f69389f43c1a95069840e01a33ac86b63..5d95f3cce8f5190bc2172a1fe0e83166062f0f3d 100644 --- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java @@ -139,19 +139,28 @@ public class FarmBlock extends Block { diff --git a/patches/unapplied/server/0789-Allow-removal-addition-of-entities-to-entity-ticklis.patch b/patches/server/0763-Allow-removal-addition-of-entities-to-entity-ticklis.patch similarity index 100% rename from patches/unapplied/server/0789-Allow-removal-addition-of-entities-to-entity-ticklis.patch rename to patches/server/0763-Allow-removal-addition-of-entities-to-entity-ticklis.patch diff --git a/patches/unapplied/server/0790-Optimise-random-block-ticking.patch b/patches/server/0764-Optimise-random-block-ticking.patch similarity index 77% rename from patches/unapplied/server/0790-Optimise-random-block-ticking.patch rename to patches/server/0764-Optimise-random-block-ticking.patch index c03d323b512..5146c13bf2f 100644 --- a/patches/unapplied/server/0790-Optimise-random-block-ticking.patch +++ b/patches/server/0764-Optimise-random-block-ticking.patch @@ -71,10 +71,10 @@ index 0000000000000000000000000000000000000000..e8b4053babe46999980b926431254050 + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 960aa86d64ce6bfc84fff06a7698490c7c32c5fa..2d322cc13dabc041911991e6c8dfde4374ac76bd 100644 +index 928ac2d5b93b93aa7494374f4f3446557ebebd6d..5935c442a6534ad51d191a72bc8d2043fa25e2ac 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -743,6 +743,10 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -639,6 +639,10 @@ public class ServerLevel extends Level implements WorldGenLevel { entityplayer.stopSleepInBed(false, false); }); } @@ -85,7 +85,7 @@ index 960aa86d64ce6bfc84fff06a7698490c7c32c5fa..2d322cc13dabc041911991e6c8dfde43 public void tickChunk(LevelChunk chunk, int randomTickSpeed) { ChunkPos chunkcoordintpair = chunk.getPos(); -@@ -752,10 +756,10 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -648,10 +652,10 @@ public class ServerLevel extends Level implements WorldGenLevel { ProfilerFiller gameprofilerfiller = this.getProfiler(); gameprofilerfiller.push("thunder"); @@ -98,7 +98,7 @@ index 960aa86d64ce6bfc84fff06a7698490c7c32c5fa..2d322cc13dabc041911991e6c8dfde43 if (this.isRainingAt(blockposition)) { DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition); boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * paperConfig.skeleHorseSpawnChance && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper -@@ -778,65 +782,78 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -674,65 +678,78 @@ public class ServerLevel extends Level implements WorldGenLevel { } gameprofilerfiller.popPush("iceandsnow"); @@ -114,7 +114,7 @@ index 960aa86d64ce6bfc84fff06a7698490c7c32c5fa..2d322cc13dabc041911991e6c8dfde43 + // Paper end Biome biomebase = this.getBiome(blockposition); -- if (biomebase.shouldFreeze((LevelReader) this, blockposition1)) { +- if (biomebase.shouldFreeze(this, blockposition1)) { - org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, Blocks.ICE.defaultBlockState(), null); // CraftBukkit + // Paper start - optimise chunk ticking + blockposition.setY(downY); @@ -135,14 +135,14 @@ index 960aa86d64ce6bfc84fff06a7698490c7c32c5fa..2d322cc13dabc041911991e6c8dfde43 + blockposition.setY(normalY); // Paper Biome.Precipitation biomebase_precipitation = this.getBiome(blockposition).getPrecipitation(); -- if (biomebase_precipitation == Biome.Precipitation.RAIN && biomebase.isColdEnoughToSnow(blockposition1)) { +- if (biomebase_precipitation == Biome.Precipitation.RAIN && biomebase.coldEnoughToSnow(blockposition1)) { + blockposition.setY(downY); // Paper -+ if (biomebase_precipitation == Biome.Precipitation.RAIN && biomebase.isColdEnoughToSnow(blockposition)) { // Paper ++ if (biomebase_precipitation == Biome.Precipitation.RAIN && biomebase.coldEnoughToSnow(blockposition)) { // Paper biomebase_precipitation = Biome.Precipitation.SNOW; } -- iblockdata.getBlock().handlePrecipitation(iblockdata, (Level) this, blockposition1, biomebase_precipitation); -+ iblockdata.getBlock().handlePrecipitation(iblockdata, (Level) this, blockposition, biomebase_precipitation); // Paper +- iblockdata.getBlock().handlePrecipitation(iblockdata, this, blockposition1, biomebase_precipitation); ++ iblockdata.getBlock().handlePrecipitation(iblockdata, this, blockposition, biomebase_precipitation); // Paper } } @@ -157,7 +157,7 @@ index 960aa86d64ce6bfc84fff06a7698490c7c32c5fa..2d322cc13dabc041911991e6c8dfde43 - for (int i1 = 0; i1 < l; ++i1) { - LevelChunkSection chunksection = achunksection[i1]; - -- if (chunksection != LevelChunk.EMPTY_SECTION && chunksection.isRandomlyTicking()) { +- if (chunksection.isRandomlyTicking()) { - int j1 = chunksection.bottomBlockY(); - - for (int k1 = 0; k1 < randomTickSpeed; ++k1) { @@ -211,15 +211,35 @@ index 960aa86d64ce6bfc84fff06a7698490c7c32c5fa..2d322cc13dabc041911991e6c8dfde43 gameprofilerfiller.pop(); } diff --git a/src/main/java/net/minecraft/util/BitStorage.java b/src/main/java/net/minecraft/util/BitStorage.java -index 07e1374ac3430662edd9f585e59b785e329f0820..9f9c0b56f0891e9c423d79f8ae4c3643a2b91048 100644 +index 62251727788d48a461ea6f7945771d7d6bdc7282..106610ccc74b70b557b01c61262d56c4f1147acf 100644 --- a/src/main/java/net/minecraft/util/BitStorage.java +++ b/src/main/java/net/minecraft/util/BitStorage.java -@@ -104,4 +104,32 @@ public class BitStorage { - } +@@ -20,4 +20,15 @@ public interface BitStorage { + void unpack(int[] is); - } + BitStorage copy(); + + // Paper start ++ void forEach(DataBitConsumer consumer); ++ ++ @FunctionalInterface ++ interface DataBitConsumer { ++ ++ void accept(int location, int data); ++ ++ } ++ // Paper end + } +diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java +index 6426d6c2c31ead49444fe56e2230266290fa79dd..881a2318aac72526e0451688af58c620e4f525d1 100644 +--- a/src/main/java/net/minecraft/util/SimpleBitStorage.java ++++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java +@@ -124,6 +124,28 @@ public class SimpleBitStorage implements BitStorage { + return this.bits; + } + ++ // Paper start ++ @Override + public final void forEach(DataBitConsumer consumer) { + int i = 0; + long[] along = this.data; @@ -238,20 +258,36 @@ index 07e1374ac3430662edd9f585e59b785e329f0820..9f9c0b56f0891e9c423d79f8ae4c3643 + } + } + } ++ // Paper end + -+ @FunctionalInterface -+ public static interface DataBitConsumer { -+ -+ void accept(int location, int data); -+ + @Override + public void getAll(IntConsumer action) { + int i = 0; +diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java +index 172e7a0761724cc802387e613258830a0defb04a..55c486349ddb295d4d4c6fa9214cdae90f851948 100644 +--- a/src/main/java/net/minecraft/util/ZeroBitStorage.java ++++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java +@@ -46,6 +46,15 @@ public class ZeroBitStorage implements BitStorage { + return 0; + } + ++ // Paper start ++ @Override ++ public void forEach(DataBitConsumer consumer) { ++ for(int i = 0; i < this.size; ++i) { ++ consumer.accept(i, 0); ++ } + } + // Paper end - } ++ + @Override + public void getAll(IntConsumer action) { + for(int i = 0; i < this.size; ++i) { diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java -index 00dbe5046c3b93e402218a6903ea2f087410388b..7d001f42c448fd328b6384d133dcc4b72aab756c 100644 +index 60e1111f3c2c43398f21c541248f38524f41f4fb..56e9c0d15249562ebea8eb451d4bcc9ff5e7d594 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java +++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java -@@ -91,7 +91,7 @@ public class Turtle extends Animal { +@@ -87,7 +87,7 @@ public class Turtle extends Animal { } public void setHomePos(BlockPos pos) { @@ -261,10 +297,10 @@ index 00dbe5046c3b93e402218a6903ea2f087410388b..7d001f42c448fd328b6384d133dcc4b7 public BlockPos getHomePos() { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 30f42ed54d01b819fc9c6a6a10324108d36348b4..326ce282ae333d9b3ba3a2f9904ecaf62c0734be 100644 +index 367c932ae6abfbc73a42afaa143cefcedea52ffb..6be462975523dae9ff436ba1643b2042ec66e554 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -1354,10 +1354,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1352,10 +1352,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public abstract TagContainer getTagManager(); public BlockPos getBlockRandomPos(int x, int y, int z, int l) { @@ -285,20 +321,20 @@ index 30f42ed54d01b819fc9c6a6a10324108d36348b4..326ce282ae333d9b3ba3a2f9904ecaf6 public boolean noSave() { diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -index c1c95ac9deb134a0cf5c7763090ac5f3cddf24cc..72e3264dc74822f746fb84fec0be400047d2d9f5 100644 +index f9e871cff9318e6fea92d5b7a7035b3bfa259bca..c579be24944b310151738d375c53e2d52b32edb7 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -@@ -19,6 +19,7 @@ public class LevelChunkSection { - private short tickingBlockCount; +@@ -25,6 +25,7 @@ public class LevelChunkSection { private short tickingFluidCount; - public final PalettedContainer states; // Paper - package-private // Paper - public + public final PalettedContainer states; + private final PalettedContainer biomes; + public final com.destroystokyo.paper.util.maplist.IBlockDataList tickingList = new com.destroystokyo.paper.util.maplist.IBlockDataList(); // Paper - // Paper start - Anti-Xray - Add parameters - @Deprecated public LevelChunkSection(int yOffset) { this(yOffset, null, null, true); } // Notice for updates: Please make sure this constructor isn't used anywhere + public LevelChunkSection(int chunkPos, PalettedContainer blockStateContainer, PalettedContainer biomeContainer) { + this.bottomBlockY = LevelChunkSection.getBottomBlockY(chunkPos); @@ -79,6 +80,9 @@ public class LevelChunkSection { --this.nonEmptyBlockCount; - if (blockState.isRandomlyTicking()) { + if (iblockdata1.isRandomlyTicking()) { --this.tickingBlockCount; + // Paper start + this.tickingList.remove(x, y, z); @@ -316,7 +352,7 @@ index c1c95ac9deb134a0cf5c7763090ac5f3cddf24cc..72e3264dc74822f746fb84fec0be4000 } } -@@ -125,22 +132,28 @@ public class LevelChunkSection { +@@ -121,23 +128,29 @@ public class LevelChunkSection { } public void recalcBlockCounts() { @@ -326,44 +362,47 @@ index c1c95ac9deb134a0cf5c7763090ac5f3cddf24cc..72e3264dc74822f746fb84fec0be4000 this.nonEmptyBlockCount = 0; this.tickingBlockCount = 0; this.tickingFluidCount = 0; -- this.states.count((state, count) -> { -+ this.states.forEachLocation((state, location) -> { // Paper - FluidState fluidState = state.getFluidState(); - if (!state.isAir()) { -- this.nonEmptyBlockCount = (short)(this.nonEmptyBlockCount + count); -+ this.nonEmptyBlockCount = (short)(this.nonEmptyBlockCount + 1); // Paper - if (state.isRandomlyTicking()) { -- this.tickingBlockCount = (short)(this.tickingBlockCount + count); +- this.states.count((iblockdata, i) -> { ++ this.states.forEachLocation((iblockdata, i) -> { // Paper + FluidState fluid = iblockdata.getFluidState(); + + if (!iblockdata.isAir()) { +- this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + i); ++ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); // Paper + if (iblockdata.isRandomlyTicking()) { +- this.tickingBlockCount = (short) (this.tickingBlockCount + i); + // Paper start + this.tickingBlockCount = (short)(this.tickingBlockCount + 1); -+ this.tickingList.add(location, state); ++ this.tickingList.add(i, iblockdata); + // Paper end } } - if (!fluidState.isEmpty()) { -- this.nonEmptyBlockCount = (short)(this.nonEmptyBlockCount + count); -+ this.nonEmptyBlockCount = (short)(this.nonEmptyBlockCount + 1); // Paper - if (fluidState.isRandomlyTicking()) { -- this.tickingFluidCount = (short)(this.tickingFluidCount + count); -+ this.tickingFluidCount = (short)(this.tickingFluidCount + 1); // Paper + if (!fluid.isEmpty()) { +- this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + i); ++ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); // Paper + if (fluid.isRandomlyTicking()) { +- this.tickingFluidCount = (short) (this.tickingFluidCount + i); ++ this.tickingFluidCount = (short) (this.tickingFluidCount + 1); // Paper } } diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index 79fd7a6e8a6eb1f699d03801910d97066677311c..c9e942669458668a184aaec3bc0a5509dd6ab5f0 100644 +index bd003e980ac0fe8c4e4b5df5b4002ae3ada39862..283622b3657e0a5c0b1da9c4b234924d64c867bb 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -320,4 +320,12 @@ public class PalettedContainer implements PaletteResize { +@@ -283,6 +283,14 @@ public class PalettedContainer implements PaletteResize { + } + } + ++ // Paper start ++ public void forEachLocation(PalettedContainer.CountConsumer consumer) { ++ this.data.storage.forEach((int location, int data) -> { ++ consumer.accept(this.data.palette.valueFor(data), location); ++ }); ++ } ++ // Paper end ++ + @FunctionalInterface public interface CountConsumer { void accept(T object, int count); - } -+ -+ // Paper start -+ public void forEachLocation(PalettedContainer.CountConsumer datapaletteblock_a) { -+ this.storage.forEach((int location, int data) -> { -+ datapaletteblock_a.accept(this.palette.valueFor(data), location); -+ }); -+ } -+ // Paper end - } diff --git a/patches/unapplied/server/0782-Consolidate-flush-calls-for-entity-tracker-packets.patch b/patches/unapplied/server/0782-Consolidate-flush-calls-for-entity-tracker-packets.patch deleted file mode 100644 index 0e44c24f7b3..00000000000 --- a/patches/unapplied/server/0782-Consolidate-flush-calls-for-entity-tracker-packets.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Sat, 4 Apr 2020 17:00:20 -0700 -Subject: [PATCH] Consolidate flush calls for entity tracker packets - -Most server packets seem to be sent from here, so try to avoid -expensive flush calls from them. - -This change was motivated due to local testing: - -- My server spawn has 130 cows in it (for testing a prev. patch) -- Try to let 200 players join spawn - -Without this change, I could only get 20 players on before they -all started timing out due to the load put on the Netty I/O threads. - -With this change I could get all 200 on at 0ms ping. - -(one of the primary issues is that my CPU is kinda trash, and having -4 extra threads at 100% is just too much for it). - -So in general this patch should reduce Netty I/O thread load. - -diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 6589baa5680a154e47e7e28223e2214ca36790f3..4a3dbcfdacb809d162663c379c4e8151be522432 100644 ---- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java -+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -1070,7 +1070,24 @@ public class ServerChunkCache extends ChunkSource { - this.level.getProfiler().pop(); - } - -+ // Paper start - controlled flush for entity tracker packets -+ List disabledFlushes = new java.util.ArrayList<>(this.level.players.size()); -+ for (ServerPlayer player : this.level.players) { -+ net.minecraft.server.network.ServerGamePacketListenerImpl connection = player.connection; -+ if (connection != null) { -+ connection.connection.disableAutomaticFlush(); -+ disabledFlushes.add(connection.connection); -+ } -+ } -+ try { // Paper end - controlled flush for entity tracker packets - this.chunkMap.tick(); -+ // Paper start - controlled flush for entity tracker packets -+ } finally { -+ for (net.minecraft.network.Connection networkManager : disabledFlushes) { -+ networkManager.enableAutomaticFlush(); -+ } -+ } -+ // Paper end - controlled flush for entity tracker packets - } - - private void getFullChunk(long pos, Consumer chunkConsumer) {