diff options
author | Nassim Jahnke <[email protected]> | 2024-06-15 14:12:22 +0200 |
---|---|---|
committer | Nassim Jahnke <[email protected]> | 2024-06-15 14:12:22 +0200 |
commit | ee9b820fbebde78cf6462e5a5b530fcd5912ab78 (patch) | |
tree | d3366df2704bc8956fcdff43b5bbc495c279980c | |
parent | 097284d06be5a2456fa3123fbbb127904134a021 (diff) | |
download | Paper-ee9b820fbebde78cf6462e5a5b530fcd5912ab78.tar.gz Paper-ee9b820fbebde78cf6462e5a5b530fcd5912ab78.zip |
Update more optimization patches
-rw-r--r-- | patches/server/0992-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch (renamed from patches/unapplied/server/0996-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch) | 14 | ||||
-rw-r--r-- | patches/server/0994-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch (renamed from patches/unapplied/server/0997-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch) | 22 | ||||
-rw-r--r-- | patches/server/0995-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch (renamed from patches/unapplied/server/0998-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch) | 8 | ||||
-rw-r--r-- | patches/server/0996-Optimize-Network-Manager-and-add-advanced-packet-sup.patch (renamed from patches/unapplied/server/0999-Optimize-Network-Manager-and-add-advanced-packet-sup.patch) | 32 | ||||
-rw-r--r-- | patches/server/0997-Allow-Saving-of-Oversized-Chunks.patch (renamed from patches/unapplied/server/1000-Allow-Saving-of-Oversized-Chunks.patch) | 18 | ||||
-rw-r--r-- | patches/server/0998-Flat-bedrock-generator-settings.patch (renamed from patches/unapplied/server/1002-Flat-bedrock-generator-settings.patch) | 14 | ||||
-rw-r--r-- | patches/server/0999-Entity-Activation-Range-2.0.patch (renamed from patches/unapplied/server/1003-Entity-Activation-Range-2.0.patch) | 36 | ||||
-rw-r--r-- | patches/server/1000-Optional-per-player-mob-spawns.patch (renamed from patches/unapplied/server/1004-Optional-per-player-mob-spawns.patch) | 22 | ||||
-rw-r--r-- | patches/server/1001-Anti-Xray.patch (renamed from patches/unapplied/server/1005-Anti-Xray.patch) | 89 | ||||
-rw-r--r-- | patches/unapplied/server/0993-incremental-chunk-and-player-saving.patch (renamed from patches/unapplied/server/0995-incremental-chunk-and-player-saving.patch) | 28 |
10 files changed, 141 insertions, 142 deletions
diff --git a/patches/unapplied/server/0996-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch b/patches/server/0992-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch index 474f3d6165..2cdcbebb6f 100644 --- a/patches/unapplied/server/0996-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch +++ b/patches/server/0992-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch @@ -29,10 +29,10 @@ index 02367ef1371dde94ff6c4cd40bd32e800d6ccaaf..7b0fc7135bc107103dcaed6dc0707b18 this.x = x; this.y = y; diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index d3137c9e5cc42ef191ea233b0d37eafeffc6f82c..eb7df68d146f9e841bdf99fa2d85fb4b04e603ce 100644 +index 77c6613c39e3b266944e28cf2627483d9f32c511..b3a433786fabf6f2cfba2cdc8d21f6447191a310 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -339,7 +339,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -394,7 +394,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl // Paper end public boolean isInWorldBounds(BlockPos pos) { @@ -42,10 +42,10 @@ index d3137c9e5cc42ef191ea233b0d37eafeffc6f82c..eb7df68d146f9e841bdf99fa2d85fb4b public static boolean isInSpawnableBounds(BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index 1f8c72b6c7d8683d67880fa175843c73b3d39b78..383dc47c81b3f34e8166bce180a51a2ccbfaf6ca 100644 +index fb7bdf43fdc4d816b1c1f1f063bc170561c9544f..2822a9b010e6d45f9562950a94f1942784db9784 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -175,6 +175,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom +@@ -181,6 +181,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom return GameEventListenerRegistry.NOOP; } @@ -54,10 +54,10 @@ index 1f8c72b6c7d8683d67880fa175843c73b3d39b78..383dc47c81b3f34e8166bce180a51a2c public abstract BlockState setBlockState(BlockPos pos, BlockState state, boolean moved); diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -index aa5dee839d4c0dbc3c2abee9b501ec250c575cb3..6359d2d80f4c1360f8450bf6555ccfea3b69daa5 100644 +index 4af698930712389881601069a921f054c07935f2..d7d332d8ba3442887e80d2c3d7bddb9de2674c2d 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -@@ -99,6 +99,12 @@ public class ImposterProtoChunk extends ProtoChunk { +@@ -99,6 +99,12 @@ public class ImposterProtoChunk extends ProtoChunk implements ca.spottedleaf.moo public BlockState getBlockState(BlockPos pos) { return this.wrapped.getBlockState(pos); } @@ -71,7 +71,7 @@ index aa5dee839d4c0dbc3c2abee9b501ec250c575cb3..6359d2d80f4c1360f8450bf6555ccfea @Override public FluidState getFluidState(BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -index 576ae0cb138b265c8a3995de7b5ebc827d50949d..bfdee41d3095a869408abc89a6085556ff188d8d 100644 +index 207dc31afcf5ca5a59ab27ee263aa10f94a79559..082eae7032d5a8055a0f67b8a5583bbbf6fa9916 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java @@ -97,14 +97,18 @@ public class ProtoChunk extends ChunkAccess { diff --git a/patches/unapplied/server/0997-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch b/patches/server/0994-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch index ff16ec2e38..3a9a25773f 100644 --- a/patches/unapplied/server/0997-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch +++ b/patches/server/0994-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch @@ -13,10 +13,10 @@ custom renderers are in use, defaulting to the much simpler Vanilla system. Additionally, numerous issues to player position tracking on maps has been fixed. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 468fae61d9187ea127a0a6beccbe99d7c2f36dcd..4934c59f0ac6bd6dea67b716e4db07d295757f46 100644 +index 3a32c1bfc66b291d0caf903a6de8f054ccac74db..89f595e27fae384632ac51af5b69e9f3400b52eb 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2582,6 +2582,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2497,6 +2497,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. { if ( iter.next().player == entity ) { @@ -25,10 +25,10 @@ index 468fae61d9187ea127a0a6beccbe99d7c2f36dcd..4934c59f0ac6bd6dea67b716e4db07d2 } } diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 9952da86af1a1a050e7485675ca2d6fb83d02422..25595bef64199c4ddbe69c65fd149eec33e778ad 100644 +index ffb888262ba81073062f6f513c36108688d0f158..0526f4c701b4d945f26c5f382e9efac86cc568fa 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -789,6 +789,14 @@ public abstract class Player extends LivingEntity { +@@ -807,6 +807,14 @@ public abstract class Player extends LivingEntity { return null; } // CraftBukkit end @@ -44,10 +44,10 @@ index 9952da86af1a1a050e7485675ca2d6fb83d02422..25595bef64199c4ddbe69c65fd149eec return entityitem; } diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -index ad24a79e190d07c75d8e29e816fc398894771c2c..cf8ae635fce7ea66d4e1ab1dc05575f035fa95ef 100644 +index a43544704109f21bab230dd9bf0401e28f878582..17f33c83c6033564d6bf4fbd388b0b847c68adb3 100644 --- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -@@ -78,6 +78,7 @@ public class MapItemSavedData extends SavedData { +@@ -79,6 +79,7 @@ public class MapItemSavedData extends SavedData { public final Map<String, MapDecoration> decorations = Maps.newLinkedHashMap(); private final Map<String, MapFrame> frameMarkers = Maps.newHashMap(); private int trackedDecorationCount; @@ -55,7 +55,7 @@ index ad24a79e190d07c75d8e29e816fc398894771c2c..cf8ae635fce7ea66d4e1ab1dc05575f0 // CraftBukkit start public final CraftMapView mapView; -@@ -104,6 +105,7 @@ public class MapItemSavedData extends SavedData { +@@ -105,6 +106,7 @@ public class MapItemSavedData extends SavedData { // CraftBukkit start this.mapView = new CraftMapView(this); this.server = (CraftServer) org.bukkit.Bukkit.getServer(); @@ -63,7 +63,7 @@ index ad24a79e190d07c75d8e29e816fc398894771c2c..cf8ae635fce7ea66d4e1ab1dc05575f0 // CraftBukkit end } -@@ -178,6 +180,7 @@ public class MapItemSavedData extends SavedData { +@@ -179,6 +181,7 @@ public class MapItemSavedData extends SavedData { if (abyte.length == 16384) { worldmap.colors = abyte; } @@ -71,7 +71,7 @@ index ad24a79e190d07c75d8e29e816fc398894771c2c..cf8ae635fce7ea66d4e1ab1dc05575f0 RegistryOps<Tag> registryops = registryLookup.createSerializationContext(NbtOps.INSTANCE); List<MapBanner> list = (List) MapBanner.LIST_CODEC.parse(registryops, nbt.get("banners")).resultOrPartial((s) -> { -@@ -583,6 +586,21 @@ public class MapItemSavedData extends SavedData { +@@ -588,6 +591,21 @@ public class MapItemSavedData extends SavedData { public class HoldingPlayer { @@ -93,7 +93,7 @@ index ad24a79e190d07c75d8e29e816fc398894771c2c..cf8ae635fce7ea66d4e1ab1dc05575f0 public final Player player; private boolean dirtyData = true; private int minDirtyX; -@@ -616,7 +634,9 @@ public class MapItemSavedData extends SavedData { +@@ -621,7 +639,9 @@ public class MapItemSavedData extends SavedData { @Nullable Packet<?> nextUpdatePacket(MapId mapId) { MapItemSavedData.MapPatch worldmap_b; @@ -104,7 +104,7 @@ index ad24a79e190d07c75d8e29e816fc398894771c2c..cf8ae635fce7ea66d4e1ab1dc05575f0 if (this.dirtyData) { this.dirtyData = false; -@@ -632,6 +652,8 @@ public class MapItemSavedData extends SavedData { +@@ -637,6 +657,8 @@ public class MapItemSavedData extends SavedData { // CraftBukkit start java.util.Collection<MapDecoration> icons = new java.util.ArrayList<MapDecoration>(); diff --git a/patches/unapplied/server/0998-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch b/patches/server/0995-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch index 0eb75c8acd..0da16b007f 100644 --- a/patches/unapplied/server/0998-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch +++ b/patches/server/0995-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch @@ -26,10 +26,10 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 958b25e62b040943c346114ef19d56104ae0a844..56351d5c2b4ea2c1b335253153cedafdf058d9ae 100644 +index 23ce3f5fefceaeff5011f91f04ec8b200a503d21..5fa68b3a1f8814074ef46ba91c080f5a7ec668e4 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3720,7 +3720,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3743,7 +3743,7 @@ public abstract class LivingEntity extends Entity implements Attackable { Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ()); // Paper - diff on change - used in CraftLivingEntity#hasLineOfSight(Location) and CraftWorld#lineOfSightExists @@ -62,10 +62,10 @@ index bb8e962e63c7a2d931f9bd7f7c002aa35cfa5fd3..0fa131a6c98adb498fc8d534e0e39647 default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) { // Paper start - Add predicate for blocks when raytracing diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index eb7df68d146f9e841bdf99fa2d85fb4b04e603ce..12ab7097562d49dc466737378046707dc1b36b3b 100644 +index b3a433786fabf6f2cfba2cdc8d21f6447191a310..2d318964ef1f54940059b8d62bfc8f8ae87424e5 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -331,10 +331,87 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -386,10 +386,87 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl return null; } diff --git a/patches/unapplied/server/0999-Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/patches/server/0996-Optimize-Network-Manager-and-add-advanced-packet-sup.patch index 84396ba635..f51a3d8642 100644 --- a/patches/unapplied/server/0999-Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/patches/server/0996-Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -28,7 +28,7 @@ and then catch exceptions and close if they fire. Part of this commit was authored by: Spottedleaf, sandtechnology diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index f57679d88cd015caa8996d44b486da694df29521..f94458d4270042062b9ae18931cc8179ef1fb420 100644 +index 55848fa832d0f4d2d03f99df51e10c5fdfcd2ded..7dc7aeb1d94d26cf54bd4e4ab13972a3a60c1f98 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -93,7 +93,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -51,7 +51,7 @@ index f57679d88cd015caa8996d44b486da694df29521..f94458d4270042062b9ae18931cc8179 // Paper start - add utility methods public final net.minecraft.server.level.ServerPlayer getPlayer() { -@@ -415,15 +419,39 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { +@@ -440,15 +444,39 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { } public void send(Packet<?> packet, @Nullable PacketSendListener callbacks, boolean flush) { @@ -97,7 +97,7 @@ index f57679d88cd015caa8996d44b486da694df29521..f94458d4270042062b9ae18931cc8179 } public void runOnceConnected(Consumer<Connection> task) { -@@ -431,7 +459,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { +@@ -456,7 +484,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { this.flushQueue(); task.accept(this); } else { @@ -106,7 +106,7 @@ index f57679d88cd015caa8996d44b486da694df29521..f94458d4270042062b9ae18931cc8179 } } -@@ -449,6 +477,14 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { +@@ -474,6 +502,14 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { } private void doSendPacket(Packet<?> packet, @Nullable PacketSendListener callbacks, boolean flush) { @@ -121,7 +121,7 @@ index f57679d88cd015caa8996d44b486da694df29521..f94458d4270042062b9ae18931cc8179 ChannelFuture channelfuture = flush ? this.channel.writeAndFlush(packet) : this.channel.write(packet); if (callbacks != null) { -@@ -468,14 +504,24 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { +@@ -493,14 +529,24 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { }); } @@ -147,7 +147,7 @@ index f57679d88cd015caa8996d44b486da694df29521..f94458d4270042062b9ae18931cc8179 } } -@@ -491,20 +537,57 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { +@@ -516,20 +562,57 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { } @@ -212,15 +212,15 @@ index f57679d88cd015caa8996d44b486da694df29521..f94458d4270042062b9ae18931cc8179 private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper - Buffer joins to world private static int joinAttemptsThisTick; // Paper - Buffer joins to world -@@ -564,6 +647,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { - public void disconnect(Component disconnectReason) { +@@ -593,6 +676,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { + public void disconnect(DisconnectionDetails disconnectionInfo) { // Spigot Start this.preparing = false; + this.clearPacketQueue(); // Paper - Optimize network // Spigot End if (this.channel == null) { - this.delayedDisconnect = disconnectReason; -@@ -751,7 +835,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { + this.delayedDisconnect = disconnectionInfo; +@@ -780,7 +864,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { public void handleDisconnection() { if (this.channel != null && !this.channel.isOpen()) { if (this.disconnectionHandled) { @@ -229,16 +229,16 @@ index f57679d88cd015caa8996d44b486da694df29521..f94458d4270042062b9ae18931cc8179 } else { this.disconnectionHandled = true; PacketListener packetlistener = this.getPacketListener(); -@@ -764,7 +848,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { +@@ -793,7 +877,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { - packetlistener1.onDisconnect(ichatbasecomponent); + packetlistener1.onDisconnect(disconnectiondetails); } - this.pendingActions.clear(); // Free up packet queue. + this.clearPacketQueue(); // Paper - Optimize network // Paper start - Add PlayerConnectionCloseEvent final PacketListener packetListener = this.getPacketListener(); if (packetListener instanceof net.minecraft.server.network.ServerCommonPacketListenerImpl commonPacketListener) { -@@ -801,4 +885,93 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { +@@ -830,4 +914,93 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { public void setBandwidthLogger(LocalSampleLogger log) { this.bandwidthDebugMonitor = new BandwidthDebugMonitor(log); } @@ -333,10 +333,10 @@ index f57679d88cd015caa8996d44b486da694df29521..f94458d4270042062b9ae18931cc8179 + // Paper end - Optimize network } diff --git a/src/main/java/net/minecraft/network/protocol/Packet.java b/src/main/java/net/minecraft/network/protocol/Packet.java -index 4c776c591dd0a7b36945a6487fdfe86d1187b4af..5ee2ba1225fb7e4f02152b45adeb66f79ed1650d 100644 +index 82fc12ffbd1585b4a8d09a025914830af77b0f8d..c9d283b7fc9ede79dc6cbc39dfc9e7ae986a6a47 100644 --- a/src/main/java/net/minecraft/network/protocol/Packet.java +++ b/src/main/java/net/minecraft/network/protocol/Packet.java -@@ -22,4 +22,31 @@ public interface Packet<T extends PacketListener> { +@@ -35,4 +35,31 @@ public interface Packet<T extends PacketListener> { static <B extends ByteBuf, T extends Packet<?>> StreamCodec<B, T> codec(StreamMemberEncoder<B, T> encoder, StreamDecoder<B, T> decoder) { return StreamCodec.ofMember(encoder, decoder); } @@ -369,7 +369,7 @@ index 4c776c591dd0a7b36945a6487fdfe86d1187b4af..5ee2ba1225fb7e4f02152b45adeb66f7 + // Paper end } diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index 96355e1da8feb6687ea0069dda4a82fcd7e25e8a..a08d9aa6e420f691795df9b627a9cd5b5c0112c5 100644 +index 1f696644b958538e9f5d568a2e4bba69d74a191e..2929d9a2efa9669781b6773161db7c5f968c2544 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java @@ -63,10 +63,12 @@ public class ServerConnectionListener { diff --git a/patches/unapplied/server/1000-Allow-Saving-of-Oversized-Chunks.patch b/patches/server/0997-Allow-Saving-of-Oversized-Chunks.patch index c190834bbb..4eef25929e 100644 --- a/patches/unapplied/server/1000-Allow-Saving-of-Oversized-Chunks.patch +++ b/patches/server/0997-Allow-Saving-of-Oversized-Chunks.patch @@ -33,7 +33,7 @@ this fix, as the data will remain in the oversized file. Once the server returns to a jar with this fix, the data will be restored. diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index 307196b2a58d4f8db3e6e3c3517a8004d4908b13..f994f91dd4b4a0a6d540a5605af0b6623e229f84 100644 +index e858436bcf1b234d4bc6e6a117f5224d5c2d9f90..e761b63eebc1e76b2bb1cb887d83d0b63ad6ec90 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java @@ -18,10 +18,13 @@ import java.nio.file.LinkOption; @@ -50,7 +50,7 @@ index 307196b2a58d4f8db3e6e3c3517a8004d4908b13..f994f91dd4b4a0a6d540a5605af0b662 import net.minecraft.world.level.ChunkPos; import org.slf4j.Logger; -@@ -59,6 +62,7 @@ public class RegionFile implements AutoCloseable { +@@ -58,6 +61,7 @@ public class RegionFile implements AutoCloseable { this.usedSectors = new RegionBitmap(); this.info = storageKey; this.path = path; @@ -58,7 +58,7 @@ index 307196b2a58d4f8db3e6e3c3517a8004d4908b13..f994f91dd4b4a0a6d540a5605af0b662 this.version = compressionFormat; if (!Files.isDirectory(directory, new LinkOption[0])) { throw new IllegalArgumentException("Expected directory, got " + String.valueOf(directory.toAbsolutePath())); -@@ -453,6 +457,74 @@ public class RegionFile implements AutoCloseable { +@@ -443,6 +447,74 @@ public class RegionFile implements AutoCloseable { } public static final int MAX_CHUNK_SIZE = 500 * 1024 * 1024; // Paper - don't write garbage data to disk if writing serialization fails @@ -134,11 +134,11 @@ index 307196b2a58d4f8db3e6e3c3517a8004d4908b13..f994f91dd4b4a0a6d540a5605af0b662 private final ChunkPos pos; diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 3f6955be976064eb542b5c50a9d6d74457c1833c..c2838ae91b7f078369b63503df57a1eb5d2b0df5 100644 +index 18054304e08c8a6346c0135a0e6a68e77fe5c37c..0615fd82b71efb9a397de01615050e6d906c2844 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -@@ -123,6 +123,43 @@ public class RegionFileStorage implements AutoCloseable { - } +@@ -144,6 +144,43 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise + // Paper end - rewrite chunk system } + // Paper start @@ -181,8 +181,8 @@ index 3f6955be976064eb542b5c50a9d6d74457c1833c..c2838ae91b7f078369b63503df57a1eb @Nullable public CompoundTag read(ChunkPos pos) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing -@@ -134,6 +171,12 @@ public class RegionFileStorage implements AutoCloseable { - try { // Paper +@@ -154,6 +191,12 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise + // CraftBukkit end DataInputStream datainputstream = regionfile.getChunkDataInputStream(pos); + // Paper start @@ -194,7 +194,7 @@ index 3f6955be976064eb542b5c50a9d6d74457c1833c..c2838ae91b7f078369b63503df57a1eb CompoundTag nbttagcompound; label43: { -@@ -225,6 +268,7 @@ public class RegionFileStorage implements AutoCloseable { +@@ -242,6 +285,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise try { NbtIo.write(nbt, (DataOutput) dataoutputstream); diff --git a/patches/unapplied/server/1002-Flat-bedrock-generator-settings.patch b/patches/server/0998-Flat-bedrock-generator-settings.patch index b973a4d233..da68e7d65b 100644 --- a/patches/unapplied/server/1002-Flat-bedrock-generator-settings.patch +++ b/patches/server/0998-Flat-bedrock-generator-settings.patch @@ -20,7 +20,7 @@ Co-authored-by: Noah van der Aa <[email protected]> diff --git a/src/main/java/io/papermc/paper/world/worldgen/OptionallyFlatBedrockConditionSource.java b/src/main/java/io/papermc/paper/world/worldgen/OptionallyFlatBedrockConditionSource.java new file mode 100644 -index 0000000000000000000000000000000000000000..e0d73113c937ddbcf8144f88b15a8d3d080b90a0 +index 0000000000000000000000000000000000000000..b5580727eef106fa193e450038d1b20d8d396059 --- /dev/null +++ b/src/main/java/io/papermc/paper/world/worldgen/OptionallyFlatBedrockConditionSource.java @@ -0,0 +1,80 @@ @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..e0d73113c937ddbcf8144f88b15a8d3d + + private static final ResourceKey<MapCodec<? extends SurfaceRules.ConditionSource>> CODEC_RESOURCE_KEY = ResourceKey.create( + Registries.MATERIAL_CONDITION, -+ new ResourceLocation(ResourceLocation.PAPER_NAMESPACE, "optionally_flat_bedrock_condition_source") ++ ResourceLocation.fromNamespaceAndPath(ResourceLocation.PAPER_NAMESPACE, "optionally_flat_bedrock_condition_source") + ); + private static final KeyDispatchDataCodec<OptionallyFlatBedrockConditionSource> CODEC = KeyDispatchDataCodec.of(RecordCodecBuilder.mapCodec((instance) -> { + return instance.group( @@ -105,10 +105,10 @@ index 0000000000000000000000000000000000000000..e0d73113c937ddbcf8144f88b15a8d3d + } +} diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java -index a3a2097716430b30c9bac2581b9f67fe0c595bd2..6885a653bfe629c46bface19ff1eb666d74d4f1b 100644 +index 061c89b985dafc79c808dd5f0e296b9fbac2fdfc..8c2f9f549b5155b8d8fecbc22164b334805381e2 100644 --- a/src/main/java/net/minecraft/server/Bootstrap.java +++ b/src/main/java/net/minecraft/server/Bootstrap.java -@@ -77,6 +77,7 @@ public class Bootstrap { +@@ -76,6 +76,7 @@ public class Bootstrap { CauldronInteraction.bootStrap(); // Paper start BuiltInRegistries.bootStrap(() -> { @@ -117,10 +117,10 @@ index a3a2097716430b30c9bac2581b9f67fe0c595bd2..6885a653bfe629c46bface19ff1eb666 // Paper end CreativeModeTabs.validate(); diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -index dc765b92cc90f5f370254e68bbbdfa5add7935ce..8ce870a5341a61fbbaf42021ef7f7f615a6a3e09 100644 +index 996899cb18e6c29665b9de7a1cc97c9a4187924b..68be0d51aa64b5d917fb53dbbbdf8966d4f4abd8 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -@@ -207,7 +207,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { +@@ -206,7 +206,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { @Override public void buildSurface(WorldGenRegion region, StructureManager structures, RandomState noiseConfig, ChunkAccess chunk) { if (!SharedConstants.debugVoidTerrain(chunk.getPos())) { @@ -129,7 +129,7 @@ index dc765b92cc90f5f370254e68bbbdfa5add7935ce..8ce870a5341a61fbbaf42021ef7f7f61 this.buildSurface(chunk, worldgenerationcontext, noiseConfig, structures, region.getBiomeManager(), region.registryAccess().registryOrThrow(Registries.BIOME), Blender.of(region)); } -@@ -235,7 +235,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { +@@ -234,7 +234,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { return this.createNoiseChunk(ichunkaccess1, structureAccessor, Blender.of(chunkRegion), noiseConfig); }); Aquifer aquifer = noisechunk.aquifer(); diff --git a/patches/unapplied/server/1003-Entity-Activation-Range-2.0.patch b/patches/server/0999-Entity-Activation-Range-2.0.patch index 9502ae49bc..de7abb45fb 100644 --- a/patches/unapplied/server/1003-Entity-Activation-Range-2.0.patch +++ b/patches/server/0999-Entity-Activation-Range-2.0.patch @@ -17,7 +17,7 @@ Adds villagers as separate config public net.minecraft.world.entity.Entity isInsidePortal diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 4934c59f0ac6bd6dea67b716e4db07d295757f46..12245d90ccb4bce09966ab6b3def1e7e1564223b 100644 +index 89f595e27fae384632ac51af5b69e9f3400b52eb..b5cfd8994c201b2025597f334b3bc33ff4011409 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2,7 +2,6 @@ package net.minecraft.server.level; @@ -28,7 +28,7 @@ index 4934c59f0ac6bd6dea67b716e4db07d295757f46..12245d90ccb4bce09966ab6b3def1e7e import com.google.common.collect.Lists; import com.mojang.datafixers.DataFixer; import com.mojang.datafixers.util.Pair; -@@ -1228,17 +1227,17 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1164,17 +1163,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. ++TimingHistory.entityTicks; // Paper - timings // Spigot start co.aikar.timings.Timing timer; // Paper @@ -50,7 +50,7 @@ index 4934c59f0ac6bd6dea67b716e4db07d295757f46..12245d90ccb4bce09966ab6b3def1e7e try { // Paper end - timings entity.setOldPosAndRot(); -@@ -1249,9 +1248,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1185,9 +1184,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); }); gameprofilerfiller.incrementCounter("tickNonPassenger"); @@ -64,7 +64,7 @@ index 4934c59f0ac6bd6dea67b716e4db07d295757f46..12245d90ccb4bce09966ab6b3def1e7e Iterator iterator = entity.getPassengers().iterator(); while (iterator.hasNext()) { -@@ -1259,13 +1262,18 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1195,13 +1198,18 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. this.tickPassenger(entity, entity1); } @@ -84,7 +84,7 @@ index 4934c59f0ac6bd6dea67b716e4db07d295757f46..12245d90ccb4bce09966ab6b3def1e7e passenger.setOldPosAndRot(); ++passenger.tickCount; ProfilerFiller gameprofilerfiller = this.getProfiler(); -@@ -1274,8 +1282,17 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1210,8 +1218,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString(); }); gameprofilerfiller.incrementCounter("tickPassenger"); @@ -102,7 +102,7 @@ index 4934c59f0ac6bd6dea67b716e4db07d295757f46..12245d90ccb4bce09966ab6b3def1e7e gameprofilerfiller.pop(); Iterator iterator = passenger.getPassengers().iterator(); -@@ -1285,6 +1302,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1221,6 +1238,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. this.tickPassenger(passenger, entity2); } @@ -111,10 +111,10 @@ index 4934c59f0ac6bd6dea67b716e4db07d295757f46..12245d90ccb4bce09966ab6b3def1e7e } else { passenger.stopRiding(); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index ff497f0e80889508dd8c183b48cd33bc7831ba6c..6f48af629392f4426e50f752424fc9f58985688a 100644 +index bf60b1aba3019996f53a3cf051d2a603cb7b8404..14db8510af7465eb663501008ca35f8ec63bfe30 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -413,6 +413,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -419,6 +419,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // Spigot end protected int numCollisions = 0; // Paper - Cap entity collisions public boolean fromNetherPortal; // Paper - Add option to nerf pigmen from nether portals @@ -123,7 +123,7 @@ index ff497f0e80889508dd8c183b48cd33bc7831ba6c..6f48af629392f4426e50f752424fc9f5 public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one // Paper start - Entity origin API @javax.annotation.Nullable -@@ -1044,6 +1046,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1039,6 +1041,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } else { this.wasOnFire = this.isOnFire(); if (movementType == MoverType.PISTON) { @@ -132,7 +132,7 @@ index ff497f0e80889508dd8c183b48cd33bc7831ba6c..6f48af629392f4426e50f752424fc9f5 movement = this.limitPistonMovement(movement); if (movement.equals(Vec3.ZERO)) { return; -@@ -1056,6 +1060,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1051,6 +1055,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.stuckSpeedMultiplier = Vec3.ZERO; this.setDeltaMovement(Vec3.ZERO); } @@ -147,10 +147,10 @@ index ff497f0e80889508dd8c183b48cd33bc7831ba6c..6f48af629392f4426e50f752424fc9f5 movement = this.maybeBackOffFromEdge(movement, movementType); Vec3 vec3d1 = this.collide(movement); diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 748a6d81f409cf91a7aa2c88ded04f1d428cf0f6..8b612b772ca87c852d0b108c2afd6785c261c9b9 100644 +index 5bac748649f43d74b13e7c0b4d355e67654ad59e..7b93c6a04cca2ac31d137f06ef83bb08559b10bf 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -237,6 +237,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti +@@ -232,6 +232,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab return this.lookControl; } @@ -171,7 +171,7 @@ index 748a6d81f409cf91a7aa2c88ded04f1d428cf0f6..8b612b772ca87c852d0b108c2afd6785 Entity entity = this.getControlledVehicle(); diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java -index cdd07093342521ff9944bf7a342bbf142ba3f0b7..645414720db0231a19c88f681608eb08200b8782 100644 +index bd8d56aa5a3557e7a2aa1dd066b27c2054d1eef8..9c995085357eff3c3b6c9c23129c2be6ea51e371 100644 --- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java +++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java @@ -23,6 +23,7 @@ public abstract class PathfinderMob extends Mob { @@ -243,7 +243,7 @@ index 6d8ea05e5e86e9f6359b560043bb55a10784e952..aee0147649d458b87d92496eda0c1723 } } diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index 1e8579c994098fb18d9725e3f1604a582be4162f..a7930f9875aa4aca997caaead46ecdc21e5e11d7 100644 +index 393588661c41b490ee6bce2f687962f7ddeff7d4..7e1871401ec5e3e9a85232053490259f132aec0a 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java @@ -228,17 +228,34 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @@ -340,10 +340,10 @@ index 0b7f52021441d633c37543e8ae485e81c292b747..d7f8464bf3eed0e42a5fc7f14a5b243d + } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 12ab7097562d49dc466737378046707dc1b36b3b..2d829eb4d39aec82c23a55f30f22a9a5f7003d27 100644 +index 2d318964ef1f54940059b8d62bfc8f8ae87424e5..23af11c22713ac3e005fd89b4f3b3873bf74e751 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -154,6 +154,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -156,6 +156,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl public Map<BlockPos, BlockEntity> capturedTileEntities = new java.util.LinkedHashMap<>(); // Paper - Retain block place order when capturing blockstates public List<ItemEntity> captureDrops; public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<SpawnCategory> ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>(); @@ -372,7 +372,7 @@ index d7b963571c900f0f68005d6954bcd9ef1d9e0b7c..b35f476e26a020cf75e53a5eb488717d } } diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 9fb9fa62c32445ac3c3883a6433759c86dcfc428..3283ed99c35ffed6805567705e0518d9f84feedc 100644 +index 9fb9fa62c32445ac3c3883a6433759c86dcfc428..bf2d18f74b0f0da7c3c30310c74224a1c0853564 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -1,33 +1,43 @@ @@ -705,7 +705,7 @@ index 9fb9fa62c32445ac3c3883a6433759c86dcfc428..3283ed99c35ffed6805567705e0518d9 } + // Paper start - special case always immunities + // immunize brand new entities, dead entities, and portal scenarios -+ if (entity.defaultActivationState || entity.tickCount < 20*10 || !entity.isAlive() || entity.isInsidePortal || entity.portalCooldown > 0) { ++ if (entity.defaultActivationState || entity.tickCount < 20*10 || !entity.isAlive() || (entity.portalProcess != null && !entity.portalProcess.hasExpired()) || entity.portalCooldown > 0) { + return true; + } + // immunize leashed entities diff --git a/patches/unapplied/server/1004-Optional-per-player-mob-spawns.patch b/patches/server/1000-Optional-per-player-mob-spawns.patch index 2be04ece83..c906a945c5 100644 --- a/patches/unapplied/server/1004-Optional-per-player-mob-spawns.patch +++ b/patches/server/1000-Optional-per-player-mob-spawns.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Optional per player mob spawns diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 1d2d4d38ff3414896d07f7f4e40d0edb9a8c3993..56f855ed9dbbb9a7025bef6f9e98a8cdcf2ad4fc 100644 +index b849e0cf15f894aa87b1bb397d85b887b8fb816e..7bebf252887ecc7594b1ce21471fb6ba7aa2c051 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -291,9 +291,28 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - }); +@@ -283,8 +283,26 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + return this.nearbyPlayers; } + // Paper start - Optional per player mob spawns @@ -17,7 +17,7 @@ index 1d2d4d38ff3414896d07f7f4e40d0edb9a8c3993..56f855ed9dbbb9a7025bef6f9e98a8cd + if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { + return; + } -+ int index = entity.getType().getCategory().ordinal(); ++ final int index = entity.getType().getCategory().ordinal(); + + final com.destroystokyo.paper.util.maplist.ReferenceList<ServerPlayer> inRange = + this.getNearbyPlayers().getPlayers(entity.chunkPosition(), io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.TICK_VIEW_DISTANCE); @@ -29,20 +29,18 @@ index 1d2d4d38ff3414896d07f7f4e40d0edb9a8c3993..56f855ed9dbbb9a7025bef6f9e98a8cd + ++((ServerPlayer)backingSet[i]).mobCounts[index]; + } + } -+ public int getMobCountNear(final ServerPlayer player, final net.minecraft.world.entity.MobCategory mobCategory) { - return -1; + return player.mobCounts[mobCategory.ordinal()]; ++ // Paper end - Optional per player mob spawns } -+ // Paper end - Optional per player mob spawns + // Paper end - private static double euclideanDistanceSquared(ChunkPos pos, Entity entity) { - double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index e8432337df6b9ea67285f8420b4fa5fe20d657b6..41be61c8d239515975b5a73ecf448734710abd23 100644 +index c742667e6b6d94dde7b0e27737c1e71dc0cfcbdc..ce056e5d17694611236ce604d4d989173a87d399 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -516,7 +516,19 @@ public class ServerChunkCache extends ChunkSource { +@@ -512,7 +512,19 @@ public class ServerChunkCache extends ChunkSource { gameprofilerfiller.popPush("naturalSpawnCount"); this.level.timings.countNaturalMobs.startTiming(); // Paper - timings int k = this.distanceManager.getNaturalSpawnChunkCount(); @@ -64,10 +62,10 @@ index e8432337df6b9ea67285f8420b4fa5fe20d657b6..41be61c8d239515975b5a73ecf448734 this.lastSpawnState = spawnercreature_d; diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 30bd4ff4e9d4160b547681603127a5aa13a7ebbc..2a7d050c785e6cba36ec3df3127c2fc3b7932db6 100644 +index 92c9304d0ea1286766243e679fea357f7e690402..62569beec171e1398d18197994092c205074c025 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -272,6 +272,10 @@ public class ServerPlayer extends Player { +@@ -276,6 +276,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple public boolean queueHealthUpdatePacket; public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; // Paper end - cancellable death event diff --git a/patches/unapplied/server/1005-Anti-Xray.patch b/patches/server/1001-Anti-Xray.patch index 813b220c68..ee9b38a427 100644 --- a/patches/unapplied/server/1005-Anti-Xray.patch +++ b/patches/server/1001-Anti-Xray.patch @@ -1017,7 +1017,7 @@ index ccc8c32c27c19cb0f0b581ca6693cfa737cb1de1..3c1cad5c2b34047cec44734ba4e8348c } diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java -index ec1cb034d840633240f2b379b09f7d2f1c8971a5..05e29a703f022b5047262bae8caef33d9dfb9035 100644 +index cf8fd671490863e126c059157e1ca234e6509d9f..1e75cd33c32f0e2923681da64b9b73b279933c1b 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java @@ -28,7 +28,10 @@ public class ClientboundLevelChunkPacketData { @@ -1104,10 +1104,10 @@ index 183b2191fa1c1b27adedf39593e1b5a223fb1279..8ead66c134688b11dca15f6509147e72 private ClientboundLevelChunkWithLightPacket(RegistryFriendlyByteBuf buf) { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 12245d90ccb4bce09966ab6b3def1e7e1564223b..1ec7865e2e2bd23607e9b3041d77bd4badf39a4a 100644 +index b5cfd8994c201b2025597f334b3bc33ff4011409..3968227d413d4acf68292ce9fba7e3a8f5ee0694 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -575,7 +575,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -502,7 +502,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. // Holder holder = worlddimension.type(); // CraftBukkit - decompile error // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error @@ -1117,10 +1117,10 @@ index 12245d90ccb4bce09966ab6b3def1e7e1564223b..1ec7865e2e2bd23607e9b3041d77bd4b this.convertable = convertable_conversionsession; this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile()); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index c5f3ba82b3ded415ff4bffc9eabf9526695e1ba7..56de0da254c8f027fa23afc261be3b5e5ffdde93 100644 +index 415d9802ae4dd75b44055b8faf19672fa50c585f..e9dcdb1e09e84a9b451034ff4bdfa6eae2dd1c04 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -48,7 +48,7 @@ import org.bukkit.event.player.PlayerInteractEvent; +@@ -50,7 +50,7 @@ import org.bukkit.event.player.PlayerInteractEvent; public class ServerPlayerGameMode { private static final Logger LOGGER = LogUtils.getLogger(); @@ -1129,7 +1129,7 @@ index c5f3ba82b3ded415ff4bffc9eabf9526695e1ba7..56de0da254c8f027fa23afc261be3b5e protected final ServerPlayer player; private GameType gameModeForPlayer; @Nullable -@@ -329,6 +329,8 @@ public class ServerPlayerGameMode { +@@ -334,6 +334,8 @@ public class ServerPlayerGameMode { } } @@ -1139,13 +1139,13 @@ index c5f3ba82b3ded415ff4bffc9eabf9526695e1ba7..56de0da254c8f027fa23afc261be3b5e public void destroyAndAck(BlockPos pos, int sequence, String reason) { diff --git a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -index 27d0f1ed58948039004f8f1eba2f7f9609fdeec0..442bb60eb35002e54dcd6a893aca4a4584a8e017 100644 +index 32634e45ac8433648e49e47e20081e15ad41ff15..dafa2cf7d3c49fc5bdcd68d2a952812774a1dfe4 100644 --- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java +++ b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -@@ -87,7 +87,10 @@ public class PlayerChunkSender { +@@ -79,7 +79,10 @@ public class PlayerChunkSender { + } - public static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { // Paper - rewrite chunk loader - public - handler.player.serverLevel().chunkSource.chunkMap.getVisibleChunkIfPresent(chunk.getPos().toLong()).addPlayer(handler.player); + public static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { // Paper - public - handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null)); + // Paper start - Anti-Xray + final boolean shouldModify = world.chunkPacketBlockController.shouldModify(handler.player, chunk); @@ -1155,10 +1155,10 @@ index 27d0f1ed58948039004f8f1eba2f7f9609fdeec0..442bb60eb35002e54dcd6a893aca4a45 if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) { new io.papermc.paper.event.packet.PlayerChunkLoadEvent(new org.bukkit.craftbukkit.CraftChunk(chunk), handler.getPlayer().getBukkitEntity()).callEvent(); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 57164b266d23715c224a85660531220477d4dda8..8f1a2de2a5542929f8a2fdd4d38de141eda985b2 100644 +index 883fa950284da3baf2de7a289dfcd7c0a2dfd3f9..dc4af41c0c26689dffb4bfd299a27f2ee6800cb5 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -420,7 +420,7 @@ public abstract class PlayerList { +@@ -414,7 +414,7 @@ public abstract class PlayerList { .getHolderOrThrow(net.minecraft.world.level.biome.Biomes.PLAINS); player.connection.send(new net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket( new net.minecraft.world.level.chunk.EmptyLevelChunk(worldserver1, player.chunkPosition(), plains), @@ -1168,10 +1168,10 @@ index 57164b266d23715c224a85660531220477d4dda8..8f1a2de2a5542929f8a2fdd4d38de141 } // Paper end - Send empty chunk diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 2d829eb4d39aec82c23a55f30f22a9a5f7003d27..ff8d947c5a498e097a4c480a5dc9af71b0be5ee9 100644 +index 23af11c22713ac3e005fd89b4f3b3873bf74e751..9f2fad2f4b1e4e7eda645d53eb76ed04fc0b3451 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -169,6 +169,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -171,6 +171,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl } // Paper end - add paper world config @@ -1179,24 +1179,24 @@ index 2d829eb4d39aec82c23a55f30f22a9a5f7003d27..ff8d947c5a498e097a4c480a5dc9af71 public final co.aikar.timings.WorldTimingsHandler timings; // Paper public static BlockPos lastPhysicsProblem; // Spigot private org.spigotmc.TickLimiter entityLimiter; -@@ -203,7 +204,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - - public abstract ResourceKey<LevelStem> getTypeKey(); +@@ -257,7 +258,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + } + // Paper end - rewrite chunk system - protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator) { // Paper - create paper world config -+ protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config; Async-Anti-Xray: Pass executor ++ protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config & Anti-Xray this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config this.generator = gen; -@@ -285,6 +286,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings +@@ -340,6 +341,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime); + this.entityLookup = new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.dfl.DefaultEntityLookup(this); // Paper - rewrite chunk system + this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray } // Paper start - Cancel hit for vanished players -@@ -560,6 +562,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -619,6 +621,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl // CraftBukkit end BlockState iblockdata1 = chunk.setBlockState(pos, state, (flags & 64) != 0, (flags & 1024) == 0); // CraftBukkit custom NO_PLACE flag @@ -1205,10 +1205,10 @@ index 2d829eb4d39aec82c23a55f30f22a9a5f7003d27..ff8d947c5a498e097a4c480a5dc9af71 if (iblockdata1 == null) { // CraftBukkit start - remove blockstate if failed (or the same) diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index 383dc47c81b3f34e8166bce180a51a2ccbfaf6ca..1aac95b03a9e2e37c24f2a30bcb259c1424e1c78 100644 +index 2822a9b010e6d45f9562950a94f1942784db9784..97f8ef86a0e398b7e4aa3445d5e413addbe3a9e3 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -155,17 +155,17 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom +@@ -155,7 +155,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom } } @@ -1216,24 +1216,25 @@ index 383dc47c81b3f34e8166bce180a51a2ccbfaf6ca..1aac95b03a9e2e37c24f2a30bcb259c1 + this.replaceMissingSections(biomeRegistry, this.sections); // Paper - Anti-Xray - make it a non-static method // CraftBukkit start this.biomeRegistry = biomeRegistry; - } + // Paper start - rewrite chunk system +@@ -168,10 +168,10 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom public final Registry<Biome> biomeRegistry; // CraftBukkit end - private static void replaceMissingSections(Registry<Biome> biomeRegistry, LevelChunkSection[] sectionArray) { -+ private void replaceMissingSections(Registry<Biome> biomeRegistry, LevelChunkSection[] sectionArray) { // Paper - Anti-Xray - static -> non-static ++ private void replaceMissingSections(Registry<Biome> biomeRegistry, LevelChunkSection[] sectionArray) { // Paper - Anti-Xray - make it a non-static method for (int i = 0; i < sectionArray.length; ++i) { if (sectionArray[i] == null) { - sectionArray[i] = new LevelChunkSection(biomeRegistry); -+ sectionArray[i] = new LevelChunkSection(biomeRegistry, this.levelHeightAccessor instanceof net.minecraft.world.level.Level ? (net.minecraft.world.level.Level) this.levelHeightAccessor : null, this.chunkPos, this.levelHeightAccessor.getSectionYFromSectionIndex(i)); // Paper start - Anti-Xray - Add parameters ++ sectionArray[i] = new LevelChunkSection(biomeRegistry, this.levelHeightAccessor instanceof net.minecraft.world.level.Level ? (net.minecraft.world.level.Level) this.levelHeightAccessor : null, this.chunkPos, this.levelHeightAccessor.getSectionYFromSectionIndex(i)); // Paper - Anti-Xray - Add parameters } } diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 5d94aee1303d9eca5f1fa9a2e033ad0d12909635..424c4613e202c6ba50fa0de65d2526d400a8e299 100644 +index 3be8f35ece18d4cffe8b23ecfeeff359e0b36e3e..d869607853ad27032df072c1f1d74a74e4911baf 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -93,7 +93,7 @@ public class LevelChunk extends ChunkAccess { +@@ -91,7 +91,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p } public LevelChunk(Level world, ChunkPos pos, UpgradeData upgradeData, LevelChunkTicks<Block> blockTickScheduler, LevelChunkTicks<Fluid> fluidTickScheduler, long inhabitedTime, @Nullable LevelChunkSection[] sectionArrayInitializer, @Nullable LevelChunk.PostLoadProcessor entityLoader, @Nullable BlendingData blendingData) { @@ -1509,7 +1510,7 @@ index 9a2bf744abd8916d492e901be889223591bac3fd..1dd415c96d17eff8e7555c33d3c52e57 int getSerializedSize(); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 5f85d8d82212f9a8133304dc05bf2cd39da1f9e7..ace99d55c8343fa1907545f47a03f069844b801d 100644 +index 977bebe8657abc5cb84ede8276d6781cde20e847..6d461849da76894244e6212a75da0c6e4fb459c3 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java @@ -73,7 +73,7 @@ import org.slf4j.Logger; @@ -1521,7 +1522,7 @@ index 5f85d8d82212f9a8133304dc05bf2cd39da1f9e7..ace99d55c8343fa1907545f47a03f069 private static final Logger LOGGER = LogUtils.getLogger(); private static final String TAG_UPGRADE_DATA = "UpgradeData"; private static final String BLOCK_TICKS_TAG = "block_ticks"; -@@ -172,13 +172,17 @@ public class ChunkSerializer { +@@ -141,13 +141,17 @@ public class ChunkSerializer { if (k >= 0 && k < achunksection.length) { PalettedContainer datapaletteblock; @@ -1541,7 +1542,7 @@ index 5f85d8d82212f9a8133304dc05bf2cd39da1f9e7..ace99d55c8343fa1907545f47a03f069 } PalettedContainer object; // CraftBukkit - read/write -@@ -188,7 +192,7 @@ public class ChunkSerializer { +@@ -157,7 +161,7 @@ public class ChunkSerializer { ChunkSerializer.logErrors(chunkPos, b0, s); }).getOrThrow(ChunkSerializer.ChunkReadException::new); } else { @@ -1550,7 +1551,7 @@ index 5f85d8d82212f9a8133304dc05bf2cd39da1f9e7..ace99d55c8343fa1907545f47a03f069 } LevelChunkSection chunksection = new LevelChunkSection(datapaletteblock, (PalettedContainer) object); // CraftBukkit - read/write -@@ -424,7 +428,7 @@ public class ChunkSerializer { +@@ -339,7 +343,7 @@ public class ChunkSerializer { // CraftBukkit start - read/write private static Codec<PalettedContainer<Holder<Biome>>> makeBiomeCodecRW(Registry<Biome> iregistry) { @@ -1560,7 +1561,7 @@ index 5f85d8d82212f9a8133304dc05bf2cd39da1f9e7..ace99d55c8343fa1907545f47a03f069 // CraftBukkit end diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index bb22473df13f68ac3b45a9c000d1de7260e07792..92f1ea81b5e90529905d9c508aca18c31443ff6a 100644 +index cce2fed2d4e9d6147ea1854321012c6950eb05cc..2d5c88b80c983eb067ef366c3d9344826fbb0938 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -56,7 +56,7 @@ public class CraftChunk implements Chunk { @@ -1573,10 +1574,10 @@ index bb22473df13f68ac3b45a9c000d1de7260e07792..92f1ea81b5e90529905d9c508aca18c3 private static final byte[] EMPTY_LIGHT = new byte[2048]; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 0e30a227948464979e12c991b10bd00cf7320399..3eea023d24c8e1b991f548632564508bfc565d8a 100644 +index 05e44a1448f30ceb8cecba2bed76f51aac5543f9..caf6ff33b42472d30f28629470e12889f50490cc 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2678,7 +2678,7 @@ public final class CraftServer implements Server { +@@ -2677,7 +2677,7 @@ public final class CraftServer implements Server { public ChunkGenerator.ChunkData createChunkData(World world) { Preconditions.checkArgument(world != null, "World cannot be null"); ServerLevel handle = ((CraftWorld) world).getHandle(); @@ -1584,18 +1585,18 @@ index 0e30a227948464979e12c991b10bd00cf7320399..3eea023d24c8e1b991f548632564508b + return new OldCraftChunkData(world.getMinHeight(), world.getMaxHeight(), handle.registryAccess().registryOrThrow(Registries.BIOME), world); // Paper - Anti-Xray - Add parameters } - // Paper start - Allow delegation to vanilla chunk gen + @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 8f50d893f8f9dea306756b640abd2373ee028a86..6303760f10af17f1da1d92d6c4dc7dd6f5778f94 100644 +index cdc704364cf339084537d089e654f6078f8be783..fe9e8d1d4ae1f7a4e8f4cf5688004fc969422b3c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -541,11 +541,16 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -465,11 +465,16 @@ public class CraftWorld extends CraftRegionAccessor implements World { List<ServerPlayer> playersInRange = playerChunk.playerProvider.getPlayers(playerChunk.getPos(), false); - if (playersInRange.isEmpty()) return true; // Paper - rewrite player chunk loader + if (playersInRange.isEmpty()) return true; // Paper - chunk system - ClientboundLevelChunkWithLightPacket refreshPacket = new ClientboundLevelChunkWithLightPacket(chunk, this.world.getLightEngine(), null, null); -+ // Paper start - Anti-Xray - Bypass -+ Map<Object, ClientboundLevelChunkWithLightPacket> refreshPackets = new HashMap<>(); ++ // Paper start - Anti-Xray bypass ++ final Map<Object, ClientboundLevelChunkWithLightPacket> refreshPackets = new HashMap<>(); for (ServerPlayer player : playersInRange) { if (player.connection == null) continue; @@ -1604,12 +1605,12 @@ index 8f50d893f8f9dea306756b640abd2373ee028a86..6303760f10af17f1da1d92d6c4dc7dd6 + player.connection.send(refreshPackets.computeIfAbsent(shouldModify, s -> { // Use connection to prevent creating firing event + return new ClientboundLevelChunkWithLightPacket(chunk, this.world.getLightEngine(), null, null, (Boolean) s); + })); -+ // Paper end ++ // Paper end - Anti-Xray bypass } - // Paper - rewrite player chunk loader + // Paper - chunk system diff --git a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java -index 9b640705f2c810160aa7fea5006429ec41d0c858..44a010590e830fd238cf6fdda443e28b72022e66 100644 +index e7f7a246e9c03e676dadfee59de87b8b2ac55ba3..03eb35d5c67f125c44cf46595c93d124ac7892b8 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java @@ -27,8 +27,13 @@ public final class OldCraftChunkData implements ChunkGenerator.ChunkData { diff --git a/patches/unapplied/server/0995-incremental-chunk-and-player-saving.patch b/patches/unapplied/server/0993-incremental-chunk-and-player-saving.patch index 6336814f6d..d15ad737e4 100644 --- a/patches/unapplied/server/0995-incremental-chunk-and-player-saving.patch +++ b/patches/unapplied/server/0993-incremental-chunk-and-player-saving.patch @@ -5,10 +5,10 @@ Subject: [PATCH] incremental chunk and player saving diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 2e4f20ba5f6f61b797f1eef267302fa3314f94a5..02fbf3c44a46f4871deeb42a2678697d23235b2e 100644 +index cd69971065b13353353eca55f6e145949390de11..58c6a6d39377554dcd47910dfdf3046d385cdf6f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -913,7 +913,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa +@@ -926,7 +926,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa try { this.isSaving = true; @@ -17,7 +17,7 @@ index 2e4f20ba5f6f61b797f1eef267302fa3314f94a5..02fbf3c44a46f4871deeb42a2678697d flag3 = this.saveAllChunks(suppressLogs, flush, force); } finally { this.isSaving = false; -@@ -1445,16 +1445,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa +@@ -1490,16 +1490,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa } --this.ticksUntilAutosave; @@ -56,10 +56,10 @@ index 2e4f20ba5f6f61b797f1eef267302fa3314f94a5..02fbf3c44a46f4871deeb42a2678697d // Paper start - move executeAll() into full server tick timing try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 802e9d266c01eaf8a83e78fe8dbe881e22e8b4d6..e8432337df6b9ea67285f8420b4fa5fe20d657b6 100644 +index ade744dd17431cc671de1322d7f58b54039fe1c9..c742667e6b6d94dde7b0e27737c1e71dc0cfcbdc 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -430,6 +430,15 @@ public class ServerChunkCache extends ChunkSource { +@@ -427,6 +427,15 @@ public class ServerChunkCache extends ChunkSource { } // Paper - Timings } @@ -76,10 +76,10 @@ index 802e9d266c01eaf8a83e78fe8dbe881e22e8b4d6..e8432337df6b9ea67285f8420b4fa5fe public void close() throws IOException { // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 0ccdc8d135dd3edb410fbc1d248c20a4a45b37fa..468fae61d9187ea127a0a6beccbe99d7c2f36dcd 100644 +index ec8eec86876221686f152bc5b25304cc59791cac..3a32c1bfc66b291d0caf903a6de8f054ccac74db 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1296,6 +1296,37 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1232,6 +1232,37 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. return !this.server.isUnderSpawnProtection(this, pos, player) && this.getWorldBorder().isWithinBounds(pos); } @@ -115,14 +115,14 @@ index 0ccdc8d135dd3edb410fbc1d248c20a4a45b37fa..468fae61d9187ea127a0a6beccbe99d7 + // Paper end - Incremental chunk and player saving + public void save(@Nullable ProgressListener progressListener, boolean flush, boolean savingDisabled) { - // Paper start - rewrite chunk system - add close param + // Paper start - add close param this.save(progressListener, flush, savingDisabled, false); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index e2b72b07888e84fb4472920932b3feedbd4829b9..30bd4ff4e9d4160b547681603127a5aa13a7ebbc 100644 +index 6b9354e3ac064daa3101e71d8e54e883f628f70c..92c9304d0ea1286766243e679fea357f7e690402 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -199,6 +199,7 @@ import org.bukkit.inventory.MainHand; - public class ServerPlayer extends Player { +@@ -202,6 +202,7 @@ import org.bukkit.inventory.MainHand; + public class ServerPlayer extends net.minecraft.world.entity.player.Player implements ca.spottedleaf.moonrise.patches.chunk_system.player.ChunkSystemServerPlayer { // Paper - rewrite chunk system private static final Logger LOGGER = LogUtils.getLogger(); + public long lastSave = MinecraftServer.currentTick; // Paper - Incremental chunk and player saving @@ -130,10 +130,10 @@ index e2b72b07888e84fb4472920932b3feedbd4829b9..30bd4ff4e9d4160b547681603127a5aa private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; private static final int FLY_STAT_RECORDING_SPEED = 25; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index c4b4e5f5c9366b241686e881cda34568a57b4877..57164b266d23715c224a85660531220477d4dda8 100644 +index 9b1a6d8351fb473eec75a2fd08fb892b770e3586..883fa950284da3baf2de7a289dfcd7c0a2dfd3f9 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -575,6 +575,7 @@ public abstract class PlayerList { +@@ -569,6 +569,7 @@ public abstract class PlayerList { protected void save(ServerPlayer player) { if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit @@ -141,7 +141,7 @@ index c4b4e5f5c9366b241686e881cda34568a57b4877..57164b266d23715c224a856605312204 this.playerIo.save(player); ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit -@@ -1227,10 +1228,22 @@ public abstract class PlayerList { +@@ -1181,10 +1182,22 @@ public abstract class PlayerList { } public void saveAll() { |