diff --git a/patches/removed/1.19.2-legacy-chunksystem/0019-Asynchronous-chunk-IO-and-loading.patch b/patches/removed/1.19.2-legacy-chunksystem/0019-Asynchronous-chunk-IO-and-loading.patch index f6e909b84e..0f9c62fcb5 100644 --- a/patches/removed/1.19.2-legacy-chunksystem/0019-Asynchronous-chunk-IO-and-loading.patch +++ b/patches/removed/1.19.2-legacy-chunksystem/0019-Asynchronous-chunk-IO-and-loading.patch @@ -2777,7 +2777,7 @@ index 4e7db441f68019d6e5d3359605b76bc4b258e87e..22c095539425a6667b8e7f5c5f0a8ff2 + // Paper start + String str = packet.getCommand(); int index = -1; + if (str.length() > 64 && ((index = str.indexOf(' ')) == -1 || index >= 64)) { -+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper ++ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam"))); // Paper + return; + } + // Paper end diff --git a/patches/server/0018-Rewrite-chunk-system.patch b/patches/server/0018-Rewrite-chunk-system.patch index a5b05ebf02..9fe74587e1 100644 --- a/patches/server/0018-Rewrite-chunk-system.patch +++ b/patches/server/0018-Rewrite-chunk-system.patch @@ -20494,7 +20494,7 @@ index c509a1318bcef38fd4927e38b6ee9846853e2d15..5de5209e04d631bd6a50e28e8d3abebf this.desiredChunksPerTick = Double.isNaN((double)desiredBatchSize) ? 0.01F : Mth.clamp(desiredBatchSize, 0.01F, 64.0F); if (this.unacknowledgedBatches == 0) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ce7caf08865df9ff032ba6c42308ea3ce4de6226..a8e8c90718a7562fd75fe66e76dbc0f8af11db35 100644 +index ce7caf08865df9ff032ba6c42308ea3ce4de6226..e8e5773776060b7b6861c80ec736bc5740a262c8 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -696,6 +696,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -20504,7 +20504,7 @@ index ce7caf08865df9ff032ba6c42308ea3ce4de6226..a8e8c90718a7562fd75fe66e76dbc0f8 + // Paper start + String str = packet.getCommand(); int index = -1; + if (str.length() > 64 && ((index = str.indexOf(' ')) == -1 || index >= 64)) { -+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper ++ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam"))); // Paper + return; + } + // Paper end diff --git a/patches/server/0152-Allow-specifying-a-custom-authentication-servers-dow.patch b/patches/server/0152-Allow-specifying-a-custom-authentication-servers-dow.patch index 4be32e210e..c3134dc8fc 100644 --- a/patches/server/0152-Allow-specifying-a-custom-authentication-servers-dow.patch +++ b/patches/server/0152-Allow-specifying-a-custom-authentication-servers-dow.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Allow specifying a custom "authentication servers down" kick diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 657466fc6e28cbb414549044f75eef7310d7aab9..6bc7df78ea2ecc97b886dcd082d8b5fb047ae2b7 100644 +index 657466fc6e28cbb414549044f75eef7310d7aab9..e15c5886b1cc80b5da2ad8e536507a48cea77d2a 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -262,7 +262,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -14,7 +14,7 @@ index 657466fc6e28cbb414549044f75eef7310d7aab9..6bc7df78ea2ecc97b886dcd082d8b5fb ServerLoginPacketListenerImpl.this.startClientVerification(ServerLoginPacketListenerImpl.this.createOfflineProfile(s1)); // Spigot } else { - ServerLoginPacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.authservers_down")); -+ ServerLoginPacketListenerImpl.this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.authenticationServersDown)); // Paper ++ ServerLoginPacketListenerImpl.this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.authenticationServersDown)); // Paper - Configurable kick message ServerLoginPacketListenerImpl.LOGGER.error("Couldn't verify username because servers are unavailable"); } // CraftBukkit start - catch all exceptions diff --git a/patches/server/0155-Add-PlayerJumpEvent.patch b/patches/server/0155-Add-PlayerJumpEvent.patch index 05d1d3ad55..64caef2dde 100644 --- a/patches/server/0155-Add-PlayerJumpEvent.patch +++ b/patches/server/0155-Add-PlayerJumpEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerJumpEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2f6591e5a0e450bfa68ab3e30f88afba68fbef29..61671ef718bd921ad0051f717a871d3db2ac5eab 100644 +index 5d32f12b01db3d2cc5ca743048c43c76e2a5a7cb..f422b6ffcd590788085486778293aaabc141d392 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1225,7 +1225,34 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -13,7 +13,7 @@ index 2f6591e5a0e450bfa68ab3e30f88afba68fbef29..61671ef718bd921ad0051f717a871d3d if (this.player.onGround() && !packet.isOnGround() && flag) { - this.player.jumpFromGround(); -+ // Paper start - Add player jump event ++ // Paper start - Add PlayerJumpEvent + Player player = this.getCraftPlayer(); + Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location. + Location to = player.getLocation().clone(); // Start off the To location as the Players current location. @@ -40,7 +40,7 @@ index 2f6591e5a0e450bfa68ab3e30f88afba68fbef29..61671ef718bd921ad0051f717a871d3d + this.internalTeleport(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch(), Collections.emptySet()); + return; + } -+ // Paper end ++ // Paper end - Add PlayerJumpEvent } boolean flag1 = this.player.verticalCollisionBelow; diff --git a/patches/server/0156-handle-ServerboundKeepAlivePacket-async.patch b/patches/server/0156-handle-ServerboundKeepAlivePacket-async.patch index fd3e9c0b84..f3a7c75441 100644 --- a/patches/server/0156-handle-ServerboundKeepAlivePacket-async.patch +++ b/patches/server/0156-handle-ServerboundKeepAlivePacket-async.patch @@ -15,7 +15,7 @@ also adding some additional logging in order to help work out what is causing random disconnections for clients. diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 1135da391523c464447198ce5e3743b8bd9d66e8..910b9a2918ec58ecb9fff77cca36abb48c7db7dd 100644 +index 7947a1d2e5f66c29dc11f9966233604adae71a86..0fcedb954c20d9777d27d896e29cea7f6eebffd3 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -84,14 +84,18 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -23,7 +23,7 @@ index 1135da391523c464447198ce5e3743b8bd9d66e8..910b9a2918ec58ecb9fff77cca36abb4 @Override public void handleKeepAlive(ServerboundKeepAlivePacket packet) { - PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // CraftBukkit -+ //PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // CraftBukkit // Paper - This shouldn't be on the main thread ++ //PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // CraftBukkit // Paper - handle ServerboundKeepAlivePacket async if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) { int i = (int) (Util.getMillis() - this.keepAliveTime); @@ -35,7 +35,7 @@ index 1135da391523c464447198ce5e3743b8bd9d66e8..910b9a2918ec58ecb9fff77cca36abb4 + server.submit(() -> { + this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE); + }); -+ // Paper endg ++ // Paper endg - This needs to be handled on the main thread for plugins } } diff --git a/patches/server/0158-revert-serverside-behavior-of-keepalives.patch b/patches/server/0158-revert-serverside-behavior-of-keepalives.patch index 6d8b7cea84..01ca99ca69 100644 --- a/patches/server/0158-revert-serverside-behavior-of-keepalives.patch +++ b/patches/server/0158-revert-serverside-behavior-of-keepalives.patch @@ -17,7 +17,7 @@ from networking or during connections flood of chunk packets on slower clients, at the cost of dead connections being kept open for longer. diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index c08371fdf0c10135e235efa2b2c7e4819f3b19c2..494069d69d8d0f9f1b6700349310ec6d2031abdd 100644 +index 0fcedb954c20d9777d27d896e29cea7f6eebffd3..8e96e9bc12855964dcb3a111617232df4118114e 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -48,12 +48,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -64,7 +64,7 @@ index c08371fdf0c10135e235efa2b2c7e4819f3b19c2..494069d69d8d0f9f1b6700349310ec6d this.send(new ClientboundKeepAlivePacket(this.keepAliveChallenge)); } } -+ // Paper end ++ // Paper end - give clients a longer time to respond to pings as per pre 1.12.2 timings this.server.getProfiler().pop(); } diff --git a/patches/server/0159-Send-attack-SoundEffects-only-to-players-who-can-see.patch b/patches/server/0159-Send-attack-SoundEffects-only-to-players-who-can-see.patch index fc0cd96eb2..1170f4b84f 100644 --- a/patches/server/0159-Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/patches/server/0159-Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the 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 9db07751cf1321c7fd15b2345729deaa6dd5a76f..a135b539a250966939370bba35261cf1bb276128 100644 +index 9db07751cf1321c7fd15b2345729deaa6dd5a76f..6881f6041d1605689f33d6d50b592f7d8a70cbdf 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1235,7 +1235,7 @@ public abstract class Player extends LivingEntity { @@ -59,14 +59,14 @@ index 9db07751cf1321c7fd15b2345729deaa6dd5a76f..a135b539a250966939370bba35261cf1 public int getXpNeededForNextLevel() { return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2); } -+ // Paper start - send SoundEffect to everyone who can see fromEntity ++ // Paper start - send while respecting visibility + private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) { + fromEntity.level().playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself + if (fromEntity instanceof ServerPlayer) { + ((ServerPlayer) fromEntity).connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(soundEffect), soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong())); + } + } -+ // Paper end ++ // Paper end - send while respecting visibility // CraftBukkit start public void causeFoodExhaustion(float exhaustion) { diff --git a/patches/server/0160-Add-PlayerArmorChangeEvent.patch b/patches/server/0160-Add-PlayerArmorChangeEvent.patch index f02d40a6ee..9241f395c2 100644 --- a/patches/server/0160-Add-PlayerArmorChangeEvent.patch +++ b/patches/server/0160-Add-PlayerArmorChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerArmorChangeEvent diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index b8ac19ae63579bf5325b0ebfa37293c170df6205..226afea543b581dd1b8ba0f81ff7dab7cce96395 100644 +index 202e3b66a81de2f76d5a8bba3538f1554b8debf3..914b126965392b2465fc8ce80b0e3a7917a7052b 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1,5 +1,6 @@ @@ -25,7 +25,7 @@ index b8ac19ae63579bf5325b0ebfa37293c170df6205..226afea543b581dd1b8ba0f81ff7dab7 + final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1); + new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); + } -+ // Paper end ++ // Paper end - PlayerArmorChangeEvent if (map == null) { map = Maps.newEnumMap(EquipmentSlot.class); } diff --git a/patches/server/0161-Prevent-logins-from-being-processed-when-the-player-.patch b/patches/server/0161-Prevent-logins-from-being-processed-when-the-player-.patch index 095914573d..2c62fd9c88 100644 --- a/patches/server/0161-Prevent-logins-from-being-processed-when-the-player-.patch +++ b/patches/server/0161-Prevent-logins-from-being-processed-when-the-player-.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Prevent logins from being processed when the player has diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 2337d5f0a29201b5f2d3d1734d8feb6c6177b4b3..b7ddb05d7b4ec66def973f15bb2408b0a4fc136a 100644 +index e15c5886b1cc80b5da2ad8e536507a48cea77d2a..e84b0a6e3767605b7af3e7120517808e25039702 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -81,7 +81,9 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -15,7 +15,7 @@ index 2337d5f0a29201b5f2d3d1734d8feb6c6177b4b3..b7ddb05d7b4ec66def973f15bb2408b0 if (this.state == ServerLoginPacketListenerImpl.State.VERIFYING) { + if (this.connection.isConnected()) { // Paper - prevent logins to be processed even though disconnect was called this.verifyLoginAndFinishConnectionSetup((GameProfile) Objects.requireNonNull(this.authenticatedProfile)); -+ } // Paper ++ } // Paper - prevent logins to be processed even though disconnect was called } if (this.state == ServerLoginPacketListenerImpl.State.WAITING_FOR_DUPE_DISCONNECT && !this.isPlayerAlreadyInWorld((GameProfile) Objects.requireNonNull(this.authenticatedProfile))) { diff --git a/patches/server/0162-Fix-MC-117075-TE-Unload-Lag-Spike.patch b/patches/server/0162-Fix-MC-117075-Block-entity-unload-lag-spike.patch similarity index 77% rename from patches/server/0162-Fix-MC-117075-TE-Unload-Lag-Spike.patch rename to patches/server/0162-Fix-MC-117075-Block-entity-unload-lag-spike.patch index 434d4cd45d..9a55778010 100644 --- a/patches/server/0162-Fix-MC-117075-TE-Unload-Lag-Spike.patch +++ b/patches/server/0162-Fix-MC-117075-Block-entity-unload-lag-spike.patch @@ -1,19 +1,19 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: mezz Date: Wed, 9 Aug 2017 17:51:22 -0500 -Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike +Subject: [PATCH] Fix MC-117075: Block entity unload lag spike diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 2afa7c73836ddbad936cb98bde241cb91acc11b2..69e7a6cd6741c190b8e04de1372c929b42963610 100644 +index 7e5cf2adf9b2adab681b25beb2cb573378815bef..b419eaee987585e2980016ae8bd2614cdc42cfce 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -816,6 +816,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { boolean flag = this.tickRateManager().runsNormally(); int tilesThisCycle = 0; -+ var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet(); // Paper - use removeAll -+ toRemove.add(null); ++ var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet(); // Paper - Fix MC-117075; use removeAll ++ toRemove.add(null); // Paper - Fix MC-117075 for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0; TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition); @@ -22,13 +22,13 @@ index 2afa7c73836ddbad936cb98bde241cb91acc11b2..69e7a6cd6741c190b8e04de1372c929b // Spigot start tilesThisCycle--; - this.blockEntityTickers.remove(this.tileTickPosition--); -+ toRemove.add(tickingblockentity); // Paper - use removeAll ++ toRemove.add(tickingblockentity); // Paper - Fix MC-117075; use removeAll // Spigot end } else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) { tickingblockentity.tick(); } } -+ this.blockEntityTickers.removeAll(toRemove); ++ this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 this.timings.tileEntityTick.stopTiming(); // Spigot this.tickingBlockEntities = false; diff --git a/patches/server/0165-AsyncTabCompleteEvent.patch b/patches/server/0165-AsyncTabCompleteEvent.patch index 30ae11adb3..af9c1a1a42 100644 --- a/patches/server/0165-AsyncTabCompleteEvent.patch +++ b/patches/server/0165-AsyncTabCompleteEvent.patch @@ -16,25 +16,25 @@ Also adds isCommand and getLocation to the sync TabCompleteEvent Co-authored-by: Aikar diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 95df25f6c3ce3e945bca95bc5b5ab0c0863d94c1..9c0440a6e3768ca6300e128da7f1b11a96f10f91 100644 +index f422b6ffcd590788085486778293aaabc141d392..243e111392aca01c94aee052673d0a91008524de 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -688,12 +688,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } -+ // Paper start ++ // Paper start - AsyncTabCompleteEvent + private static final java.util.concurrent.ExecutorService TAB_COMPLETE_EXECUTOR = java.util.concurrent.Executors.newFixedThreadPool(4, + new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon(true).setNameFormat("Async Tab Complete Thread - #%d").setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER)).build()); -+ // Paper end ++ // Paper end - AsyncTabCompleteEvent @Override public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) { - PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); -+ // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - run this async ++ // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async // CraftBukkit start if (this.chatSpamTickCount.addAndGet(1) > 500 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { - this.disconnect(Component.translatable("disconnect.spam")); -+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper ++ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam"))); // Paper - AsyncTabCompleteEvent return; } // Paper start @@ -42,7 +42,7 @@ index 95df25f6c3ce3e945bca95bc5b5ab0c0863d94c1..9c0440a6e3768ca6300e128da7f1b11a } // Paper end // CraftBukkit end -+ // Paper start - async tab completion ++ // Paper start - AsyncTabCompleteEvent + TAB_COMPLETE_EXECUTOR.execute(() -> { StringReader stringreader = new StringReader(packet.getCommand()); @@ -86,12 +86,12 @@ index 95df25f6c3ce3e945bca95bc5b5ab0c0863d94c1..9c0440a6e3768ca6300e128da7f1b11a + player.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), builder.buildFuture().join())); + } }); -+ // Paper end - async tab completion ++ // Paper end - AsyncTabCompleteEvent } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 11080e6dd4ae30e20a724cb62750f1bbd63323e8..d921903070fd03abf1db15d805caf5d6bda971a0 100644 +index b56bfa447a15d56bf24c1bb4c05f74584cf37ad3..9bc095ccb142e83e419a7f88591bf1219d09bacb 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2227,7 +2227,7 @@ public final class CraftServer implements Server { @@ -99,7 +99,7 @@ index 11080e6dd4ae30e20a724cb62750f1bbd63323e8..d921903070fd03abf1db15d805caf5d6 } - TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers); -+ TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers, message.startsWith("/") || forceCommand, pos != null ? io.papermc.paper.util.MCUtil.toLocation(((CraftWorld) player.getWorld()).getHandle(), BlockPos.containing(pos)) : null); // Paper ++ TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers, message.startsWith("/") || forceCommand, pos != null ? io.papermc.paper.util.MCUtil.toLocation(((CraftWorld) player.getWorld()).getHandle(), BlockPos.containing(pos)) : null); // Paper - AsyncTabCompleteEvent this.getPluginManager().callEvent(tabEvent); return tabEvent.isCancelled() ? Collections.EMPTY_LIST : tabEvent.getCompletions(); diff --git a/patches/server/0166-PlayerPickupExperienceEvent.patch b/patches/server/0166-PlayerPickupExperienceEvent.patch index 88bec9ad2a..c276fe0ac5 100644 --- a/patches/server/0166-PlayerPickupExperienceEvent.patch +++ b/patches/server/0166-PlayerPickupExperienceEvent.patch @@ -6,7 +6,7 @@ Subject: [PATCH] PlayerPickupExperienceEvent Allows plugins to cancel a player picking up an experience orb diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index 627fcf000f40e1bda025da874c447a99c727b98b..7eb84b1aad4f031ad17a461d174b23c213014995 100644 +index b49e48fa6dd37b5eddb45877be90018ec9d23b0e..7ef1b6decd87371db1636ace091b975db210f4fb 100644 --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java @@ -312,7 +312,7 @@ public class ExperienceOrb extends Entity { @@ -14,7 +14,7 @@ index 627fcf000f40e1bda025da874c447a99c727b98b..7eb84b1aad4f031ad17a461d174b23c2 public void playerTouch(Player player) { if (!this.level().isClientSide) { - if (player.takeXpDelay == 0) { -+ if (player.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper ++ if (player.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper - PlayerPickupExperienceEvent player.takeXpDelay = CraftEventFactory.callPlayerXpCooldownEvent(player, 2, PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entityhuman.takeXpDelay = 2; player.take(this, 1); int i = this.repairPlayerItems(player, this.value); diff --git a/patches/server/0168-PlayerNaturallySpawnCreaturesEvent.patch b/patches/server/0168-PlayerNaturallySpawnCreaturesEvent.patch index e7d4feaefc..fe5c651f9e 100644 --- a/patches/server/0168-PlayerNaturallySpawnCreaturesEvent.patch +++ b/patches/server/0168-PlayerNaturallySpawnCreaturesEvent.patch @@ -9,7 +9,7 @@ from triggering monster spawns on a server. Also a highly more effecient way to blanket block spawns in a world diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 5a653dffecd3877c84ac8197e1ef4b7bbc9820ce..c9e3e104cd051a38e367653dc6c4f969665fc250 100644 +index 5a653dffecd3877c84ac8197e1ef4b7bbc9820ce..422ef83670f7c4a2e5b0da48dc0906ad96b8ece0 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -700,7 +700,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -27,7 +27,7 @@ index 5a653dffecd3877c84ac8197e1ef4b7bbc9820ce..c9e3e104cd051a38e367653dc6c4f969 } entityplayer = (ServerPlayer) iterator.next(); -+ // Paper start - add PlayerNaturallySpawnCreaturesEvent ++ // Paper start - PlayerNaturallySpawnCreaturesEvent + com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event; + blockRange = 16384.0D; + if (reducedRange) { @@ -35,19 +35,19 @@ index 5a653dffecd3877c84ac8197e1ef4b7bbc9820ce..c9e3e104cd051a38e367653dc6c4f969 + if (event == null || event.isCancelled()) return false; + blockRange = (double) ((event.getSpawnRadius() << 4) * (event.getSpawnRadius() << 4)); + } -+ // Paper end ++ // Paper end - PlayerNaturallySpawnCreaturesEvent } while (!this.playerIsCloseEnoughForSpawning(entityplayer, chunkcoordintpair, blockRange)); // Spigot return true; diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 1ad6b62ee53e2ee4a710211dfc750780519004f9..16028723b36c1ca3a3c5d1bf2a7c82d2b42a0be4 100644 +index 1ad6b62ee53e2ee4a710211dfc750780519004f9..de1d5da6318958e11a9da56ddd8fef1174d0a537 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -557,6 +557,15 @@ public class ServerChunkCache extends ChunkSource { boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit Util.shuffle(list, this.level.random); -+ // Paper start - call player naturally spawn event ++ // Paper start - PlayerNaturallySpawnCreaturesEvent + int chunkRange = level.spigotConfig.mobSpawnRange; + chunkRange = (chunkRange > level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange; + chunkRange = Math.min(chunkRange, 8); @@ -55,19 +55,19 @@ index 1ad6b62ee53e2ee4a710211dfc750780519004f9..16028723b36c1ca3a3c5d1bf2a7c82d2 + entityPlayer.playerNaturallySpawnedEvent = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityPlayer.getBukkitEntity(), (byte) chunkRange); + entityPlayer.playerNaturallySpawnedEvent.callEvent(); + } -+ // Paper end ++ // Paper end - PlayerNaturallySpawnCreaturesEvent int l = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit Iterator iterator1 = list.iterator(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index d11864c05bd73fac15df454d6042924596639c25..8f826978564a1d144901f1ca2e46c5b083b68945 100644 +index 5e60c85a78aedb8275a7cd619006346fcb80405c..989359525a188cc2177e2b258de7baa44773bb53 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -265,6 +265,7 @@ public class ServerPlayer extends Player { // CraftBukkit end public boolean isRealPlayer; // Paper public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper -+ public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper ++ public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent // Paper start - replace player chunk loader private final java.util.concurrent.atomic.AtomicReference viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1)); diff --git a/patches/server/0170-PreCreatureSpawnEvent.patch b/patches/server/0170-PreCreatureSpawnEvent.patch index 2e32504f7e..78b6f9f5ca 100644 --- a/patches/server/0170-PreCreatureSpawnEvent.patch +++ b/patches/server/0170-PreCreatureSpawnEvent.patch @@ -15,7 +15,7 @@ instead and save a lot of server resources. See: https://github.com/PaperMC/Paper/issues/917 diff --git a/src/main/java/net/minecraft/util/SpawnUtil.java b/src/main/java/net/minecraft/util/SpawnUtil.java -index b77ebe04f1018962b85110258c8a0a2db8612485..028d69907a988e191213a17e072ef22710b5bc83 100644 +index b77ebe04f1018962b85110258c8a0a2db8612485..1a0cd6ae172c911d3b4cc0f82e253536a4898ca9 100644 --- a/src/main/java/net/minecraft/util/SpawnUtil.java +++ b/src/main/java/net/minecraft/util/SpawnUtil.java @@ -22,10 +22,10 @@ public class SpawnUtil { @@ -35,7 +35,7 @@ index b77ebe04f1018962b85110258c8a0a2db8612485..028d69907a988e191213a17e072ef227 blockposition_mutableblockposition.setWithOffset(blockposition, i1, k, j1); if (worldserver.getWorldBorder().isWithinBounds((BlockPos) blockposition_mutableblockposition) && SpawnUtil.moveToPossibleSpawnPosition(worldserver, k, blockposition_mutableblockposition, spawnutil_a)) { -+ // Paper start ++ // Paper start - PreCreatureSpawnEvent + String key = EntityType.getKey(entitytypes).getPath(); + org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); + @@ -54,19 +54,19 @@ index b77ebe04f1018962b85110258c8a0a2db8612485..028d69907a988e191213a17e072ef227 + } + break; + } -+ // Paper end ++ // Paper end - PreCreatureSpawnEvent T t0 = entitytypes.create(worldserver, (CompoundTag) null, null, blockposition_mutableblockposition, enummobspawn, false, false); // CraftBukkit - decompile error if (t0 != null) { diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index 382b55167dede435b034866bd394455f0f6f2a00..9d16fc698b0771bcb3c95f5fb017879c37ebb39b 100644 +index 382b55167dede435b034866bd394455f0f6f2a00..bd4ae65070eb4b98dae0529b5985f80093bf8185 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java @@ -418,6 +418,20 @@ public class EntityType implements FeatureElement, EntityTypeT @Nullable public T spawn(ServerLevel worldserver, @Nullable CompoundTag nbttagcompound, @Nullable Consumer consumer, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { // CraftBukkit end -+ // Paper start - Call PreCreatureSpawnEvent ++ // Paper start - PreCreatureSpawnEvent + org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityType.getKey(this).getPath()); + if (type != null) { + com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; @@ -79,7 +79,7 @@ index 382b55167dede435b034866bd394455f0f6f2a00..9d16fc698b0771bcb3c95f5fb017879c + return null; + } + } -+ // Paper end ++ // Paper end - PreCreatureSpawnEvent T t0 = this.create(worldserver, nbttagcompound, consumer, blockposition, enummobspawn, flag, flag1); if (t0 != null) { @@ -97,14 +97,14 @@ index a0a313fa5e7e4e1973c020d0262e34381a19dea7..0429b927e63ec12f53a6ce1ebe1e64d9 } } diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 393b77043cbaf58200fca6e56c22c36aa2aa2cfb..04cce4380e6e833b1d5e0a613eb0a167fdfe4e16 100644 +index 393b77043cbaf58200fca6e56c22c36aa2aa2cfb..db4beb22cf54bb3b53561ec0fe06209c478977ff 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -130,6 +130,27 @@ public abstract class BaseSpawner { } else if (!SpawnPlacements.checkSpawnRules((EntityType) optional.get(), world, MobSpawnType.SPAWNER, blockposition1, world.getRandom())) { continue; } -+ // Paper start ++ // Paper start - PreCreatureSpawnEvent + EntityType entityType = optional.get(); + String key = EntityType.getKey(entityType).getPath(); + @@ -124,12 +124,12 @@ index 393b77043cbaf58200fca6e56c22c36aa2aa2cfb..04cce4380e6e833b1d5e0a613eb0a167 + continue; + } + } -+ // Paper end ++ // Paper end - PreCreatureSpawnEvent Entity entity = EntityType.loadEntityRecursive(nbttagcompound, world, (entity1) -> { entity1.moveTo(d0, d1, d2, entity1.getYRot(), entity1.getXRot()); diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 92e76dd39dc3575e9466031dd799080a98ad8b8d..b3a7d065900f63b15ee2a8e3c1d69d5513f7b85c 100644 +index 92e76dd39dc3575e9466031dd799080a98ad8b8d..449a811202c9dea62bcf4a2f483e08a9bc1d0129 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -213,7 +213,13 @@ public final class NaturalSpawner { @@ -137,13 +137,13 @@ index 92e76dd39dc3575e9466031dd799080a98ad8b8d..b3a7d065900f63b15ee2a8e3c1d69d55 } - if (NaturalSpawner.isValidSpawnPostitionForType(world, group, structuremanager, chunkgenerator, biomesettingsmobs_c, blockposition_mutableblockposition, d2) && checker.test(biomesettingsmobs_c.type, blockposition_mutableblockposition, chunk)) { -+ // Paper start ++ // Paper start - PreCreatureSpawnEvent + PreSpawnStatus doSpawning = isValidSpawnPostitionForType(world, group, structuremanager, chunkgenerator, biomesettingsmobs_c, blockposition_mutableblockposition, d2); + if (doSpawning == PreSpawnStatus.ABORT) { + return; + } + if (doSpawning == PreSpawnStatus.SUCCESS && checker.test(biomesettingsmobs_c.type, blockposition_mutableblockposition, chunk)) { -+ // Paper end ++ // Paper end - PreCreatureSpawnEvent Mob entityinsentient = NaturalSpawner.getMobForSpawn(world, biomesettingsmobs_c.type); if (entityinsentient == null) { @@ -152,7 +152,7 @@ index 92e76dd39dc3575e9466031dd799080a98ad8b8d..b3a7d065900f63b15ee2a8e3c1d69d55 } - private static boolean isValidSpawnPostitionForType(ServerLevel world, MobCategory group, StructureManager structureAccessor, ChunkGenerator chunkGenerator, MobSpawnSettings.SpawnerData spawnEntry, BlockPos.MutableBlockPos pos, double squaredDistance) { -+ // Paper start ++ // Paper start - PreCreatureSpawnEvent + private enum PreSpawnStatus { + FAIL, + SUCCESS, @@ -160,10 +160,10 @@ index 92e76dd39dc3575e9466031dd799080a98ad8b8d..b3a7d065900f63b15ee2a8e3c1d69d55 + ABORT + } + private static PreSpawnStatus isValidSpawnPostitionForType(ServerLevel world, MobCategory group, StructureManager structureAccessor, ChunkGenerator chunkGenerator, MobSpawnSettings.SpawnerData spawnEntry, BlockPos.MutableBlockPos pos, double squaredDistance) { -+ // Paper end ++ // Paper end - PreCreatureSpawnEvent EntityType entitytypes = spawnEntry.type; -+ // Paper start ++ // Paper start - PreCreatureSpawnEvent + com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; + org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityType.getKey(entitytypes).getPath()); + if (type != null) { @@ -178,22 +178,22 @@ index 92e76dd39dc3575e9466031dd799080a98ad8b8d..b3a7d065900f63b15ee2a8e3c1d69d55 + return PreSpawnStatus.CANCELLED; // Paper + } + } -+ // Paper end ++ // Paper end - PreCreatureSpawnEvent if (entitytypes.getCategory() == MobCategory.MISC) { - return false; -+ return PreSpawnStatus.FAIL; // Paper ++ return PreSpawnStatus.FAIL; // Paper - PreCreatureSpawnEvent } else if (!entitytypes.canSpawnFarFromPlayer() && squaredDistance > (double) (entitytypes.getCategory().getDespawnDistance() * entitytypes.getCategory().getDespawnDistance())) { - return false; -+ return PreSpawnStatus.FAIL; // Paper ++ return PreSpawnStatus.FAIL; // Paper - PreCreatureSpawnEvent } else if (entitytypes.canSummon() && NaturalSpawner.canSpawnMobAt(world, structureAccessor, chunkGenerator, group, spawnEntry, pos)) { SpawnPlacements.Type entitypositiontypes_surface = SpawnPlacements.getPlacementType(entitytypes); - return !NaturalSpawner.isSpawnPositionOk(entitypositiontypes_surface, world, pos, entitytypes) ? false : (!SpawnPlacements.checkSpawnRules(entitytypes, world, MobSpawnType.NATURAL, pos, world.random) ? false : world.noCollision(entitytypes.getAABB((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D))); -+ boolean isValid = !NaturalSpawner.isSpawnPositionOk(entitypositiontypes_surface, world, pos, entitytypes) ? false : (!SpawnPlacements.checkSpawnRules(entitytypes, world, MobSpawnType.NATURAL, pos, world.random) ? false : world.noCollision(entitytypes.getAABB((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D))); // Paper -+ return isValid ? PreSpawnStatus.SUCCESS : PreSpawnStatus.FAIL; // Paper ++ boolean isValid = !NaturalSpawner.isSpawnPositionOk(entitypositiontypes_surface, world, pos, entitytypes) ? false : (!SpawnPlacements.checkSpawnRules(entitytypes, world, MobSpawnType.NATURAL, pos, world.random) ? false : world.noCollision(entitytypes.getAABB((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D))); // Paper - PreCreatureSpawnEvent ++ return isValid ? PreSpawnStatus.SUCCESS : PreSpawnStatus.FAIL; // Paper - PreCreatureSpawnEvent } else { - return false; -+ return PreSpawnStatus.FAIL; // Paper ++ return PreSpawnStatus.FAIL; // Paper - PreCreatureSpawnEvent } } diff --git a/patches/server/0171-Fill-Profile-Property-Events.patch b/patches/server/0171-Fill-Profile-Property-Events.patch index 68239bfad1..1c699ab0ce 100644 --- a/patches/server/0171-Fill-Profile-Property-Events.patch +++ b/patches/server/0171-Fill-Profile-Property-Events.patch @@ -46,7 +46,7 @@ index 985e6fc43a0946943847e0c283426242ef594a26..d577384797bb381eb57437f57b726ea8 return super.fetchProfile(profileId, requireSecure); } diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -index 92b770d10f34596ce52392a0db1ccd825108730b..4430520d32024d897c93c1d9f8652ccb2c202c01 100644 +index 92b770d10f34596ce52392a0db1ccd825108730b..252d8db6c802a2f23d6c6f8cf3726668225b853d 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java @@ -74,7 +74,7 @@ public class SkullBlockEntity extends BlockEntity { @@ -54,7 +54,7 @@ index 92b770d10f34596ce52392a0db1ccd825108730b..4430520d32024d897c93c1d9f8652ccb if (optional.isPresent() && !booleansupplier.getAsBoolean()) { UUID uuid = ((GameProfile) optional.get()).getId(); - ProfileResult profileresult = apiServices.sessionService().fetchProfile(uuid, true); -+ ProfileResult profileresult = apiServices.sessionService() instanceof com.destroystokyo.paper.profile.PaperMinecraftSessionService paperMinecraftSessionService ? paperMinecraftSessionService.fetchProfile(optional.get(), true) : apiServices.sessionService().fetchProfile(uuid, true); // Paper ++ ProfileResult profileresult = apiServices.sessionService() instanceof com.destroystokyo.paper.profile.PaperMinecraftSessionService paperMinecraftSessionService ? paperMinecraftSessionService.fetchProfile(optional.get(), true) : apiServices.sessionService().fetchProfile(uuid, true); // Paper - FillProfileEvent return profileresult != null ? Optional.ofNullable(profileresult.profile()) : optional; } else { diff --git a/patches/server/0172-Add-PlayerAdvancementCriterionGrantEvent.patch b/patches/server/0172-Add-PlayerAdvancementCriterionGrantEvent.patch index aa33b255e7..919a3add63 100644 --- a/patches/server/0172-Add-PlayerAdvancementCriterionGrantEvent.patch +++ b/patches/server/0172-Add-PlayerAdvancementCriterionGrantEvent.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Add PlayerAdvancementCriterionGrantEvent diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java -index dbd5f1d052348d6adae8b13ae1f2686553b7a4bf..f6daa77856f5d57b1a3b38e709bff47214372973 100644 +index dbd5f1d052348d6adae8b13ae1f2686553b7a4bf..c61789a2df774761feb79123d31eab75f9996bf2 100644 --- a/src/main/java/net/minecraft/server/PlayerAdvancements.java +++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java @@ -225,6 +225,12 @@ public class PlayerAdvancements { boolean flag1 = advancementprogress.isDone(); if (advancementprogress.grantProgress(criterionName)) { -+ // Paper start ++ // Paper start - Add PlayerAdvancementCriterionGrantEvent + if (!new com.destroystokyo.paper.event.player.PlayerAdvancementCriterionGrantEvent(this.player.getBukkitEntity(), advancement.toBukkit(), criterionName).callEvent()) { + advancementprogress.revokeProgress(criterionName); + return false; + } -+ // Paper end ++ // Paper end - Add PlayerAdvancementCriterionGrantEvent this.unregisterListeners(advancement); this.progressChanged.add(advancement); flag = true; diff --git a/patches/server/0174-Extend-Player-Interact-cancellation.patch b/patches/server/0174-Extend-Player-Interact-cancellation.patch index 006fd25c7b..3f7b5b66d2 100644 --- a/patches/server/0174-Extend-Player-Interact-cancellation.patch +++ b/patches/server/0174-Extend-Player-Interact-cancellation.patch @@ -13,14 +13,14 @@ Update adjacent blocks of doors, double plants, pistons and beds when cancelling interaction. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 45236a077d798d6a257a2e982b58901167ecd06e..e3b7441d875b55ffce295c948f3dc867be09e042 100644 +index 45236a077d798d6a257a2e982b58901167ecd06e..f56ba2973aaf0fd41a974d6b38c2b2797631959e 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java @@ -519,7 +519,13 @@ public class ServerPlayerGameMode { // send a correcting update to the client for the block above as well, this because of replaceable blocks (such as grass, sea grass etc) player.connection.send(new ClientboundBlockUpdatePacket(world, blockposition.above())); -+ // Paper start - extend Player Interact cancellation // TODO: consider merging this into the extracted method ++ // Paper start - extend Player Interact cancellation // TODO: consider merging this into the extracted method + } else if (iblockdata.getBlock() instanceof net.minecraft.world.level.block.StructureBlock) { + player.connection.send(new net.minecraft.network.protocol.game.ClientboundContainerClosePacket(this.player.containerMenu.containerId)); + } else if (iblockdata.getBlock() instanceof net.minecraft.world.level.block.CommandBlock) { diff --git a/patches/server/0176-Toggleable-player-crits-helps-mitigate-hacked-client.patch b/patches/server/0176-Toggleable-player-crits.patch similarity index 80% rename from patches/server/0176-Toggleable-player-crits-helps-mitigate-hacked-client.patch rename to patches/server/0176-Toggleable-player-crits.patch index d494f9714a..3a0ff5f64a 100644 --- a/patches/server/0176-Toggleable-player-crits-helps-mitigate-hacked-client.patch +++ b/patches/server/0176-Toggleable-player-crits.patch @@ -1,18 +1,18 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MiniDigger Date: Sat, 10 Mar 2018 00:50:24 +0100 -Subject: [PATCH] Toggleable player crits, helps mitigate hacked clients. +Subject: [PATCH] Toggleable player crits 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 a135b539a250966939370bba35261cf1bb276128..26ddbd14831f6d7f2f1e8fd460f6253245f32a04 100644 +index 6881f6041d1605689f33d6d50b592f7d8a70cbdf..755364ee011df4deed65fc36ea41012d0667c918 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1242,6 +1242,7 @@ public abstract class Player extends LivingEntity { boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; -+ flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper ++ flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits flag2 = flag2 && !this.isSprinting(); if (flag2) { f *= 1.5F; diff --git a/patches/server/0177-Disable-Explicit-Network-Manager-Flushing.patch b/patches/server/0177-Disable-Explicit-Network-Manager-Flushing.patch index a6f5d8c10c..47975e8e65 100644 --- a/patches/server/0177-Disable-Explicit-Network-Manager-Flushing.patch +++ b/patches/server/0177-Disable-Explicit-Network-Manager-Flushing.patch @@ -12,14 +12,14 @@ flushing on the netty event loop, so it won't do the flush on the main thread. Renable flushing by passing -Dpaper.explicit-flush=true diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index faac9ba36d83f537fe62e177c15ae237059cc5cc..df5da9398c903d073485aaa0dce8e70947137cb9 100644 +index faac9ba36d83f537fe62e177c15ae237059cc5cc..02b3f5c67b47a098f7fe15ddba0df6cb586a9ae5 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -114,6 +114,7 @@ public class Connection extends SimpleChannelInboundHandler> { // Paper start - NetworkClient implementation public int protocolVersion; public java.net.InetSocketAddress virtualHost; -+ private static boolean enableExplicitFlush = Boolean.getBoolean("paper.explicit-flush"); ++ private static boolean enableExplicitFlush = Boolean.getBoolean("paper.explicit-flush"); // Paper - Disable explicit network manager flushing // Paper end // Paper start - add utility methods @@ -28,7 +28,7 @@ index faac9ba36d83f537fe62e177c15ae237059cc5cc..df5da9398c903d073485aaa0dce8e709 if (this.channel != null) { - this.channel.flush(); -+ if (enableExplicitFlush) this.channel.eventLoop().execute(() -> this.channel.flush()); // Paper - we don't need to explicit flush here, but allow opt in incase issues are found to a better version ++ if (enableExplicitFlush) this.channel.eventLoop().execute(() -> this.channel.flush()); // Paper - Disable explicit network manager flushing; we don't need to explicit flush here, but allow opt in incase issues are found to a better version } if (this.tickCount++ % 20 == 0) { diff --git a/patches/server/0178-Implement-extended-PaperServerListPingEvent.patch b/patches/server/0178-Implement-extended-PaperServerListPingEvent.patch index c3a21b7e23..44c9c1509f 100644 --- a/patches/server/0178-Implement-extended-PaperServerListPingEvent.patch +++ b/patches/server/0178-Implement-extended-PaperServerListPingEvent.patch @@ -181,7 +181,7 @@ index 0000000000000000000000000000000000000000..6b0bdc266109cdfb874f08bf74323603 + +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index eb443925f77aff634d4630089d7c2d096dfe8005..fa8905c2053d66cebfc8e8a4fad9d833b2ad05a3 100644 +index 06bbe33eeb2474119c22b918c93c57d6b253c319..becbff154ba757a80f9e90a8a7da00acc279d9f5 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -3,6 +3,9 @@ package net.minecraft.server; @@ -199,7 +199,7 @@ index eb443925f77aff634d4630089d7c2d096dfe8005..fa8905c2053d66cebfc8e8a4fad9d833 return new ServerStatus.Players(i, list.size(), List.of()); } else { - int j = Math.min(list.size(), 12); -+ int j = Math.min(list.size(), org.spigotmc.SpigotConfig.playerSample); // Paper ++ int j = Math.min(list.size(), org.spigotmc.SpigotConfig.playerSample); // Paper - PaperServerListPingEvent ObjectArrayList objectarraylist = new ObjectArrayList(j); int k = Mth.nextInt(this.random, 0, list.size() - j); diff --git a/patches/server/0187-Configurable-sprint-interruption-on-attack.patch b/patches/server/0187-Configurable-sprint-interruption-on-attack.patch index 22eed74da4..f6123af66d 100644 --- a/patches/server/0187-Configurable-sprint-interruption-on-attack.patch +++ b/patches/server/0187-Configurable-sprint-interruption-on-attack.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Configurable sprint interruption on attack If the sprint interruption is disabled players continue sprinting when they attack entities. 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 26ddbd14831f6d7f2f1e8fd460f6253245f32a04..729c960a18a77b744eba0c9319cf5c2a9e84b707 100644 +index 755364ee011df4deed65fc36ea41012d0667c918..fd29c7f9fd50b52333f792cd07540704af579058 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1291,7 +1291,11 @@ public abstract class Player extends LivingEntity { @@ -14,11 +14,11 @@ index 26ddbd14831f6d7f2f1e8fd460f6253245f32a04..729c960a18a77b744eba0c9319cf5c2a this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D)); - this.setSprinting(false); -+ // Paper start - Configuration option to disable automatic sprint interruption ++ // Paper start - Configurable sprint interruption on attack + if (!this.level().paperConfig().misc.disableSprintInterruptionOnAttack) { + this.setSprinting(false); + } -+ // Paper end ++ // Paper end - Configurable sprint interruption on attack } if (flag3) { diff --git a/patches/server/0188-EndermanEscapeEvent.patch b/patches/server/0188-EndermanEscapeEvent.patch index 3938ddc0cc..d5911bb2bc 100644 --- a/patches/server/0188-EndermanEscapeEvent.patch +++ b/patches/server/0188-EndermanEscapeEvent.patch @@ -8,18 +8,18 @@ Fires an event anytime an enderman intends to teleport away from the player You may cancel this, enabling ranged attacks to damage the enderman for example. diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -index 4ad0a65cce22d92972a15c18ac6e213012b90c0a..c897d55acdceae54bc2e7f3f3694ce421a8df687 100644 +index 4ad0a65cce22d92972a15c18ac6e213012b90c0a..aa7762037c3bcbbb3e51325b2ba91d5ad6db0ab0 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java @@ -124,6 +124,12 @@ public class EnderMan extends Monster implements NeutralMob { this.setTarget(target, EntityTargetEvent.TargetReason.UNKNOWN, true); } -+ // Paper start ++ // Paper start - EndermanEscapeEvent + private boolean tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason reason) { + return new com.destroystokyo.paper.event.entity.EndermanEscapeEvent((org.bukkit.craftbukkit.entity.CraftEnderman) this.getBukkitEntity(), reason).callEvent(); + } -+ // Paper end ++ // Paper end - EndermanEscapeEvent + @Override public boolean setTarget(LivingEntity entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) { @@ -29,7 +29,7 @@ index 4ad0a65cce22d92972a15c18ac6e213012b90c0a..c897d55acdceae54bc2e7f3f3694ce42 float f = this.getLightLevelDependentMagicValue(); - if (f > 0.5F && this.level().canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { -+ if (f > 0.5F && this.level().canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper ++ if (f > 0.5F && this.level().canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper - EndermanEscapeEvent this.setTarget((LivingEntity) null); this.teleport(); } @@ -37,13 +37,13 @@ index 4ad0a65cce22d92972a15c18ac6e213012b90c0a..c897d55acdceae54bc2e7f3f3694ce42 } else { flag1 = flag && this.hurtWithCleanWater(source, (ThrownPotion) source.getDirectEntity(), amount); -+ if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start ++ if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper - EndermanEscapeEvent for (int i = 0; i < 64; ++i) { if (this.teleport()) { return true; } } -+ } // Paper end ++ } // Paper - EndermanEscapeEvent return flag1; } @@ -52,7 +52,7 @@ index 4ad0a65cce22d92972a15c18ac6e213012b90c0a..c897d55acdceae54bc2e7f3f3694ce42 if (this.target != null && !this.enderman.isPassenger()) { if (this.enderman.isLookingAtMe((Player) this.target)) { - if (this.target.distanceToSqr((Entity) this.enderman) < 16.0D) { -+ if (this.target.distanceToSqr((Entity) this.enderman) < 16.0D && this.enderman.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.STARE)) { // Paper ++ if (this.target.distanceToSqr((Entity) this.enderman) < 16.0D && this.enderman.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.STARE)) { // Paper - EndermanEscapeEvent this.enderman.teleport(); } diff --git a/patches/server/0190-Block-Enderpearl-Travel-Exploit.patch b/patches/server/0190-Block-Enderpearl-Travel-Exploit.patch index 8ee73403dd..716c574a8e 100644 --- a/patches/server/0190-Block-Enderpearl-Travel-Exploit.patch +++ b/patches/server/0190-Block-Enderpearl-Travel-Exploit.patch @@ -16,7 +16,7 @@ public net.minecraft.world.entity.projectile.Projectile cachedOwner public net.minecraft.world.entity.projectile.Projectile ownerUUID diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index c63df0042b23e3728d5283b563889225691f6d56..8afcd4e3a3805c7bccffaf6ff751e23101db6ed8 100644 +index 9f958136a8a4c4632ad8ca359860681448653176..294a8eac85e49e9fa0e39b87f3954787b05fe30d 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2368,6 +2368,12 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -28,19 +28,19 @@ index c63df0042b23e3728d5283b563889225691f6d56..8afcd4e3a3805c7bccffaf6ff751e231 + pearl.cachedOwner = null; + pearl.ownerUUID = null; + } -+ // Paper end ++ // Paper end - Reset pearls when they stop being ticked } public void onTrackingStart(Entity entity) { diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -index fbbb1fa3d5f4ace67fee96aa235cec3b39deb7b1..e8620ad6be2dda7fe288f884c4ae88a924be4a62 100644 +index fbbb1fa3d5f4ace67fee96aa235cec3b39deb7b1..e432855ce79f69c0e91fa31e8f6c59a465b0d09e 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -101,6 +101,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { if (nbt.hasUUID("Owner")) { this.ownerUUID = nbt.getUUID("Owner"); this.cachedOwner = null; -+ if (this instanceof ThrownEnderpearl && this.level() != null && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit) { this.ownerUUID = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit ++ if (this instanceof ThrownEnderpearl && this.level() != null && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit) { this.ownerUUID = null; } // Paper - Reset pearls when they stop being ticked; Don't store shooter name for pearls to block enderpearl travel exploit } this.leftOwner = nbt.getBoolean("LeftOwner"); diff --git a/patches/server/0229-Break-up-and-make-tab-spam-limits-configurable.patch b/patches/server/0229-Break-up-and-make-tab-spam-limits-configurable.patch index 8ebb5cb69e..13a8fbad08 100644 --- a/patches/server/0229-Break-up-and-make-tab-spam-limits-configurable.patch +++ b/patches/server/0229-Break-up-and-make-tab-spam-limits-configurable.patch @@ -22,7 +22,7 @@ to take the burden of this into their own hand without having to rely on plugins doing unsafe things. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a00f68b058d6d7aa28ce34ad726c5b228e5c2e64..222e9ab6fa6a40f7846451cee256d3dbbac54fde 100644 +index 2291ca80352db1aaa99b2f266de6d493785be7cf..6f628fedbba120a0db13cb942f6e79ebf2acf14b 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -257,6 +257,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -43,10 +43,10 @@ index a00f68b058d6d7aa28ce34ad726c5b228e5c2e64..222e9ab6fa6a40f7846451cee256d3db --this.chatSpamTickCount; @@ -697,7 +699,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) { - // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - run this async + // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async // CraftBukkit start - if (this.chatSpamTickCount.addAndGet(1) > 500 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { + if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper - configurable tab spam limits - server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper + server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam"))); // Paper - AsyncTabCompleteEvent return; } diff --git a/patches/server/0287-Brigadier-Mojang-API.patch b/patches/server/0287-Brigadier-Mojang-API.patch index 7b8adfc7ac..beddfc74a2 100644 --- a/patches/server/0287-Brigadier-Mojang-API.patch +++ b/patches/server/0287-Brigadier-Mojang-API.patch @@ -131,7 +131,7 @@ index 2b722091920116ded43ff54c413d4dd47da65ed4..867f22bdeed5f1c3f063a5815a3477d1 if (commandnode2.canUse(source)) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 592493efdd799c76c753de825126c4f7b04a3179..efa12d25cacd0b746ff8e689f35380bc310f5d75 100644 +index c522763bd17205d31f3c37b5e582a449b2b7e06f..7b373eb64752e03227beedd41c1a7cb271d814f1 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -740,8 +740,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -163,7 +163,7 @@ index 592493efdd799c76c753de825126c4f7b04a3179..efa12d25cacd0b746ff8e689f35380bc + // Paper end - Brigadier API } }); - // Paper end - async tab completion + // Paper end - AsyncTabCompleteEvent diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java index 83d81b9371902b0302d13e53b31c15fac4e67966..d113e54a30db16e2ad955170df6030d15de530d6 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java diff --git a/patches/server/0293-Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/patches/server/0293-Optimize-Network-Manager-and-add-advanced-packet-sup.patch index baa14e577e..66a3fbc5b9 100644 --- a/patches/server/0293-Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/patches/server/0293-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 c521e2eab937f90085c4f1a98aab13d46720a07b..c66fc75fb88c4f0a4273d69009a4e6defb0b29e9 100644 +index cd9ed68079abf103759865a3e2a038ac629a18ea..128debf837da32d27ba37184162e7b3bfb463812 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -84,7 +84,7 @@ public class Connection extends SimpleChannelInboundHandler> { @@ -42,7 +42,7 @@ index c521e2eab937f90085c4f1a98aab13d46720a07b..c66fc75fb88c4f0a4273d69009a4e6de // Spigot Start @@ -116,6 +116,10 @@ public class Connection extends SimpleChannelInboundHandler> { public java.net.InetSocketAddress virtualHost; - private static boolean enableExplicitFlush = Boolean.getBoolean("paper.explicit-flush"); + private static boolean enableExplicitFlush = Boolean.getBoolean("paper.explicit-flush"); // Paper - Disable explicit network manager flushing // Paper end + // Paper start - Optimize network + public boolean isPending = true; diff --git a/patches/server/0332-Optional-per-player-mob-spawns.patch b/patches/server/0332-Optional-per-player-mob-spawns.patch index 4566980134..26db4845b9 100644 --- a/patches/server/0332-Optional-per-player-mob-spawns.patch +++ b/patches/server/0332-Optional-per-player-mob-spawns.patch @@ -5,7 +5,7 @@ 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 279cb641b795b6f4ced545c3a09b61fde69c47d6..19f1432ae1405eee0ee56dec151e7d602816a943 100644 +index b9c345d056ea8b14f19dc033cf3e7e9502b63eda..2b9a1a178233fb7cfb4d58853ff3176cb1236d3a 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -288,6 +288,29 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -39,7 +39,7 @@ index 279cb641b795b6f4ced545c3a09b61fde69c47d6..19f1432ae1405eee0ee56dec151e7d60 double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8); double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 16028723b36c1ca3a3c5d1bf2a7c82d2b42a0be4..488f7e2f1ab0312673983d9079b4d7d99eebe611 100644 +index de1d5da6318958e11a9da56ddd8fef1174d0a537..c05beb24972e6633e2d61ba47dcfa0189ea249b6 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -549,7 +549,19 @@ public class ServerChunkCache extends ChunkSource { @@ -64,7 +64,7 @@ index 16028723b36c1ca3a3c5d1bf2a7c82d2b42a0be4..488f7e2f1ab0312673983d9079b4d7d9 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 af75f20fff15f95aed238e3f6ae57182f4076d46..f9f994f74ff2fc9024c51104eb9af536beb24943 100644 +index 0eace8fabb01083327b34e39ec47c51dbedf87ec..181b1896f5bed99c4c4e2e092f72b1a8e1551832 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -253,6 +253,10 @@ public class ServerPlayer extends Player { @@ -79,7 +79,7 @@ index af75f20fff15f95aed238e3f6ae57182f4076d46..f9f994f74ff2fc9024c51104eb9af536 // CraftBukkit start public String displayName; diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index a19c0e30ebcea8feff035a451ded567dfa86dfff..db22e35d19597488a08ba3cd710ced7da77f8b5e 100644 +index 30327580bfa00dda2b87171b2bf3c7de2600ba68..b27e0f31d0b3f5c57157a27f1f1db0f847d42a0c 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -70,6 +70,12 @@ public final class NaturalSpawner { @@ -194,14 +194,14 @@ index a19c0e30ebcea8feff035a451ded567dfa86dfff..db22e35d19597488a08ba3cd710ced7d while (k < 3) { @@ -223,14 +268,14 @@ public final class NaturalSpawner { - // Paper start + // Paper start - PreCreatureSpawnEvent PreSpawnStatus doSpawning = isValidSpawnPostitionForType(world, group, structuremanager, chunkgenerator, biomesettingsmobs_c, blockposition_mutableblockposition, d2); if (doSpawning == PreSpawnStatus.ABORT) { - return; + return j; // Paper - Optional per player mob spawns } if (doSpawning == PreSpawnStatus.SUCCESS && checker.test(biomesettingsmobs_c.type, blockposition_mutableblockposition, chunk)) { - // Paper end + // Paper end - PreCreatureSpawnEvent Mob entityinsentient = NaturalSpawner.getMobForSpawn(world, biomesettingsmobs_c.type); if (entityinsentient == null) { diff --git a/patches/server/0433-Brand-support.patch b/patches/server/0433-Brand-support.patch index 40b4914f13..d9dd9c9998 100644 --- a/patches/server/0433-Brand-support.patch +++ b/patches/server/0433-Brand-support.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Brand support diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 9b3425857342f4c75ae23aee922d792977aa8c4e..07b711193d58625f3b3017e1b2ecb9dc07cc51a5 100644 +index dc0869c5f4e4fcae9d4fed41a33bc9a278da6d22..1d19688f9861f6a44ed6ff181befd1f7b5cc6947 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -278,6 +278,7 @@ public class ServerPlayer extends Player { public boolean isRealPlayer; // Paper public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper - public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper + public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent + public @Nullable String clientBrandName = null; // Paper - Brand support // Paper start - replace player chunk loader private final java.util.concurrent.atomic.AtomicReference viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1)); diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index b68301f4cf650891140d3be6aebdc7ddf0d2a54f..f453b3023b713877b286e61d3c60b0b3cfce2cdd 100644 +index 1b53b0ee686f34a881840c549c66ea1cbab36c9f..5e86123f41e63fbf3d37d0351c04a8c73da60f63 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -55,6 +55,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack diff --git a/patches/server/0475-Add-API-for-quit-reason.patch b/patches/server/0475-Add-API-for-quit-reason.patch index ef9b5bf746..e2fcc31f87 100644 --- a/patches/server/0475-Add-API-for-quit-reason.patch +++ b/patches/server/0475-Add-API-for-quit-reason.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add API for quit reason diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 19df0fa85080897a36bdbffa8fcef0991dbdd191..751d24a29cf3797234adbb1eb3b64b7fb261b24e 100644 +index a25090d277f586c932e975068636ccd6cc43b204..dd7deb9175059857c59c85c745053cc88a922d3b 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -183,12 +183,15 @@ public class Connection extends SimpleChannelInboundHandler> { @@ -25,19 +25,19 @@ index 19df0fa85080897a36bdbffa8fcef0991dbdd191..751d24a29cf3797234adbb1eb3b64b7f Connection.LOGGER.debug("Failed to sent packet", throwable); if (this.getSending() == PacketFlow.CLIENTBOUND) { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 07b711193d58625f3b3017e1b2ecb9dc07cc51a5..94ddc704114af810a3f9c858863e10b5a2b87edd 100644 +index 1d19688f9861f6a44ed6ff181befd1f7b5cc6947..115ecf1d50f796adb85df6fdd8739f71740faf3e 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -279,6 +279,7 @@ public class ServerPlayer extends Player { public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper - public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper + public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent public @Nullable String clientBrandName = null; // Paper - Brand support + public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event // Paper start - replace player chunk loader private final java.util.concurrent.atomic.AtomicReference viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1)); diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index f453b3023b713877b286e61d3c60b0b3cfce2cdd..825b8f541fe3f5e4cb53f465232c19398b8e66ab 100644 +index 5e86123f41e63fbf3d37d0351c04a8c73da60f63..7c17c3d4f4f5ebc42186fcc98008bda062715e55 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -315,6 +315,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack diff --git a/patches/server/0594-Add-PlayerKickEvent-causes.patch b/patches/server/0594-Add-PlayerKickEvent-causes.patch index 5aa71148a3..d9189e2200 100644 --- a/patches/server/0594-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0594-Add-PlayerKickEvent-causes.patch @@ -48,7 +48,7 @@ index 96814e626a95e4e3c2f4df1a0339d37bb02f2e61..ba12919c3f9aec34a9e64993b143ae92 public boolean shouldDisconnect() { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 748a5d8add76d4533fae2647c6e2439f518ac211..bd176eb76afec5873e6f903ef66b0e6df3e6a02f 100644 +index 2a000635c18878377b2f434929e460e809b02cc4..6f2fcf39835d8a8b7408a39a511a2a9ee1e31248 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2236,7 +2236,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper - configurable tab spam limits -- server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper -+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause +- server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam"))); // Paper - AsyncTabCompleteEvent ++ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - AsyncTabCompleteEvent & kick event cause return; } // Paper start diff --git a/patches/server/0647-Add-critical-damage-API.patch b/patches/server/0647-Add-critical-damage-API.patch index d905b8772d..f4f5ef8bce 100644 --- a/patches/server/0647-Add-critical-damage-API.patch +++ b/patches/server/0647-Add-critical-damage-API.patch @@ -28,7 +28,7 @@ index df8c88bfa749e02f633350446101dcce05db7ac1..ed1277fad60992344b94f8a939febaca + // Paper end - add critical damage API } 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 322c8c437b4c5fa4a9db038736f24da24d45d646..30b603284e5fbc48ba7bc3cc6a69b8a4b94851a1 100644 +index 04b698ab61ab8cd7e6ee7159294e473e1608f2fd..85b616bf136535bac40693545cf68a768f4e343d 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1263,7 +1263,7 @@ public abstract class Player extends LivingEntity { @@ -38,7 +38,7 @@ index 322c8c437b4c5fa4a9db038736f24da24d45d646..30b603284e5fbc48ba7bc3cc6a69b8a4 - boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; + boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; // Paper - Add critical damage API; diff on change - flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper + flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits flag2 = flag2 && !this.isSprinting(); @@ -1303,7 +1303,7 @@ public abstract class Player extends LivingEntity { } @@ -71,7 +71,7 @@ index 004c130fc03dc01ef75fabdb4ef1ef711e33cb95..ae4319c2532855315bc45995a39d7eb9 int k = entity.getRemainingFireTicks(); boolean flag1 = entity.getType().is(EntityTypeTags.DEFLECTS_ARROWS); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 2da51dc36e21e45ecc3cbbe357947f8359e538eb..6423af82fbae4267d06229fde2390bfb5569137a 100644 +index 166035d8f708b94a9563c3802418ab6200071bc6..25133298b26523bd36300ab03e216200c915386b 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1043,7 +1043,7 @@ public class CraftEventFactory { diff --git a/patches/server/0668-Execute-chunk-tasks-mid-tick.patch b/patches/server/0668-Execute-chunk-tasks-mid-tick.patch index 918a696628..ee918bed7e 100644 --- a/patches/server/0668-Execute-chunk-tasks-mid-tick.patch +++ b/patches/server/0668-Execute-chunk-tasks-mid-tick.patch @@ -19,7 +19,7 @@ index 6b3cde6d4d1e63bec01f502f2027ee9fddac08aa..46449728f69ee7d4f78470f8da23c055 private MinecraftTimings() {} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index bd176eb76afec5873e6f903ef66b0e6df3e6a02f..ec48aea4e352e8ee3ad8cda8ce8ec33daf49dae8 100644 +index 6f2fcf39835d8a8b7408a39a511a2a9ee1e31248..fd23c278d38b1b8ed3c894f55e8907e259654558 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1341,8 +1341,79 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop void guardEntityTick(Consumer tickConsumer, T entity) { try { diff --git a/patches/server/0678-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch b/patches/server/0678-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch index b6f183623e..8695ea1b7a 100644 --- a/patches/server/0678-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch +++ b/patches/server/0678-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Don't respond to ServerboundCommandSuggestionPacket when diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 4a6a8de70c65ecae0a53df69881326b9b953b9e8..c84a8e6fc5f136b12bc542ec64a6686386bfe0cf 100644 +index 4f318c5e8a8cd2113d7b404aa97cdf03f7a87fd4..ff60a7951818341d5b279b51cdf3d0dd4d89bc26 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -733,6 +733,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -18,6 +18,6 @@ index 4a6a8de70c65ecae0a53df69881326b9b953b9e8..c84a8e6fc5f136b12bc542ec64a66863 + return; + } + // Paper end - Don't suggest if tab-complete is disabled - // Paper start - async tab completion + // Paper start - AsyncTabCompleteEvent TAB_COMPLETE_EXECUTOR.execute(() -> { StringReader stringreader = new StringReader(packet.getCommand()); diff --git a/patches/server/0959-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch b/patches/server/0959-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch index 48773be392..e176aff119 100644 --- a/patches/server/0959-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch +++ b/patches/server/0959-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Improve cancelling PreCreatureSpawnEvent with per player mob diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 6ccd2a5a334c846850a9d064210f2d7f1d311470..28ad811401cd46ec17fbec27b7e1111ead1d45e7 100644 +index 4a597dd278947c7992d3c09e0813780689cbd9ab..ebf69ec2830a3e3121707fd958f31180d361d9d0 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -386,8 +386,26 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -38,7 +38,7 @@ index 6ccd2a5a334c846850a9d064210f2d7f1d311470..28ad811401cd46ec17fbec27b7e1111e // Paper end - Optional per player mob spawns diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 32129fdd5b2542a0acb828fb843fa4e44533946c..dfecd5531862109cd89cfd8a041a8beef70c1a6a 100644 +index 816678438c1714a757e5d1eebc38f101a0692521..e3618e76f9ce4d585287d0754193c2793ba1e492 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -539,7 +539,17 @@ public class ServerChunkCache extends ChunkSource { @@ -61,7 +61,7 @@ index 32129fdd5b2542a0acb828fb843fa4e44533946c..dfecd5531862109cd89cfd8a041a8bee spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, null, true); } else { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index fb2ac7c4b9d938bc699ddc7475e2c3c3777cd056..ea76c2845965ceecce8a1c13f1a8454a088a5354 100644 +index e7f886074ddb4f5a7cb6a40c4fc57cf45418082d..f0b4c02b0c902a65f9cadfdb6ee7b451cf2cbe70 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -260,6 +260,7 @@ public class ServerPlayer extends Player { @@ -73,12 +73,12 @@ index fb2ac7c4b9d938bc699ddc7475e2c3c3777cd056..ea76c2845965ceecce8a1c13f1a8454a // CraftBukkit start public String displayName; diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index a9b452be0454082f7d62f19fbac574113ed2db64..ba67c55cde0120786e6705fed96fab4b611c1c75 100644 +index 5a4db70543ab446630c1cf0252496b57edc4252a..1712bd7c3a9b515c7bf8909f7392a385ef243ff9 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -277,6 +277,11 @@ public final class NaturalSpawner { - // Paper start + // Paper start - PreCreatureSpawnEvent PreSpawnStatus doSpawning = isValidSpawnPostitionForType(world, group, structuremanager, chunkgenerator, biomesettingsmobs_c, blockposition_mutableblockposition, d2); + // Paper start - per player mob count backoff + if (doSpawning == PreSpawnStatus.ABORT || doSpawning == PreSpawnStatus.CANCELLED) { diff --git a/patches/server/0994-Optimise-chunk-tick-iteration.patch b/patches/server/0994-Optimise-chunk-tick-iteration.patch index c8dc8078c6..a15bf7045b 100644 --- a/patches/server/0994-Optimise-chunk-tick-iteration.patch +++ b/patches/server/0994-Optimise-chunk-tick-iteration.patch @@ -108,7 +108,7 @@ index 2b998bdbe49bf8211b755e0eb7c1bf13ac280eab..627a88ec8c3b215b19b55a6d461c8754 List list; diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index c7d78fb217869204157606db8d6d73af0126a68f..6c28b37056c70fa0076b290b24168bfb79ddd77d 100644 +index 815fb04fb2d14d0cea14a2b3509e81b383bbdbda..ccf0308855d6549d70cf010fc57b76abfbe93f26 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -191,6 +191,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -187,7 +187,7 @@ index c80a625f7289e3bb33c6851d2072957e153ca1fb..7c425ac50c83757b66a2178bc19d4c92 public String getDebugStatus() { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index dfecd5531862109cd89cfd8a041a8beef70c1a6a..65a20974428ae1c0be2022d997234a16dc281292 100644 +index e3618e76f9ce4d585287d0754193c2793ba1e492..65a20974428ae1c0be2022d997234a16dc281292 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -516,18 +516,10 @@ public class ServerChunkCache extends ChunkSource { @@ -216,7 +216,7 @@ index dfecd5531862109cd89cfd8a041a8beef70c1a6a..65a20974428ae1c0be2022d997234a16 boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit - Util.shuffle(list, this.level.random); -- // Paper start - call player naturally spawn event +- // Paper start - PlayerNaturallySpawnCreaturesEvent - int chunkRange = level.spigotConfig.mobSpawnRange; - chunkRange = (chunkRange > level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange; - chunkRange = Math.min(chunkRange, 8); @@ -257,7 +257,7 @@ index dfecd5531862109cd89cfd8a041a8beef70c1a6a..65a20974428ae1c0be2022d997234a16 + player.lastEntitySpawnRadiusSquared = (double)((range << 4) * (range << 4)); // used in anyPlayerCloseEnoughForSpawning + player.playerNaturallySpawnedEvent = event; } -- // Paper end +- // Paper end - PlayerNaturallySpawnCreaturesEvent + // Paper end - optimise chunk tick iteration int l = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit @@ -365,7 +365,7 @@ index dfecd5531862109cd89cfd8a041a8beef70c1a6a..65a20974428ae1c0be2022d997234a16 gameprofilerfiller.pop(); } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 8afbf0d40af4040b18f68a549710112a0aa5fd00..575681586667933e7f26bb16f7d2aa7c73188cde 100644 +index a78ee295d14e0f4543b5bbdb7b72c6383a4fb23a..40632eabeb297f2cb2206d18cba7476bfb9f7ae8 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -325,6 +325,9 @@ public class ServerPlayer extends Player { diff --git a/patches/server/1025-Dont-resend-blocks-on-interactions.patch b/patches/server/1025-Dont-resend-blocks-on-interactions.patch index caa9e6f2e3..b6ecf3d30c 100644 --- a/patches/server/1025-Dont-resend-blocks-on-interactions.patch +++ b/patches/server/1025-Dont-resend-blocks-on-interactions.patch @@ -8,7 +8,7 @@ In general, the client now has an acknowledgment system which will prevent block It should be noted that this system does not yet support block entities, so those still need to resynced when needed. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 6abc5061888d965161de979465bb625c173c59c6..93906a31ddf99cf51541994d7a5c2e4131b697fa 100644 +index fd8a282e0a4316ed3fe51501151f8b49ce8ad0c4..cfd4ac06a9af6bf3fac293110482e1df690e075e 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java @@ -199,7 +199,7 @@ public class ServerPlayerGameMode { @@ -123,7 +123,7 @@ index 6abc5061888d965161de979465bb625c173c59c6..93906a31ddf99cf51541994d7a5c2e41 // send a correcting update to the client for the block above as well, this because of replaceable blocks (such as grass, sea grass etc) - player.connection.send(new ClientboundBlockUpdatePacket(world, blockposition.above())); + //player.connection.send(new ClientboundBlockUpdatePacket(world, blockposition.above())); // Paper - Don't resync blocks - // Paper start - extend Player Interact cancellation // TODO: consider merging this into the extracted method + // Paper start - extend Player Interact cancellation // TODO: consider merging this into the extracted method } else if (iblockdata.getBlock() instanceof net.minecraft.world.level.block.StructureBlock) { player.connection.send(new net.minecraft.network.protocol.game.ClientboundContainerClosePacket(this.player.containerMenu.containerId)); diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java diff --git a/patches/server/1032-Add-experience-points-API.patch b/patches/server/1032-Add-experience-points-API.patch index 29da9409a0..fe9eb0cc78 100644 --- a/patches/server/1032-Add-experience-points-API.patch +++ b/patches/server/1032-Add-experience-points-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add experience points API 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 7562b8a0f0bc8e43b3c0b64c6d66786c2c93b5cd..777043d4e4bd253a804353df3efad43078a5c3b3 100644 +index 276f6e650f6b6a4e14bdf3132533668382fb33b4..a0312dc208acda99b871cbd9e62f350e5899303f 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1833,7 +1833,7 @@ public abstract class Player extends LivingEntity { @@ -15,7 +15,7 @@ index 7562b8a0f0bc8e43b3c0b64c6d66786c2c93b5cd..777043d4e4bd253a804353df3efad430 - return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2); + return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2); // Paper - diff on change; calculateTotalExperiencePoints } - // Paper start - send SoundEffect to everyone who can see fromEntity + // Paper start - send while respecting visibility private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index fd67e7571841b345630078892e321283760341dd..b8d3398b349d9294de6b8a8594b054d3c84dbe0a 100644