From 0e2d6d6550df8b755df8cb57a16019a65e6a0d40 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Tue, 14 Mar 2023 20:24:52 +0100 Subject: [PATCH] More more more more patches --- patches/server/0010-Adventure.patch | 11 ++- patches/server/0159-Add-PlayerJumpEvent.patch | 4 +- .../0251-Inventory-removeItemAnySlot.patch | 2 +- ...loadChunk-int-int-false-load-unconve.patch | 2 +- ...-ray-tracing-methods-to-LivingEntity.patch | 6 +- ...e-attack-cooldown-methods-for-Player.patch | 4 +- .../server/0255-Improve-death-events.patch | 85 +++++++++--------- ...ow-chests-to-be-placed-with-NBT-data.patch | 4 +- .../server/0257-Mob-Pathfinding-API.patch | 0 ...-for-CanPlaceOn-and-CanDestroy-NBT-v.patch | 0 ...ent-chunk-loading-from-Fluid-Flowing.patch | 2 +- ...ent-Mob-AI-Rules-from-Loading-Chunks.patch | 8 +- ...wning-from-loading-generating-chunks.patch | 2 +- ...nt-furnace-cook-speed-multiplier-API.patch | 20 ++--- ...arseException-in-Entity-and-TE-names.patch | 4 +- .../0264-Honor-EntityAgeable.ageLock.patch | 4 +- ...ble-connection-throttle-kick-message.patch | 4 +- .../0266-Hook-into-CB-plugin-rewrites.patch | 0 .../server/0267-PreSpawnerSpawnEvent.patch | 2 +- ...268-Add-LivingEntity-getTargetEntity.patch | 8 +- .../server/0269-Add-sun-related-API.patch | 2 +- .../server/0270-Turtle-API.patch | 17 ++-- ...tator-target-events-and-improve-impl.patch | 52 +++++++++++ ...ther-worlds-for-shooter-of-projectil.patch | 4 +- .../server/0273-Add-more-Witch-API.patch | 6 +- ...owned-for-Villager-Aggression-Config.patch | 2 +- ...event-players-from-moving-into-unloa.patch | 12 +-- ...76-Reset-players-airTicks-on-respawn.patch | 4 +- ...-after-profile-lookups-if-not-needed.patch | 0 ...er-Thread-Pool-and-Thread-Priorities.patch | 10 +-- .../0279-Optimize-World-Time-Updates.patch | 4 +- ...store-custom-InventoryHolder-support.patch | 6 +- .../0281-Use-Vanilla-Minecart-Speeds.patch | 2 +- .../0282-Fix-SpongeAbsortEvent-handling.patch | 0 ...t-allow-digging-into-unloaded-chunks.patch | 4 +- ...ault-permission-message-configurable.patch | 4 +- ...Prevent-rayTrace-from-loading-chunks.patch | 2 +- ...e-Large-Packets-disconnecting-client.patch | 6 +- ...entity-dismount-during-teleportation.patch | 39 ++------ .../server/0288-Add-more-Zombie-API.patch | 0 .../server/0289-Book-Size-Limits.patch | 4 +- .../0290-Add-PlayerConnectionCloseEvent.patch | 4 +- ...Prevent-Enderman-from-loading-chunks.patch | 6 +- ...-replace-OfflinePlayer-getLastPlayed.patch | 18 ++-- ...vehicle-tracking-issue-on-disconnect.patch | 4 +- ...-remove-from-being-called-on-Players.patch | 4 +- .../server/0295-BlockDestroyEvent.patch | 6 +- .../0296-Async-command-map-building.patch | 10 +-- .../0297-Implement-Brigadier-Mojang-API.patch | 16 ++-- ...om-Shapeless-Custom-Crafting-Recipes.patch | 6 +- .../0299-Limit-Client-Sign-length-more.patch | 6 +- ...ConvertSigns-boolean-every-sign-save.patch | 0 ...-Manager-and-add-advanced-packet-sup.patch | 36 ++++---- ...le-Oversized-Tile-Entities-in-chunks.patch | 0 ...oggleEvent-when-whitelist-is-toggled.patch | 4 +- .../0304-Entity-getEntitySpawnReason.patch | 33 +++---- .../server/0305-Fire-event-on-GS4-query.patch | 0 ...306-Implement-PlayerPostRespawnEvent.patch | 8 +- ...-for-pickupDelay-breaks-picking-up-i.patch | 6 +- ...tator-target-events-and-improve-impl.patch | 89 ------------------- 60 files changed, 277 insertions(+), 331 deletions(-) rename patches/{unapplied => }/server/0251-Inventory-removeItemAnySlot.patch (96%) rename patches/{unapplied => }/server/0252-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch (92%) rename patches/{unapplied => }/server/0253-Add-ray-tracing-methods-to-LivingEntity.patch (91%) rename patches/{unapplied => }/server/0254-Expose-attack-cooldown-methods-for-Player.patch (86%) rename patches/{unapplied => }/server/0255-Improve-death-events.patch (85%) rename patches/{unapplied => }/server/0256-Allow-chests-to-be-placed-with-NBT-data.patch (91%) rename patches/{unapplied => }/server/0257-Mob-Pathfinding-API.patch (100%) rename patches/{unapplied => }/server/0258-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch (100%) rename patches/{unapplied => }/server/0259-Prevent-chunk-loading-from-Fluid-Flowing.patch (97%) rename patches/{unapplied => }/server/0260-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch (88%) rename patches/{unapplied => }/server/0261-Prevent-mob-spawning-from-loading-generating-chunks.patch (95%) rename patches/{unapplied => }/server/0262-Implement-furnace-cook-speed-multiplier-API.patch (91%) rename patches/{unapplied => }/server/0263-Catch-JsonParseException-in-Entity-and-TE-names.patch (97%) rename patches/{unapplied => }/server/0264-Honor-EntityAgeable.ageLock.patch (90%) rename patches/{unapplied => }/server/0265-Configurable-connection-throttle-kick-message.patch (91%) rename patches/{unapplied => }/server/0266-Hook-into-CB-plugin-rewrites.patch (100%) rename patches/{unapplied => }/server/0267-PreSpawnerSpawnEvent.patch (94%) rename patches/{unapplied => }/server/0268-Add-LivingEntity-getTargetEntity.patch (93%) rename patches/{unapplied => }/server/0269-Add-sun-related-API.patch (94%) rename patches/{unapplied => }/server/0270-Turtle-API.patch (87%) create mode 100644 patches/server/0271-Call-player-spectator-target-events-and-improve-impl.patch rename patches/{unapplied => }/server/0272-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch (89%) rename patches/{unapplied => }/server/0273-Add-more-Witch-API.patch (96%) rename patches/{unapplied => }/server/0274-Check-Drowned-for-Villager-Aggression-Config.patch (94%) rename patches/{unapplied => }/server/0275-Add-option-to-prevent-players-from-moving-into-unloa.patch (92%) rename patches/{unapplied => }/server/0276-Reset-players-airTicks-on-respawn.patch (83%) rename patches/{unapplied => }/server/0277-Don-t-sleep-after-profile-lookups-if-not-needed.patch (100%) rename patches/{unapplied => }/server/0278-Improve-Server-Thread-Pool-and-Thread-Priorities.patch (89%) rename patches/{unapplied => }/server/0279-Optimize-World-Time-Updates.patch (94%) rename patches/{unapplied => }/server/0280-Restore-custom-InventoryHolder-support.patch (98%) rename patches/{unapplied => }/server/0281-Use-Vanilla-Minecart-Speeds.patch (92%) rename patches/{unapplied => }/server/0282-Fix-SpongeAbsortEvent-handling.patch (100%) rename patches/{unapplied => }/server/0283-Don-t-allow-digging-into-unloaded-chunks.patch (96%) rename patches/{unapplied => }/server/0284-Make-the-default-permission-message-configurable.patch (92%) rename patches/{unapplied => }/server/0285-Prevent-rayTrace-from-loading-chunks.patch (94%) rename patches/{unapplied => }/server/0286-Handle-Large-Packets-disconnecting-client.patch (95%) rename patches/{unapplied => }/server/0287-force-entity-dismount-during-teleportation.patch (76%) rename patches/{unapplied => }/server/0288-Add-more-Zombie-API.patch (100%) rename patches/{unapplied => }/server/0289-Book-Size-Limits.patch (94%) rename patches/{unapplied => }/server/0290-Add-PlayerConnectionCloseEvent.patch (96%) rename patches/{unapplied => }/server/0291-Prevent-Enderman-from-loading-chunks.patch (90%) rename patches/{unapplied => }/server/0292-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch (90%) rename patches/{unapplied => }/server/0293-Workaround-for-vehicle-tracking-issue-on-disconnect.patch (85%) rename patches/{unapplied => }/server/0294-Block-Entity-remove-from-being-called-on-Players.patch (90%) rename patches/{unapplied => }/server/0295-BlockDestroyEvent.patch (91%) rename patches/{unapplied => }/server/0296-Async-command-map-building.patch (90%) rename patches/{unapplied => }/server/0297-Implement-Brigadier-Mojang-API.patch (95%) rename patches/{unapplied => }/server/0298-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch (92%) rename patches/{unapplied => }/server/0299-Limit-Client-Sign-length-more.patch (93%) rename patches/{unapplied => }/server/0300-Don-t-check-ConvertSigns-boolean-every-sign-save.patch (100%) rename patches/{unapplied => }/server/0301-Optimize-Network-Manager-and-add-advanced-packet-sup.patch (90%) rename patches/{unapplied => }/server/0302-Handle-Oversized-Tile-Entities-in-chunks.patch (100%) rename patches/{unapplied => }/server/0303-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch (82%) rename patches/{unapplied => }/server/0304-Entity-getEntitySpawnReason.patch (79%) rename patches/{unapplied => }/server/0305-Fire-event-on-GS4-query.patch (100%) rename patches/{unapplied => }/server/0306-Implement-PlayerPostRespawnEvent.patch (86%) rename patches/{unapplied => }/server/0307-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch (84%) delete mode 100644 patches/unapplied/server/0271-Call-player-spectator-target-events-and-improve-impl.patch diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index b25823f4e7..8c146210dd 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -2178,7 +2178,7 @@ index 7efd4be91e6ff0abf087bf4d322fd6ac694b7010..531d0b0dcd499adf0d973bf336272aa1 // CraftBukkit end this.chatVisibility = packet.chatVisibility(); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 000fd11480d783eab80a93fedde48f66e6b1298b..35f4ccc9d9f5798785c039354bd4e1e946f8c92f 100644 +index 000fd11480d783eab80a93fedde48f66e6b1298b..b3b6121dcfb6451d177431d51fa8a3e0975e4fbf 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -187,6 +187,8 @@ import net.minecraft.world.phys.shapes.VoxelShape; @@ -2190,6 +2190,15 @@ index 000fd11480d783eab80a93fedde48f66e6b1298b..35f4ccc9d9f5798785c039354bd4e1e9 import com.mojang.datafixers.util.Pair; import java.util.Arrays; import java.util.concurrent.ExecutionException; +@@ -250,7 +252,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + private static final int NO_BLOCK_UPDATES_TO_ACK = -1; + private static final int TRACKED_MESSAGE_DISCONNECT_THRESHOLD = 4096; + private static final Component CHAT_VALIDATION_FAILED = Component.translatable("multiplayer.disconnect.chat_validation_failed"); +- private final Connection connection; ++ public final Connection connection; // Paper + private final MinecraftServer server; + public ServerPlayer player; + private int tickCount; @@ -438,14 +440,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic return this.server.isSingleplayerOwner(this.player.getGameProfile()); } diff --git a/patches/server/0159-Add-PlayerJumpEvent.patch b/patches/server/0159-Add-PlayerJumpEvent.patch index 504ba8fd21..1748bdd936 100644 --- a/patches/server/0159-Add-PlayerJumpEvent.patch +++ b/patches/server/0159-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 38a45efcd2ff3cba9d2e15d7b6939c5ec873a1c5..5c60baafd997aed3168d60284dcbb2a3e002029c 100644 +index 2e1f0ac59da4ce1f66a4e720c275744a28191478..ed9653e713893c273ca54f20febc4541e8d7e471 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1287,7 +1287,34 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -37,7 +37,7 @@ index 38a45efcd2ff3cba9d2e15d7b6939c5ec873a1c5..5c60baafd997aed3168d60284dcbb2a3 + this.player.jumpFromGround(); + } else { + from = event.getFrom(); -+ this.internalTeleport(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch(), Collections.emptySet(), false); ++ this.internalTeleport(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch(), Collections.emptySet()); + return; + } + // Paper end diff --git a/patches/unapplied/server/0251-Inventory-removeItemAnySlot.patch b/patches/server/0251-Inventory-removeItemAnySlot.patch similarity index 96% rename from patches/unapplied/server/0251-Inventory-removeItemAnySlot.patch rename to patches/server/0251-Inventory-removeItemAnySlot.patch index 227c1336c2..a74c8bda54 100644 --- a/patches/unapplied/server/0251-Inventory-removeItemAnySlot.patch +++ b/patches/server/0251-Inventory-removeItemAnySlot.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Inventory#removeItemAnySlot diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java -index efa6b34261e3f4ad0d58a0c7d85df30f33a14d62..ce70a77ec6da41b59660f5923d30eaebf24c4cc2 100644 +index f8cfcecb0fc3377f750f124c8ff45be4c5bf78a1..ea04f0e1e9abf23e152070bd7ec2078e7dac2fe8 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -224,10 +224,16 @@ public class CraftInventory implements Inventory { diff --git a/patches/unapplied/server/0252-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch b/patches/server/0252-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch similarity index 92% rename from patches/unapplied/server/0252-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch rename to patches/server/0252-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch index f6e7802f6a..97454eaaf0 100644 --- a/patches/unapplied/server/0252-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch +++ b/patches/server/0252-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Make CraftWorld#loadChunk(int, int, false) load unconverted diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 78ca1045257fa0771ddea44629e09cfac8f88ca3..a6989383126d52f339917905b58c2afe943b4e7d 100644 +index 0c3c47bfa9af7d0780e60598b703e0d9f906ed9f..dfd87e2711e5bca09e29071375fec239e4e7538c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -391,7 +391,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/unapplied/server/0253-Add-ray-tracing-methods-to-LivingEntity.patch b/patches/server/0253-Add-ray-tracing-methods-to-LivingEntity.patch similarity index 91% rename from patches/unapplied/server/0253-Add-ray-tracing-methods-to-LivingEntity.patch rename to patches/server/0253-Add-ray-tracing-methods-to-LivingEntity.patch index 85b7cfde94..9dce967673 100644 --- a/patches/unapplied/server/0253-Add-ray-tracing-methods-to-LivingEntity.patch +++ b/patches/server/0253-Add-ray-tracing-methods-to-LivingEntity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add ray tracing methods to LivingEntity diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 19cd680bd77196b99767b274599e9eb5ead80192..49ae203d493b1d43ee5c3623f5317499ffe55523 100644 +index dd82cef26160a1794c47494c99c59eb329879b7b..d29519bd75e6e5a97b06aae86c485b49c4415fb8 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3772,6 +3772,20 @@ public abstract class LivingEntity extends Entity { +@@ -3732,6 +3732,20 @@ public abstract class LivingEntity extends Entity implements Attackable { } // Paper start @@ -30,7 +30,7 @@ index 19cd680bd77196b99767b274599e9eb5ead80192..49ae203d493b1d43ee5c3623f5317499 public int getShieldBlockingDelay() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 235e360df71b796a39d6c85530157097fd0c7b79..8c6592f989f982cf418690e2633bfba568f22227 100644 +index a9642e95cde4dc1c3cb9da50c921171c47665536..8601639fd5dfb7ce68d6bd7803efd10438338483 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -200,6 +200,33 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/unapplied/server/0254-Expose-attack-cooldown-methods-for-Player.patch b/patches/server/0254-Expose-attack-cooldown-methods-for-Player.patch similarity index 86% rename from patches/unapplied/server/0254-Expose-attack-cooldown-methods-for-Player.patch rename to patches/server/0254-Expose-attack-cooldown-methods-for-Player.patch index dcb8c2ce3c..2c4fd9760a 100644 --- a/patches/unapplied/server/0254-Expose-attack-cooldown-methods-for-Player.patch +++ b/patches/server/0254-Expose-attack-cooldown-methods-for-Player.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose attack cooldown methods for Player diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index d9a5a6719be998b9e40ab76519e4f207ee5c6bf9..c75fb5c096da9a20298ad857352298dbd5b5ef3f 100644 +index 1beecfc947f52467bd10e454877bc0678fd2dc41..2d704af9491bec382e00a40fde36c6e01c8484f2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2691,6 +2691,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2759,6 +2759,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return this.adventure$pointers; } diff --git a/patches/unapplied/server/0255-Improve-death-events.patch b/patches/server/0255-Improve-death-events.patch similarity index 85% rename from patches/unapplied/server/0255-Improve-death-events.patch rename to patches/server/0255-Improve-death-events.patch index 965cbff328..dccd479d40 100644 --- a/patches/unapplied/server/0255-Improve-death-events.patch +++ b/patches/server/0255-Improve-death-events.patch @@ -19,10 +19,10 @@ public net.minecraft.world.entity.LivingEntity getDeathSound()Lnet/minecraft/sou public net.minecraft.world.entity.LivingEntity getSoundVolume()F diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 20c4ba5d00f5a40f5c7da282c9c069b365273041..4c8b1d30b82fd7a87f79983577695c680013d3f4 100644 +index dad0368c8b55be018167bd8b113a80b7508647f1..77a74d41679e88d748d903295ac4f455e1f33b71 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -235,6 +235,10 @@ public class ServerPlayer extends Player { +@@ -240,6 +240,10 @@ public class ServerPlayer extends Player { public int latency; public boolean wonGame; private int containerUpdateDelay; // Paper @@ -33,7 +33,7 @@ index 20c4ba5d00f5a40f5c7da282c9c069b365273041..4c8b1d30b82fd7a87f79983577695c68 // CraftBukkit start public String displayName; -@@ -823,6 +827,15 @@ public class ServerPlayer extends Player { +@@ -828,6 +832,15 @@ public class ServerPlayer extends Player { String deathmessage = defaultMessage.getString(); this.keepLevel = keepInventory; // SPIGOT-2222: pre-set keepLevel org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, PaperAdventure.asAdventure(defaultMessage), defaultMessage.getString(), keepInventory); // Paper - Adventure @@ -49,7 +49,7 @@ index 20c4ba5d00f5a40f5c7da282c9c069b365273041..4c8b1d30b82fd7a87f79983577695c68 // SPIGOT-943 - only call if they have an inventory open if (this.containerMenu != this.inventoryMenu) { -@@ -968,8 +981,17 @@ public class ServerPlayer extends Player { +@@ -979,8 +992,17 @@ public class ServerPlayer extends Player { } } } @@ -70,10 +70,10 @@ index 20c4ba5d00f5a40f5c7da282c9c069b365273041..4c8b1d30b82fd7a87f79983577695c68 } } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 49ae203d493b1d43ee5c3623f5317499ffe55523..24a07ef9f5cbed34d1aefccda9fe655b7dfef7ec 100644 +index d29519bd75e6e5a97b06aae86c485b49c4415fb8..73cefc7ec582cb0fbfcff32cb9311f34ec2f31f0 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -263,6 +263,7 @@ public abstract class LivingEntity extends Entity { +@@ -258,6 +258,7 @@ public abstract class LivingEntity extends Entity implements Attackable { public Set collidableExemptions = new HashSet<>(); public boolean bukkitPickUpLoot; public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper @@ -81,7 +81,7 @@ index 49ae203d493b1d43ee5c3623f5317499ffe55523..24a07ef9f5cbed34d1aefccda9fe655b @Override public float getBukkitYaw() { -@@ -1466,13 +1467,12 @@ public abstract class LivingEntity extends Entity { +@@ -1455,13 +1456,12 @@ public abstract class LivingEntity extends Entity implements Attackable { if (knockbackCancelled) this.level.broadcastEntityEvent(this, (byte) 2); // Paper - Disable explosion knockback if (this.isDeadOrDying()) { if (!this.checkTotemDeathProtection(source)) { @@ -99,7 +99,7 @@ index 49ae203d493b1d43ee5c3623f5317499ffe55523..24a07ef9f5cbed34d1aefccda9fe655b } } else if (flag1) { this.playHurtSound(source); -@@ -1624,7 +1624,7 @@ public abstract class LivingEntity extends Entity { +@@ -1613,7 +1613,7 @@ public abstract class LivingEntity extends Entity implements Attackable { if (!this.isRemoved() && !this.dead) { Entity entity = damageSource.getEntity(); LivingEntity entityliving = this.getKillCredit(); @@ -108,7 +108,7 @@ index 49ae203d493b1d43ee5c3623f5317499ffe55523..24a07ef9f5cbed34d1aefccda9fe655b if (this.deathScore >= 0 && entityliving != null) { entityliving.awardKillScore(this, this.deathScore, damageSource); } -@@ -1636,20 +1636,53 @@ public abstract class LivingEntity extends Entity { +@@ -1625,20 +1625,53 @@ public abstract class LivingEntity extends Entity implements Attackable { if (!this.level.isClientSide && this.hasCustomName()) { if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot } @@ -168,7 +168,7 @@ index 49ae203d493b1d43ee5c3623f5317499ffe55523..24a07ef9f5cbed34d1aefccda9fe655b } } -@@ -1657,7 +1690,7 @@ public abstract class LivingEntity extends Entity { +@@ -1646,7 +1679,7 @@ public abstract class LivingEntity extends Entity implements Attackable { if (!this.level.isClientSide) { boolean flag = false; @@ -177,7 +177,7 @@ index 49ae203d493b1d43ee5c3623f5317499ffe55523..24a07ef9f5cbed34d1aefccda9fe655b if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { BlockPos blockposition = this.blockPosition(); BlockState iblockdata = Blocks.WITHER_ROSE.defaultBlockState(); -@@ -1686,7 +1719,11 @@ public abstract class LivingEntity extends Entity { +@@ -1675,7 +1708,11 @@ public abstract class LivingEntity extends Entity implements Attackable { } } @@ -190,7 +190,7 @@ index 49ae203d493b1d43ee5c3623f5317499ffe55523..24a07ef9f5cbed34d1aefccda9fe655b Entity entity = source.getEntity(); int i; -@@ -1701,18 +1738,27 @@ public abstract class LivingEntity extends Entity { +@@ -1690,18 +1727,27 @@ public abstract class LivingEntity extends Entity implements Attackable { this.dropEquipment(); // CraftBukkit - from below if (this.shouldDropLoot() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { this.dropFromLootTable(source, flag); @@ -220,10 +220,10 @@ index 49ae203d493b1d43ee5c3623f5317499ffe55523..24a07ef9f5cbed34d1aefccda9fe655b // CraftBukkit start public int getExpReward() { diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 6f728231a7b326e605d6ddb8e4cd6f0f0aec820b..f61a4409ebb5ed89e5a5cfe0488498a52faa2346 100644 +index e818687adf432e7ff47c8442ed2ea32d41c06b64..60d833bf8b7dcee046da9712a2dc809b05a31b42 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -1036,7 +1036,13 @@ public abstract class Mob extends LivingEntity { +@@ -1065,7 +1065,13 @@ public abstract class Mob extends LivingEntity implements Targeting { } this.spawnAtLocation(itemstack); @@ -238,10 +238,10 @@ index 6f728231a7b326e605d6ddb8e4cd6f0f0aec820b..f61a4409ebb5ed89e5a5cfe0488498a5 } diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java -index dd124ccbdc7efe0e41b3a04abddcb328cac44948..f4cfefd72704b3423392ffeb57e78c5d6410ff6f 100644 +index 13061aed29649acfc52d13207aaebcd8ba339ebe..73510697455d891af6858b9a8ad8ca0c9b74880f 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Fox.java +++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java -@@ -705,15 +705,25 @@ public class Fox extends Animal implements VariantHolder { +@@ -706,15 +706,25 @@ public class Fox extends Animal implements VariantHolder { } @Override @@ -271,7 +271,7 @@ index dd124ccbdc7efe0e41b3a04abddcb328cac44948..f4cfefd72704b3423392ffeb57e78c5d public static boolean isPathClear(Fox fox, LivingEntity chasedEntity) { diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java -index 65dd844b9b38730a819158e1023c4abd829b52bb..170411b42aeef69c796d1409b59c3eb69f78c710 100644 +index e763421e263d9ed7a67106495fda4b74745a67fc..36f949f6a66edab8373439ff450ad34fff6bae2d 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java @@ -69,11 +69,19 @@ public abstract class AbstractChestedHorse extends AbstractHorse { @@ -296,28 +296,33 @@ index 65dd844b9b38730a819158e1023c4abd829b52bb..170411b42aeef69c796d1409b59c3eb6 public void addAdditionalSaveData(CompoundTag nbt) { super.addAdditionalSaveData(nbt); diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -index f70f75867a8f03d42f240a0d007d2221269f2fdb..4edd48ce10caf31ac0136af35f19836b555675e5 100644 +index e38cbdff34479673f1640c46d727f1a807a609c7..dbb4bfb3d1f1ce2e435ca531be36ea448c0e3212 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -532,9 +532,9 @@ public class ArmorStand extends LivingEntity { - this.gameEvent(GameEvent.ENTITY_DAMAGE, source.getEntity()); - this.lastHit = i; - } else { -- this.brokenByPlayer(source); -+ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByPlayer(source); // Paper - this.showBreakingParticles(); -- this.discard(); // CraftBukkit - SPIGOT-4890: remain as this.die() since above damagesource method will call death event -+ if (!event.isCancelled()) this.discard(); // CraftBukkit - SPIGOT-4890: remain as this.die() since above damagesource method will call death event // Paper - } +@@ -542,8 +542,9 @@ public class ArmorStand extends LivingEntity { + this.gameEvent(GameEvent.ENTITY_DAMAGE, source.getEntity()); + this.lastHit = i; + } else { +- this.brokenByPlayer(source); ++ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByPlayer(source); // Paper + this.showBreakingParticles(); ++ if (!event.isCancelled()) // Paper + this.discard(); // CraftBukkit - SPIGOT-4890: remain as this.discard() since above damagesource method will call death event + } - return true; -@@ -594,12 +594,12 @@ public class ArmorStand extends LivingEntity { +@@ -605,7 +606,7 @@ public class ArmorStand extends LivingEntity { } - private void brokenByPlayer(DamageSource damageSource) { -+ private org.bukkit.event.entity.EntityDeathEvent brokenByPlayer(DamageSource damageSource) { // Paper - drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(new ItemStack(Items.ARMOR_STAND))); // CraftBukkit - add to drops ++ private org.bukkit.event.entity.EntityDeathEvent brokenByPlayer(DamageSource damageSource) { // Paper + ItemStack itemstack = new ItemStack(Items.ARMOR_STAND); + + if (this.hasCustomName()) { +@@ -613,10 +614,10 @@ public class ArmorStand extends LivingEntity { + } + + drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops - this.brokenByAnything(damageSource); + return this.brokenByAnything(damageSource); // Paper } @@ -327,7 +332,7 @@ index f70f75867a8f03d42f240a0d007d2221269f2fdb..4edd48ce10caf31ac0136af35f19836b this.playBrokenSound(); // this.dropAllDeathLoot(damagesource); // CraftBukkit - moved down -@@ -621,7 +621,7 @@ public class ArmorStand extends LivingEntity { +@@ -638,7 +639,7 @@ public class ArmorStand extends LivingEntity { this.armorItems.set(i, ItemStack.EMPTY); } } @@ -336,7 +341,7 @@ index f70f75867a8f03d42f240a0d007d2221269f2fdb..4edd48ce10caf31ac0136af35f19836b } -@@ -753,7 +753,8 @@ public class ArmorStand extends LivingEntity { +@@ -770,7 +771,8 @@ public class ArmorStand extends LivingEntity { @Override public void kill() { @@ -347,10 +352,10 @@ index f70f75867a8f03d42f240a0d007d2221269f2fdb..4edd48ce10caf31ac0136af35f19836b this.gameEvent(GameEvent.ENTITY_DIE); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index c75fb5c096da9a20298ad857352298dbd5b5ef3f..088a95b0f1574f293fe535b763c3768dbf95c9cc 100644 +index 2d704af9491bec382e00a40fde36c6e01c8484f2..e3239cfb4237163389313f88496ad5e69b891c86 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2194,7 +2194,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2262,7 +2262,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void sendHealthUpdate() { @@ -367,10 +372,10 @@ index c75fb5c096da9a20298ad857352298dbd5b5ef3f..088a95b0f1574f293fe535b763c3768d public void injectScaledMaxHealth(Collection collection, boolean force) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 67d820fb9aa00a3275cc3e23461864b496d738aa..6e533fdcd0671892a0e9dbfc99662feb433a5cf8 100644 +index c24e84e07f3f0d93da079ddf73e0e67b7d58fe8b..bdd4572489cd12ea19560fe82006e3fe4db29b50 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -807,9 +807,16 @@ public class CraftEventFactory { +@@ -806,9 +806,16 @@ public class CraftEventFactory { public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, List drops) { CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity(); EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward()); @@ -387,7 +392,7 @@ index 67d820fb9aa00a3275cc3e23461864b496d738aa..6e533fdcd0671892a0e9dbfc99662feb victim.expToDrop = event.getDroppedExp(); for (org.bukkit.inventory.ItemStack stack : event.getDrops()) { -@@ -826,8 +833,15 @@ public class CraftEventFactory { +@@ -825,8 +832,15 @@ public class CraftEventFactory { PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage, stringDeathMessage); // Paper - Adventure event.setKeepInventory(keepInventory); event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel @@ -403,7 +408,7 @@ index 67d820fb9aa00a3275cc3e23461864b496d738aa..6e533fdcd0671892a0e9dbfc99662feb victim.keepLevel = event.getKeepLevel(); victim.newLevel = event.getNewLevel(); -@@ -844,6 +858,31 @@ public class CraftEventFactory { +@@ -843,6 +857,31 @@ public class CraftEventFactory { return event; } diff --git a/patches/unapplied/server/0256-Allow-chests-to-be-placed-with-NBT-data.patch b/patches/server/0256-Allow-chests-to-be-placed-with-NBT-data.patch similarity index 91% rename from patches/unapplied/server/0256-Allow-chests-to-be-placed-with-NBT-data.patch rename to patches/server/0256-Allow-chests-to-be-placed-with-NBT-data.patch index cd457379f2..9f2f255d98 100644 --- a/patches/unapplied/server/0256-Allow-chests-to-be-placed-with-NBT-data.patch +++ b/patches/server/0256-Allow-chests-to-be-placed-with-NBT-data.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow chests to be placed with NBT data diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index cf47b0bed013b3242b516198ff7006aab5452d7e..00c438de76577e7b869270df16915d1ade088c9f 100644 +index 58de6780b208934af9fe608c8a47978392b5f6d2..fa83827a80335ac1075f28c9acdfe7ca2ada8790 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -369,6 +369,7 @@ public final class ItemStack { +@@ -370,6 +370,7 @@ public final class ItemStack { enuminteractionresult = InteractionResult.FAIL; // cancel placement // PAIL: Remove this when MC-99075 fixed placeEvent.getPlayer().updateInventory(); diff --git a/patches/unapplied/server/0257-Mob-Pathfinding-API.patch b/patches/server/0257-Mob-Pathfinding-API.patch similarity index 100% rename from patches/unapplied/server/0257-Mob-Pathfinding-API.patch rename to patches/server/0257-Mob-Pathfinding-API.patch diff --git a/patches/unapplied/server/0258-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch b/patches/server/0258-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch similarity index 100% rename from patches/unapplied/server/0258-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch rename to patches/server/0258-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch diff --git a/patches/unapplied/server/0259-Prevent-chunk-loading-from-Fluid-Flowing.patch b/patches/server/0259-Prevent-chunk-loading-from-Fluid-Flowing.patch similarity index 97% rename from patches/unapplied/server/0259-Prevent-chunk-loading-from-Fluid-Flowing.patch rename to patches/server/0259-Prevent-chunk-loading-from-Fluid-Flowing.patch index 707aec42a4..261d06e792 100644 --- a/patches/unapplied/server/0259-Prevent-chunk-loading-from-Fluid-Flowing.patch +++ b/patches/server/0259-Prevent-chunk-loading-from-Fluid-Flowing.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent chunk loading from Fluid Flowing diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java -index 6f6358b3b24686cd8995cd71b6f7209b4227fc48..fb0784c8a4950776bd270bec3c80a8c5856c2655 100644 +index f809a19afdfdb7df439e907531f54b2df1baf08c..00516a230073391b31795ec5af2aa7aa48db639a 100644 --- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java @@ -174,7 +174,8 @@ public abstract class FlowingFluid extends Fluid { diff --git a/patches/unapplied/server/0260-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch b/patches/server/0260-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch similarity index 88% rename from patches/unapplied/server/0260-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch rename to patches/server/0260-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch index 12a3938c2d..f3130fa3c3 100644 --- a/patches/unapplied/server/0260-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch +++ b/patches/server/0260-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent Mob AI Rules from Loading Chunks diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java -index 238c4225bbd4b12bd866603c6eb33182bc9dc89f..bd0cbf4390fc7d00b4bd5008cdf8f6f49df4f69b 100644 +index b26a6354eaf2a699ab10da71afafebc807b4b06d..d3e91faee8805e88d850740fb5de9e5c8288c48b 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java -@@ -133,7 +133,9 @@ public class RemoveBlockGoal extends MoveToBlockGoal { +@@ -129,7 +129,9 @@ public class RemoveBlockGoal extends MoveToBlockGoal { @Nullable private BlockPos getPosWithBlock(BlockPos pos, BlockGetter world) { @@ -19,7 +19,7 @@ index 238c4225bbd4b12bd866603c6eb33182bc9dc89f..bd0cbf4390fc7d00b4bd5008cdf8f6f4 return pos; } else { BlockPos[] ablockposition = new BlockPos[]{pos.below(), pos.west(), pos.east(), pos.north(), pos.south(), pos.below().below()}; -@@ -143,7 +145,8 @@ public class RemoveBlockGoal extends MoveToBlockGoal { +@@ -139,7 +141,8 @@ public class RemoveBlockGoal extends MoveToBlockGoal { for (int j = 0; j < i; ++j) { BlockPos blockposition1 = ablockposition1[j]; @@ -29,7 +29,7 @@ index 238c4225bbd4b12bd866603c6eb33182bc9dc89f..bd0cbf4390fc7d00b4bd5008cdf8f6f4 return blockposition1; } } -@@ -154,7 +157,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal { +@@ -150,7 +153,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal { @Override protected boolean isValidTarget(LevelReader world, BlockPos pos) { diff --git a/patches/unapplied/server/0261-Prevent-mob-spawning-from-loading-generating-chunks.patch b/patches/server/0261-Prevent-mob-spawning-from-loading-generating-chunks.patch similarity index 95% rename from patches/unapplied/server/0261-Prevent-mob-spawning-from-loading-generating-chunks.patch rename to patches/server/0261-Prevent-mob-spawning-from-loading-generating-chunks.patch index eb99a2e487..82476d43bf 100644 --- a/patches/unapplied/server/0261-Prevent-mob-spawning-from-loading-generating-chunks.patch +++ b/patches/server/0261-Prevent-mob-spawning-from-loading-generating-chunks.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Prevent mob spawning from loading/generating chunks also prevents if out of world border bounds diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 608be2b8bfff1b89855fc0bd181430d3a29a4cbb..c3d6b904f1310c93a3d5c1e5e3fab2f3476f5a48 100644 +index 5338e0e1a67925da0c386735a545bb31096afbb1..029835914c3c88811684e90b29bfed83191b3b3f 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -170,9 +170,9 @@ public final class NaturalSpawner { diff --git a/patches/unapplied/server/0262-Implement-furnace-cook-speed-multiplier-API.patch b/patches/server/0262-Implement-furnace-cook-speed-multiplier-API.patch similarity index 91% rename from patches/unapplied/server/0262-Implement-furnace-cook-speed-multiplier-API.patch rename to patches/server/0262-Implement-furnace-cook-speed-multiplier-API.patch index e5bcd76e59..781ffacd36 100644 --- a/patches/unapplied/server/0262-Implement-furnace-cook-speed-multiplier-API.patch +++ b/patches/server/0262-Implement-furnace-cook-speed-multiplier-API.patch @@ -11,10 +11,10 @@ to the nearest Integer when updating its current cook time. Modified by: Eric Su diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -index 8137682be60eb617738f7b257780a49182ef970c..196c99a2802c0bcaf93be287c404fc4f0f23eadd 100644 +index 4ed87cc5a46d9e10c755631a16f0e0cb388fb7f2..faa5beffb29e416f2a9af96ac66b5f88729e4705 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -76,11 +76,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -77,11 +77,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit protected NonNullList items; public int litTime; int litDuration; @@ -28,7 +28,7 @@ index 8137682be60eb617738f7b257780a49182ef970c..196c99a2802c0bcaf93be287c404fc4f protected AbstractFurnaceBlockEntity(BlockEntityType blockEntityType, BlockPos pos, BlockState state, RecipeType recipeType) { super(blockEntityType, pos, state); -@@ -127,6 +129,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -128,6 +130,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit }; this.recipesUsed = new Object2IntOpenHashMap(); this.quickCheck = RecipeManager.createCheck((RecipeType) recipeType); // CraftBukkit - decompile error // Eclipse fail @@ -36,7 +36,7 @@ index 8137682be60eb617738f7b257780a49182ef970c..196c99a2802c0bcaf93be287c404fc4f } public static Map getFuel() { -@@ -279,6 +282,11 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -280,6 +283,11 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit this.recipesUsed.put(new ResourceLocation(s), nbttagcompound1.getInt(s)); } @@ -48,7 +48,7 @@ index 8137682be60eb617738f7b257780a49182ef970c..196c99a2802c0bcaf93be287c404fc4f } @Override -@@ -287,6 +295,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -288,6 +296,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit nbt.putShort("BurnTime", (short) this.litTime); nbt.putShort("CookTime", (short) this.cookingProgress); nbt.putShort("CookTimeTotal", (short) this.cookingTotalTime); @@ -56,7 +56,7 @@ index 8137682be60eb617738f7b257780a49182ef970c..196c99a2802c0bcaf93be287c404fc4f ContainerHelper.saveAllItems(nbt, this.items); CompoundTag nbttagcompound1 = new CompoundTag(); -@@ -358,7 +367,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -359,7 +368,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit CraftItemStack source = CraftItemStack.asCraftMirror(blockEntity.items.get(0)); CookingRecipe recipe = (CookingRecipe) irecipe.toBukkitRecipe(); @@ -65,7 +65,7 @@ index 8137682be60eb617738f7b257780a49182ef970c..196c99a2802c0bcaf93be287c404fc4f world.getCraftServer().getPluginManager().callEvent(event); blockEntity.cookingTotalTime = event.getTotalCookTime(); -@@ -366,9 +375,9 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -367,9 +376,9 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit // CraftBukkit end ++blockEntity.cookingProgress; @@ -74,10 +74,10 @@ index 8137682be60eb617738f7b257780a49182ef970c..196c99a2802c0bcaf93be287c404fc4f blockEntity.cookingProgress = 0; - blockEntity.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity); + blockEntity.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity.recipeType, blockEntity, blockEntity.cookSpeedMultiplier); // Paper - if (AbstractFurnaceBlockEntity.burn(blockEntity.level, blockEntity.worldPosition, irecipe, blockEntity.items, i)) { // CraftBukkit + if (AbstractFurnaceBlockEntity.burn(blockEntity.level, blockEntity.worldPosition, world.registryAccess(), irecipe, blockEntity.items, i)) { // CraftBukkit blockEntity.setRecipeUsed(irecipe); } -@@ -468,9 +477,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -469,9 +478,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit } } @@ -93,7 +93,7 @@ index 8137682be60eb617738f7b257780a49182ef970c..196c99a2802c0bcaf93be287c404fc4f public static boolean isFuel(ItemStack stack) { return AbstractFurnaceBlockEntity.getFuel().containsKey(stack.getItem()); -@@ -539,7 +552,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -540,7 +553,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit } if (slot == 0 && !flag) { diff --git a/patches/unapplied/server/0263-Catch-JsonParseException-in-Entity-and-TE-names.patch b/patches/server/0263-Catch-JsonParseException-in-Entity-and-TE-names.patch similarity index 97% rename from patches/unapplied/server/0263-Catch-JsonParseException-in-Entity-and-TE-names.patch rename to patches/server/0263-Catch-JsonParseException-in-Entity-and-TE-names.patch index da983a9a4b..2d0f21e58d 100644 --- a/patches/unapplied/server/0263-Catch-JsonParseException-in-Entity-and-TE-names.patch +++ b/patches/server/0263-Catch-JsonParseException-in-Entity-and-TE-names.patch @@ -74,7 +74,7 @@ index 6b983e3e867bdd8cdffaf4575bbf67ad96b57ec7..66e2137f9379e885294f2b9f67f7e352 this.itemPatterns = nbt.getList("Patterns", 10); diff --git a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java -index 084e26de66c8204cb9aaad51bad3270228889ea3..a782994e2e53f2c4212c2d59ce740ebf00a826b0 100644 +index e85022b31f2bc2783e88f5ba4c5173ac8a096c96..f1acd19432877a833f0d4339f9de4830a0f7b890 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java @@ -31,7 +31,7 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co @@ -87,7 +87,7 @@ index 084e26de66c8204cb9aaad51bad3270228889ea3..a782994e2e53f2c4212c2d59ce740ebf } diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -index 3a17c143de499d81109ae7d6e9fe18718139c5b7..04c2872e2a492adef5aec98289a8cf2af6611757 100644 +index 05d98a0f34ffd50449fbafcf23fe7d05ca721317..34ec79a4298bff5ef6d751dc06b6439d0fa2e077 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java @@ -367,7 +367,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name diff --git a/patches/unapplied/server/0264-Honor-EntityAgeable.ageLock.patch b/patches/server/0264-Honor-EntityAgeable.ageLock.patch similarity index 90% rename from patches/unapplied/server/0264-Honor-EntityAgeable.ageLock.patch rename to patches/server/0264-Honor-EntityAgeable.ageLock.patch index 3c2db99373..c7c78c8f16 100644 --- a/patches/unapplied/server/0264-Honor-EntityAgeable.ageLock.patch +++ b/patches/server/0264-Honor-EntityAgeable.ageLock.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Honor EntityAgeable.ageLock diff --git a/src/main/java/net/minecraft/world/entity/AgeableMob.java b/src/main/java/net/minecraft/world/entity/AgeableMob.java -index 6113e05a0636cc4895bccfbf87eef306138bcd33..22ba53d9f8866327752b0c33b517adb02c50b684 100644 +index ea71049ebe3d135b4ff0a7b288221e2ceccd5035..63d5913c431e4cef733240a928465d90a542e6c7 100644 --- a/src/main/java/net/minecraft/world/entity/AgeableMob.java +++ b/src/main/java/net/minecraft/world/entity/AgeableMob.java -@@ -84,6 +84,7 @@ public abstract class AgeableMob extends PathfinderMob { +@@ -85,6 +85,7 @@ public abstract class AgeableMob extends PathfinderMob { } public void ageUp(int age, boolean overGrow) { diff --git a/patches/unapplied/server/0265-Configurable-connection-throttle-kick-message.patch b/patches/server/0265-Configurable-connection-throttle-kick-message.patch similarity index 91% rename from patches/unapplied/server/0265-Configurable-connection-throttle-kick-message.patch rename to patches/server/0265-Configurable-connection-throttle-kick-message.patch index 9f8db0014f..15deab12d8 100644 --- a/patches/unapplied/server/0265-Configurable-connection-throttle-kick-message.patch +++ b/patches/server/0265-Configurable-connection-throttle-kick-message.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable connection throttle kick message diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index a738b79e775a0a4abed1a05e12495d85f3de14bb..34e4d00ede62be50808a2782e54da987cc62c9af 100644 +index cca08b8c6e1e15f13326a2a7e33e7f3225ad894b..50521cbd2af1c723d7caaf298fd052af905802b6 100644 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -@@ -50,7 +50,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL +@@ -51,7 +51,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL synchronized (ServerHandshakePacketListenerImpl.throttleTracker) { if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) { ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime); diff --git a/patches/unapplied/server/0266-Hook-into-CB-plugin-rewrites.patch b/patches/server/0266-Hook-into-CB-plugin-rewrites.patch similarity index 100% rename from patches/unapplied/server/0266-Hook-into-CB-plugin-rewrites.patch rename to patches/server/0266-Hook-into-CB-plugin-rewrites.patch diff --git a/patches/unapplied/server/0267-PreSpawnerSpawnEvent.patch b/patches/server/0267-PreSpawnerSpawnEvent.patch similarity index 94% rename from patches/unapplied/server/0267-PreSpawnerSpawnEvent.patch rename to patches/server/0267-PreSpawnerSpawnEvent.patch index f70637147e..82ed7cac3c 100644 --- a/patches/unapplied/server/0267-PreSpawnerSpawnEvent.patch +++ b/patches/server/0267-PreSpawnerSpawnEvent.patch @@ -9,7 +9,7 @@ SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for spawners. diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 64d1f0ed579ef6f6f2e24e795d8dd0e1bdb5f39d..eab8634dbf5bbb7eaa65e7e9a3d4a94a2d45ea2a 100644 +index 4e1d28fbe67bc7a3d0741acd490be8db787480ae..405f36e9e115ad44bb91aad885785761786204ca 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -134,11 +134,11 @@ public abstract class BaseSpawner { diff --git a/patches/unapplied/server/0268-Add-LivingEntity-getTargetEntity.patch b/patches/server/0268-Add-LivingEntity-getTargetEntity.patch similarity index 93% rename from patches/unapplied/server/0268-Add-LivingEntity-getTargetEntity.patch rename to patches/server/0268-Add-LivingEntity-getTargetEntity.patch index 4c3e61ad03..90098a5317 100644 --- a/patches/unapplied/server/0268-Add-LivingEntity-getTargetEntity.patch +++ b/patches/server/0268-Add-LivingEntity-getTargetEntity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 24a07ef9f5cbed34d1aefccda9fe655b7dfef7ec..bd430a0bc14d5b1b991a0061e50223dd4ad208c2 100644 +index 73cefc7ec582cb0fbfcff32cb9311f34ec2f31f0..eb58b3230b46ade4403c31113d244b933b8a4a71 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -117,6 +117,7 @@ import net.minecraft.world.level.storage.loot.LootTable; +@@ -115,6 +115,7 @@ import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.AABB; @@ -16,7 +16,7 @@ index 24a07ef9f5cbed34d1aefccda9fe655b7dfef7ec..bd430a0bc14d5b1b991a0061e50223dd import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; import net.minecraft.world.scores.PlayerTeam; -@@ -3832,6 +3833,38 @@ public abstract class LivingEntity extends Entity { +@@ -3792,6 +3793,38 @@ public abstract class LivingEntity extends Entity implements Attackable { return level.clip(raytrace); } @@ -56,7 +56,7 @@ index 24a07ef9f5cbed34d1aefccda9fe655b7dfef7ec..bd430a0bc14d5b1b991a0061e50223dd public int getShieldBlockingDelay() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 8c6592f989f982cf418690e2633bfba568f22227..0541d68f6fc758ce5915fe906f7a44814c33b2d6 100644 +index 8601639fd5dfb7ce68d6bd7803efd10438338483..b19185c16f8fecbefef697017e8dcfd249306fe3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -1,5 +1,6 @@ diff --git a/patches/unapplied/server/0269-Add-sun-related-API.patch b/patches/server/0269-Add-sun-related-API.patch similarity index 94% rename from patches/unapplied/server/0269-Add-sun-related-API.patch rename to patches/server/0269-Add-sun-related-API.patch index 1ddddab912..964aca3d44 100644 --- a/patches/unapplied/server/0269-Add-sun-related-API.patch +++ b/patches/server/0269-Add-sun-related-API.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Add sun related API public net.minecraft.world.entity.Mob isSunBurnTick()Z diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index a6989383126d52f339917905b58c2afe943b4e7d..019bb773ced8f0a79611602906bad2366926d5ed 100644 +index dfd87e2711e5bca09e29071375fec239e4e7538c..3889e880e3a8a21e38d613c552829ad998c24fd5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -678,6 +678,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/unapplied/server/0270-Turtle-API.patch b/patches/server/0270-Turtle-API.patch similarity index 87% rename from patches/unapplied/server/0270-Turtle-API.patch rename to patches/server/0270-Turtle-API.patch index 2240894a89..cd1ffaa4f9 100644 --- a/patches/unapplied/server/0270-Turtle-API.patch +++ b/patches/server/0270-Turtle-API.patch @@ -25,10 +25,10 @@ index e3983370c09e3e3445c4557fcca50dd25f29cba0..6efba52c2e5d7811ee329ed22c1c76f7 private final int searchRange; private final int verticalSearchRange; diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java -index ab4e8ff5fe4f53bfda1d7b152aa89e6772bc3a16..30663713e198bfe40b95c48524b71ea65f39965e 100644 +index fb5af59559bc18ce2850d95ef73e5545dcab5ebc..b03c919edc33f308409ceeea0dd1064d1c6d7906 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java +++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java -@@ -482,14 +482,17 @@ public class Turtle extends Animal { +@@ -487,15 +487,18 @@ public class Turtle extends Animal { if (!this.turtle.isInWater() && this.isReachedTarget()) { if (this.turtle.layEggCounter < 1) { @@ -44,12 +44,13 @@ index ab4e8ff5fe4f53bfda1d7b152aa89e6772bc3a16..30663713e198bfe40b95c48524b71ea6 + com.destroystokyo.paper.event.entity.TurtleLayEggEvent layEggEvent = new com.destroystokyo.paper.event.entity.TurtleLayEggEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level, this.blockPos.above()), eggCount); + if (layEggEvent.callEvent() && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount())).isCancelled()) { world.playSound((Player) null, blockposition, SoundEvents.TURTLE_LAY_EGG, SoundSource.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F); -- world.setBlock(this.blockPos.above(), (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1), 3); -+ world.setBlock(this.blockPos.above(), (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount()), 3); - } - // CraftBukkit end - this.turtle.setHasEgg(false); -@@ -557,7 +560,7 @@ public class Turtle extends Animal { + BlockPos blockposition1 = this.blockPos.above(); +- BlockState iblockdata = (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1); ++ BlockState iblockdata = (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount()); // Paper + + world.setBlock(blockposition1, iblockdata, 3); + world.gameEvent(GameEvent.BLOCK_PLACE, blockposition1, GameEvent.Context.of(this.turtle, iblockdata)); +@@ -566,7 +569,7 @@ public class Turtle extends Animal { @Override public boolean canUse() { diff --git a/patches/server/0271-Call-player-spectator-target-events-and-improve-impl.patch b/patches/server/0271-Call-player-spectator-target-events-and-improve-impl.patch new file mode 100644 index 0000000000..1abb418d27 --- /dev/null +++ b/patches/server/0271-Call-player-spectator-target-events-and-improve-impl.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Caleb Bassham +Date: Fri, 28 Sep 2018 02:32:19 -0500 +Subject: [PATCH] Call player spectator target events and improve + implementation + +Use a proper teleport for teleporting to entities in different +worlds. + +Implementation improvements authored by Spottedleaf +Validate that the target entity is valid and deny spectate +requests from frozen players. + +Also, make sure the entity is spawned to the client before +sending the camera packet. If the entity isn't spawned clientside +when it receives the camera packet, then the client will not +spectate the target entity. + +Co-authored-by: Spottedleaf + +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java +index 77a74d41679e88d748d903295ac4f455e1f33b71..87b6f0d448b9ca40ab081d55f4309a6eed8cd830 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +@@ -1920,6 +1920,19 @@ public class ServerPlayer extends Player { + + this.camera = (Entity) (entity == null ? this : entity); + if (entity1 != this.camera) { ++ // Paper start - Add PlayerStartSpectatingEntityEvent and PlayerStopSpectatingEntity Event ++ if (this.camera == this) { ++ com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent playerStopSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity()); ++ if (!playerStopSpectatingEntityEvent.callEvent()) { ++ return; ++ } ++ } else { ++ com.destroystokyo.paper.event.player.PlayerStartSpectatingEntityEvent playerStartSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStartSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity(), entity.getBukkitEntity()); ++ if (!playerStartSpectatingEntityEvent.callEvent()) { ++ return; ++ } ++ } ++ // Paper end + Level world = this.camera.getLevel(); + + if (world instanceof ServerLevel) { +@@ -1935,7 +1948,6 @@ public class ServerPlayer extends Player { + this.connection.send(new ClientboundSetCameraPacket(this.camera)); + this.connection.resetPosition(); + } +- + } + + @Override diff --git a/patches/unapplied/server/0272-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch b/patches/server/0272-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch similarity index 89% rename from patches/unapplied/server/0272-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch rename to patches/server/0272-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch index ae8f72f216..5c14400166 100644 --- a/patches/unapplied/server/0272-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch +++ b/patches/server/0272-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch @@ -11,10 +11,10 @@ If the projectile fails to find the shooter in the current world, check other worlds. 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 ec5fc3293097b364b5f6d8acc756aa8adde15215..a904507707475e95b6389ccc437bd234b97c10cc 100644 +index 621ecd0f3cac52d3e4cecd003c67401ec7f0a6f7..a85175190c1ebb14b496a0bfe2f7136e06d0072c 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -@@ -58,6 +58,18 @@ public abstract class Projectile extends Entity { +@@ -60,6 +60,18 @@ public abstract class Projectile extends Entity implements TraceableEntity { return this.cachedOwner; } else if (this.ownerUUID != null && this.level instanceof ServerLevel) { this.cachedOwner = ((ServerLevel) this.level).getEntity(this.ownerUUID); diff --git a/patches/unapplied/server/0273-Add-more-Witch-API.patch b/patches/server/0273-Add-more-Witch-API.patch similarity index 96% rename from patches/unapplied/server/0273-Add-more-Witch-API.patch rename to patches/server/0273-Add-more-Witch-API.patch index 2eba0c4889..a470414cc9 100644 --- a/patches/unapplied/server/0273-Add-more-Witch-API.patch +++ b/patches/server/0273-Add-more-Witch-API.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Add more Witch API public net.minecraft.world.entity.monster.Witch usingTime diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java -index 1ee8fec8f9f581fa68497ebf4f90aad9d425ec71..b7bc64818387288955d0723cd071d4203bd2f121 100644 +index abbb077281eb8fc7961cf97ff23bb9822f2727f0..096546d7a97f031060bda7545aa620d522766719 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Witch.java +++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java -@@ -156,21 +156,24 @@ public class Witch extends Raider implements RangedAttackMob { +@@ -157,21 +157,24 @@ public class Witch extends Raider implements RangedAttackMob { } if (potionregistry != null) { @@ -47,7 +47,7 @@ index 1ee8fec8f9f581fa68497ebf4f90aad9d425ec71..b7bc64818387288955d0723cd071d420 } } -@@ -182,6 +185,24 @@ public class Witch extends Raider implements RangedAttackMob { +@@ -183,6 +186,24 @@ public class Witch extends Raider implements RangedAttackMob { super.aiStep(); } diff --git a/patches/unapplied/server/0274-Check-Drowned-for-Villager-Aggression-Config.patch b/patches/server/0274-Check-Drowned-for-Villager-Aggression-Config.patch similarity index 94% rename from patches/unapplied/server/0274-Check-Drowned-for-Villager-Aggression-Config.patch rename to patches/server/0274-Check-Drowned-for-Villager-Aggression-Config.patch index ec62c27d6f..bcd2061b77 100644 --- a/patches/unapplied/server/0274-Check-Drowned-for-Villager-Aggression-Config.patch +++ b/patches/server/0274-Check-Drowned-for-Villager-Aggression-Config.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Check Drowned for Villager Aggression Config diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java -index 2a3e9d3b847c155ba1d18c0711210c3e41bc3eac..1b1305f5eaf5710b72c57ab4c3953e703a23f1e0 100644 +index 966eb1e2fc747965d15bb1cfc0d812d10afbf43f..f00773e05654bdeb5463f448293aac99d2208813 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java +++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java @@ -78,7 +78,7 @@ public class Drowned extends Zombie implements RangedAttackMob { diff --git a/patches/unapplied/server/0275-Add-option-to-prevent-players-from-moving-into-unloa.patch b/patches/server/0275-Add-option-to-prevent-players-from-moving-into-unloa.patch similarity index 92% rename from patches/unapplied/server/0275-Add-option-to-prevent-players-from-moving-into-unloa.patch rename to patches/server/0275-Add-option-to-prevent-players-from-moving-into-unloa.patch index dd7ba785c8..4280f87eba 100644 --- a/patches/unapplied/server/0275-Add-option-to-prevent-players-from-moving-into-unloa.patch +++ b/patches/server/0275-Add-option-to-prevent-players-from-moving-into-unloa.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 23b56013e449ce4d6bd62096a20135adb87731eb..dc6a93405c4371d90ab7f5eaf11b6e105f791ad3 100644 +index ea9831f6915301a2c68b46fe0e8c981399fb01ae..e5c17c81b0265a9854a59779983f8af0e749dd99 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -563,9 +563,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -565,9 +565,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic double d0 = entity.getX(); double d1 = entity.getY(); double d2 = entity.getZ(); @@ -22,7 +22,7 @@ index 23b56013e449ce4d6bd62096a20135adb87731eb..dc6a93405c4371d90ab7f5eaf11b6e10 float f = Mth.wrapDegrees(packet.getYRot()); float f1 = Mth.wrapDegrees(packet.getXRot()); double d6 = d3 - this.vehicleFirstGoodX; -@@ -600,6 +600,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -602,6 +602,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } speed *= 2f; // TODO: Get the speed of the vehicle instead of the player @@ -39,7 +39,7 @@ index 23b56013e449ce4d6bd62096a20135adb87731eb..dc6a93405c4371d90ab7f5eaf11b6e10 if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { // CraftBukkit end ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8}); -@@ -1249,9 +1259,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1251,9 +1261,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.allowedPlayerTicks = 20; // CraftBukkit } else { this.awaitingTeleportTime = this.tickCount; @@ -52,13 +52,13 @@ index 23b56013e449ce4d6bd62096a20135adb87731eb..dc6a93405c4371d90ab7f5eaf11b6e10 float f = Mth.wrapDegrees(packet.getYRot(this.player.getYRot())); float f1 = Mth.wrapDegrees(packet.getXRot(this.player.getXRot())); -@@ -1307,6 +1317,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1309,6 +1319,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } else { speed = this.player.getAbilities().walkingSpeed * 10f; } + // Paper start - Prevent moving into unloaded chunks + if (player.level.paperConfig().chunks.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position())))) { -+ this.internalTeleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot(), Collections.emptySet(), true); ++ this.internalTeleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot(), Collections.emptySet()); + return; + } + // Paper end diff --git a/patches/unapplied/server/0276-Reset-players-airTicks-on-respawn.patch b/patches/server/0276-Reset-players-airTicks-on-respawn.patch similarity index 83% rename from patches/unapplied/server/0276-Reset-players-airTicks-on-respawn.patch rename to patches/server/0276-Reset-players-airTicks-on-respawn.patch index 009d7b5cf9..332487672c 100644 --- a/patches/unapplied/server/0276-Reset-players-airTicks-on-respawn.patch +++ b/patches/server/0276-Reset-players-airTicks-on-respawn.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reset players airTicks on respawn diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index fe6a36015533d31600798a8ef882356caa147274..f2d9a475c9e7eb5a9bccdc74f1e361c440285749 100644 +index 87b6f0d448b9ca40ab081d55f4309a6eed8cd830..bdc5cd6ec51ff64688c25a5a31882f5b1b6448af 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -2337,6 +2337,7 @@ public class ServerPlayer extends Player { +@@ -2330,6 +2330,7 @@ public class ServerPlayer extends Player { this.setHealth(this.getMaxHealth()); this.stopUsingItem(); // CraftBukkit - SPIGOT-6682: Clear active item on reset diff --git a/patches/unapplied/server/0277-Don-t-sleep-after-profile-lookups-if-not-needed.patch b/patches/server/0277-Don-t-sleep-after-profile-lookups-if-not-needed.patch similarity index 100% rename from patches/unapplied/server/0277-Don-t-sleep-after-profile-lookups-if-not-needed.patch rename to patches/server/0277-Don-t-sleep-after-profile-lookups-if-not-needed.patch diff --git a/patches/unapplied/server/0278-Improve-Server-Thread-Pool-and-Thread-Priorities.patch b/patches/server/0278-Improve-Server-Thread-Pool-and-Thread-Priorities.patch similarity index 89% rename from patches/unapplied/server/0278-Improve-Server-Thread-Pool-and-Thread-Priorities.patch rename to patches/server/0278-Improve-Server-Thread-Pool-and-Thread-Priorities.patch index 2b1e9c0b9a..baf878a915 100644 --- a/patches/unapplied/server/0278-Improve-Server-Thread-Pool-and-Thread-Priorities.patch +++ b/patches/server/0278-Improve-Server-Thread-Pool-and-Thread-Priorities.patch @@ -35,16 +35,14 @@ index 0000000000000000000000000000000000000000..b60f59cf5cc8eb84a6055b7861857dec + } +} diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index c085ed233eb4d1f2100ec23a77447ef799ecdf1f..8120739e2a7c4c86ecb7058f08bd8179d3a943b8 100644 +index 33ec55ed1f7d10a5235330ad082e7c7b54c42368..d5b37301d4e860c019105445001ed7a9a6f849bd 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -79,8 +79,8 @@ public class Util { +@@ -80,7 +80,7 @@ public class Util { private static final int DEFAULT_MAX_THREADS = 255; private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads"; private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1); -- private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap"); - private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main"); -+ private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap", -2); // Paper - add -2 priority + private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - add -1 priority // Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread public static final ExecutorService PROFILE_EXECUTOR = Executors.newFixedThreadPool(2, new java.util.concurrent.ThreadFactory() { @@ -81,10 +79,10 @@ index c085ed233eb4d1f2100ec23a77447ef799ecdf1f..8120739e2a7c4c86ecb7058f08bd8179 return executorService; } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index eef3b01d1304e06d0c9971df82af54d90676957a..2459fc1699582410b1fca4d787c6115563a575ba 100644 +index 8c64c3c1e33cb289ac2eb1b55e1febf6920fd4c6..52d602fdaad361deb3b3e0ff2b99b7808e4a32cf 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -317,6 +317,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> { +@@ -152,6 +152,15 @@ public class Connection extends SimpleChannelInboundHandler> { } public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) { @@ -27,7 +27,7 @@ index a31820cb543f3e72e461c91b3191b56b18fb33dd..0e739c0c54eaad5ab8dddcd8294c9cca Connection.LOGGER.debug("Skipping packet due to errors", throwable.getCause()); } else { diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java -index 00d432bd395e7f7fb6ee24e371818d13892b2f0c..5fce1177e7198d791d4ab1c64b394c5b1c145782 100644 +index 42828edf81bd475b673a9d143f79c0d0711f14f5..ebee957fb048da6ffcd2a5ba2ed989ed1a6634e9 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java @@ -54,7 +54,31 @@ public class PacketEncoder extends MessageToByteEncoder> { diff --git a/patches/unapplied/server/0287-force-entity-dismount-during-teleportation.patch b/patches/server/0287-force-entity-dismount-during-teleportation.patch similarity index 76% rename from patches/unapplied/server/0287-force-entity-dismount-during-teleportation.patch rename to patches/server/0287-force-entity-dismount-during-teleportation.patch index c8fc4e85e0..c76f2484a3 100644 --- a/patches/unapplied/server/0287-force-entity-dismount-during-teleportation.patch +++ b/patches/server/0287-force-entity-dismount-during-teleportation.patch @@ -19,32 +19,11 @@ this is going to be the best soultion all around. Improvements/suggestions welcome! -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index f2d9a475c9e7eb5a9bccdc74f1e361c440285749..4f851879aaea3b604e45c2f608edd3c2972bd038 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1366,11 +1366,13 @@ public class ServerPlayer extends Player { - } - } - -- @Override -- public void stopRiding() { -+ // Paper start -+ @Override public void stopRiding() { stopRiding(false); } -+ @Override public void stopRiding(boolean suppressCancellation) { -+ // Paper end - Entity entity = this.getVehicle(); - -- super.stopRiding(); -+ super.stopRiding(suppressCancellation); // Paper - Entity entity1 = this.getVehicle(); - - if (entity1 != entity && this.connection != null) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 5116be3075c1249254524bf6a5b6bc28c61400e6..6d7632ca9b8b63be637c89b374b8769ab01e91cb 100644 +index 8663ea3cc8d5672b03b4b8345d7d970fcbc6a80b..b4929ecb7e49266b88eec433a65fd8cf049dd805 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2405,11 +2405,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2422,11 +2422,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } public void removeVehicle() { @@ -62,7 +41,7 @@ index 5116be3075c1249254524bf6a5b6bc28c61400e6..6d7632ca9b8b63be637c89b374b8769a } } -@@ -2476,7 +2481,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2490,7 +2495,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return true; // CraftBukkit } @@ -74,7 +53,7 @@ index 5116be3075c1249254524bf6a5b6bc28c61400e6..6d7632ca9b8b63be637c89b374b8769a if (entity.getVehicle() == this) { throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); } else { -@@ -2486,7 +2494,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2500,7 +2508,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { VehicleExitEvent event = new VehicleExitEvent( (Vehicle) this.getBukkitEntity(), @@ -83,7 +62,7 @@ index 5116be3075c1249254524bf6a5b6bc28c61400e6..6d7632ca9b8b63be637c89b374b8769a ); // Suppress during worldgen if (this.valid) { -@@ -2500,7 +2508,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2514,7 +2522,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } // CraftBukkit end // Spigot start @@ -93,10 +72,10 @@ index 5116be3075c1249254524bf6a5b6bc28c61400e6..6d7632ca9b8b63be637c89b374b8769a if (this.valid) { Bukkit.getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index bd430a0bc14d5b1b991a0061e50223dd4ad208c2..3989a06970c896fedcd912eeaaca8945e3067858 100644 +index eb58b3230b46ade4403c31113d244b933b8a4a71..69fbbd2745008e2d9caf6a30dd0779339e1c685b 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3432,9 +3432,15 @@ public abstract class LivingEntity extends Entity { +@@ -3396,9 +3396,15 @@ public abstract class LivingEntity extends Entity implements Attackable { @Override public void stopRiding() { @@ -114,10 +93,10 @@ index bd430a0bc14d5b1b991a0061e50223dd4ad208c2..3989a06970c896fedcd912eeaaca8945 this.dismountVehicle(entity); } 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 48b18b824935ef922fe9f7e5860f923688a0ccc0..6f3d06b929e9b5c22b3090683d5eb90bc3c98421 100644 +index ad000e1f7fb6b3d3ec423b6e3d44efdb46f69849..65adadd9e35f2ec6c10acd24ebf61e3cfba173e4 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -1142,7 +1142,13 @@ public abstract class Player extends LivingEntity { +@@ -1141,7 +1141,13 @@ public abstract class Player extends LivingEntity { @Override public void removeVehicle() { diff --git a/patches/unapplied/server/0288-Add-more-Zombie-API.patch b/patches/server/0288-Add-more-Zombie-API.patch similarity index 100% rename from patches/unapplied/server/0288-Add-more-Zombie-API.patch rename to patches/server/0288-Add-more-Zombie-API.patch diff --git a/patches/unapplied/server/0289-Book-Size-Limits.patch b/patches/server/0289-Book-Size-Limits.patch similarity index 94% rename from patches/unapplied/server/0289-Book-Size-Limits.patch rename to patches/server/0289-Book-Size-Limits.patch index 435355d419..064858810e 100644 --- a/patches/unapplied/server/0289-Book-Size-Limits.patch +++ b/patches/server/0289-Book-Size-Limits.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Book Size Limits Puts some limits on the size of books. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e143fb922a0351f3fbf5c0c208916930a772c006..dcaa912fc785620d0458a35144becd0ae0a552d7 100644 +index 43304fd4aba9c5d3d31499b813c9c39934918cea..fc36fb064dc09ea97062fcb782422821ff24940b 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1116,6 +1116,45 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1118,6 +1118,45 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleEditBook(ServerboundEditBookPacket packet) { diff --git a/patches/unapplied/server/0290-Add-PlayerConnectionCloseEvent.patch b/patches/server/0290-Add-PlayerConnectionCloseEvent.patch similarity index 96% rename from patches/unapplied/server/0290-Add-PlayerConnectionCloseEvent.patch rename to patches/server/0290-Add-PlayerConnectionCloseEvent.patch index 131d6663d3..34fbbdfdf1 100644 --- a/patches/unapplied/server/0290-Add-PlayerConnectionCloseEvent.patch +++ b/patches/server/0290-Add-PlayerConnectionCloseEvent.patch @@ -39,10 +39,10 @@ public net.minecraft.server.network.ServerLoginPacketListenerImpl state public net.minecraft.server.network.ServerLoginPacketListenerImpl gameProfile diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 0e739c0c54eaad5ab8dddcd8294c9ccaa3697fbf..8b1c39cc7f77ca36d0341fb68de1441cc61f19e4 100644 +index f70d81e1a779da840b636b36a913a0dca9427c94..62ee5e32ac0f5d244fa55f9fe45d34cf4d2becaa 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -469,6 +469,26 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -487,6 +487,26 @@ public class Connection extends SimpleChannelInboundHandler> { this.getPacketListener().onDisconnect(Component.translatable("multiplayer.disconnect.generic")); } this.queue.clear(); // Free up packet queue. diff --git a/patches/unapplied/server/0291-Prevent-Enderman-from-loading-chunks.patch b/patches/server/0291-Prevent-Enderman-from-loading-chunks.patch similarity index 90% rename from patches/unapplied/server/0291-Prevent-Enderman-from-loading-chunks.patch rename to patches/server/0291-Prevent-Enderman-from-loading-chunks.patch index d38857d1a8..7a44b0f525 100644 --- a/patches/unapplied/server/0291-Prevent-Enderman-from-loading-chunks.patch +++ b/patches/server/0291-Prevent-Enderman-from-loading-chunks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent Enderman from loading chunks 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 4fcd5e1e0641474beeaa834adce73ba10065e34e..1d8cf9b765f9c55feeb26e4ba4aa969be142dc3f 100644 +index 908ef284f17296c72009a5803dfefff13664fb1c..c8fe9126f0b6e973aae04d825613fcf67e0838d2 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -@@ -509,7 +509,8 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -506,7 +506,8 @@ public class EnderMan extends Monster implements NeutralMob { int j = Mth.floor(this.enderman.getY() + randomsource.nextDouble() * 2.0D); int k = Mth.floor(this.enderman.getZ() - 1.0D + randomsource.nextDouble() * 2.0D); BlockPos blockposition = new BlockPos(i, j, k); @@ -18,7 +18,7 @@ index 4fcd5e1e0641474beeaa834adce73ba10065e34e..1d8cf9b765f9c55feeb26e4ba4aa969b BlockPos blockposition1 = blockposition.below(); BlockState iblockdata1 = world.getBlockState(blockposition1); BlockState iblockdata2 = this.enderman.getCarriedBlock(); -@@ -555,7 +556,8 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -552,7 +553,8 @@ public class EnderMan extends Monster implements NeutralMob { int j = Mth.floor(this.enderman.getY() + randomsource.nextDouble() * 3.0D); int k = Mth.floor(this.enderman.getZ() - 2.0D + randomsource.nextDouble() * 4.0D); BlockPos blockposition = new BlockPos(i, j, k); diff --git a/patches/unapplied/server/0292-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch b/patches/server/0292-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch similarity index 90% rename from patches/unapplied/server/0292-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch rename to patches/server/0292-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch index c871008098..d23d6759a5 100644 --- a/patches/unapplied/server/0292-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch +++ b/patches/server/0292-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch @@ -16,10 +16,10 @@ intent to remove) and replace it with two new methods, clearly named and documented as to their purpose. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 4f851879aaea3b604e45c2f608edd3c2972bd038..c0ba5e308d8ef8333eeea6217f95022cf59c76b7 100644 +index bdc5cd6ec51ff64688c25a5a31882f5b1b6448af..3ff9823da9e906189f1bd4fa98838de5dcfc428a 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -235,6 +235,7 @@ public class ServerPlayer extends Player { +@@ -240,6 +240,7 @@ public class ServerPlayer extends Player { public int latency; public boolean wonGame; private int containerUpdateDelay; // Paper @@ -28,10 +28,10 @@ index 4f851879aaea3b604e45c2f608edd3c2972bd038..c0ba5e308d8ef8333eeea6217f95022c public boolean queueHealthUpdatePacket = false; public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index d1d5e0deb0dd8963424db6fc7a353c4ed397bb98..bcfd6751100bcc689d6eb0669e14fa91d5c4b919 100644 +index ab83fc7c8903ed4a71824c5dcc85b9764c6c5690..c291339e448cb87c42b7daf5a3c67869c7412d0b 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -185,6 +185,7 @@ public abstract class PlayerList { +@@ -186,6 +186,7 @@ public abstract class PlayerList { public void placeNewPlayer(Connection connection, ServerPlayer player) { player.isRealPlayer = true; // Paper @@ -106,10 +106,10 @@ index 69a1852905dd4724c30ac8ab88c14251eee2c371..17b3d5de58a9ef3acc67624c46cd6bbd public Location getLastDeathLocation() { if (this.getData().contains("LastDeathLocation", 10)) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 088a95b0f1574f293fe535b763c3768dbf95c9cc..3f23d3bc3b35b48f3c8962b2622c54dbb675e02d 100644 +index e3239cfb4237163389313f88496ad5e69b891c86..5fa39672210af814e078a1463d493bfb114efc66 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -176,6 +176,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -177,6 +177,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { private org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus; private String resourcePackHash; private static final boolean DISABLE_CHANNEL_LIMIT = System.getProperty("paper.disableChannelLimit") != null; // Paper - add a flag to disable the channel limit @@ -117,7 +117,7 @@ index 088a95b0f1574f293fe535b763c3768dbf95c9cc..3f23d3bc3b35b48f3c8962b2622c54db // Paper end public CraftPlayer(CraftServer server, ServerPlayer entity) { -@@ -1806,6 +1807,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1874,6 +1875,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.firstPlayed = firstPlayed; } @@ -136,7 +136,7 @@ index 088a95b0f1574f293fe535b763c3768dbf95c9cc..3f23d3bc3b35b48f3c8962b2622c54db public void readExtraData(CompoundTag nbttagcompound) { this.hasPlayedBefore = true; if (nbttagcompound.contains("bukkit")) { -@@ -1828,6 +1841,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1896,6 +1909,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void setExtraData(CompoundTag nbttagcompound) { @@ -145,7 +145,7 @@ index 088a95b0f1574f293fe535b763c3768dbf95c9cc..3f23d3bc3b35b48f3c8962b2622c54db if (!nbttagcompound.contains("bukkit")) { nbttagcompound.put("bukkit", new CompoundTag()); } -@@ -1842,6 +1857,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1910,6 +1925,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { data.putLong("firstPlayed", this.getFirstPlayed()); data.putLong("lastPlayed", System.currentTimeMillis()); data.putString("lastKnownName", handle.getScoreboardName()); diff --git a/patches/unapplied/server/0293-Workaround-for-vehicle-tracking-issue-on-disconnect.patch b/patches/server/0293-Workaround-for-vehicle-tracking-issue-on-disconnect.patch similarity index 85% rename from patches/unapplied/server/0293-Workaround-for-vehicle-tracking-issue-on-disconnect.patch rename to patches/server/0293-Workaround-for-vehicle-tracking-issue-on-disconnect.patch index 8042fdbbd2..a46c43c661 100644 --- a/patches/unapplied/server/0293-Workaround-for-vehicle-tracking-issue-on-disconnect.patch +++ b/patches/server/0293-Workaround-for-vehicle-tracking-issue-on-disconnect.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Workaround for vehicle tracking issue on disconnect diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index c0ba5e308d8ef8333eeea6217f95022cf59c76b7..d6aa16ccb18e1aac0e2c59e3fb83bea87572aa7c 100644 +index 3ff9823da9e906189f1bd4fa98838de5dcfc428a..8d4cddb68fd074d7a8ca4986a86d378434cb5fb5 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1609,6 +1609,13 @@ public class ServerPlayer extends Player { +@@ -1585,6 +1585,13 @@ public class ServerPlayer extends Player { public void disconnect() { this.disconnected = true; this.ejectPassengers(); diff --git a/patches/unapplied/server/0294-Block-Entity-remove-from-being-called-on-Players.patch b/patches/server/0294-Block-Entity-remove-from-being-called-on-Players.patch similarity index 90% rename from patches/unapplied/server/0294-Block-Entity-remove-from-being-called-on-Players.patch rename to patches/server/0294-Block-Entity-remove-from-being-called-on-Players.patch index 41a375e16e..56bdcee041 100644 --- a/patches/unapplied/server/0294-Block-Entity-remove-from-being-called-on-Players.patch +++ b/patches/server/0294-Block-Entity-remove-from-being-called-on-Players.patch @@ -12,10 +12,10 @@ Player we will look at limiting the scope of this change. It appears to be unintentional in the few cases we've seen so far. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 3f23d3bc3b35b48f3c8962b2622c54dbb675e02d..d21faa3e7a97c28e380323b503d32de5e5705d11 100644 +index 5fa39672210af814e078a1463d493bfb114efc66..bb9940422a87e5d97a7c2d3ed368644074e9348c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2738,6 +2738,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2806,6 +2806,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void resetCooldown() { getHandle().resetAttackStrengthTicker(); } diff --git a/patches/unapplied/server/0295-BlockDestroyEvent.patch b/patches/server/0295-BlockDestroyEvent.patch similarity index 91% rename from patches/unapplied/server/0295-BlockDestroyEvent.patch rename to patches/server/0295-BlockDestroyEvent.patch index 04b2af5f9b..bd1f7f6722 100644 --- a/patches/unapplied/server/0295-BlockDestroyEvent.patch +++ b/patches/server/0295-BlockDestroyEvent.patch @@ -11,10 +11,10 @@ floating in the air. This can replace many uses of BlockPhysicsEvent diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 01e8a8c36645efc9b728c6c58e12f594d619f5a5..dcbd8afb4d6fcf509bbb66788f55e83f2faa6f90 100644 +index e7e069ea6b5fc20225e6fabd98e0ffb6de497ce2..d0fe8a99163c924c44983a9a575bd76714865cab 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -29,6 +29,7 @@ import net.minecraft.nbt.CompoundTag; +@@ -30,6 +30,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.Packet; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -22,7 +22,7 @@ index 01e8a8c36645efc9b728c6c58e12f594d619f5a5..dcbd8afb4d6fcf509bbb66788f55e83f import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ChunkHolder; import net.minecraft.server.level.ServerLevel; -@@ -583,8 +584,21 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -589,8 +590,21 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return false; } else { FluidState fluid = this.getFluidState(pos); diff --git a/patches/unapplied/server/0296-Async-command-map-building.patch b/patches/server/0296-Async-command-map-building.patch similarity index 90% rename from patches/unapplied/server/0296-Async-command-map-building.patch rename to patches/server/0296-Async-command-map-building.patch index ec27e4685d..27cc07cb36 100644 --- a/patches/unapplied/server/0296-Async-command-map-building.patch +++ b/patches/server/0296-Async-command-map-building.patch @@ -9,10 +9,10 @@ commands if the server is restarting. Using the default async pool caused issues due to the shutdown logic generally being much later. diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 4cf76403098cc8565199b29757a29c80150bbaae..b21bcb046ec801a4cb5395034be60d0eb19888eb 100644 +index 7f561ab6e56cd1749da8eff950080d3ae3f5e028..286dab2ed3c6b962c9702b8b10105e1456b04f7b 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -390,6 +390,24 @@ public class Commands { +@@ -396,6 +396,24 @@ public class Commands { if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot // CraftBukkit start // Register Vanilla commands into builtRoot as before @@ -37,7 +37,7 @@ index 4cf76403098cc8565199b29757a29c80150bbaae..b21bcb046ec801a4cb5395034be60d0e Map, CommandNode> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues RootCommandNode vanillaRoot = new RootCommandNode(); -@@ -407,7 +425,14 @@ public class Commands { +@@ -413,7 +431,14 @@ public class Commands { for (CommandNode node : rootcommandnode.getChildren()) { bukkit.add(node.getName()); } @@ -53,10 +53,10 @@ index 4cf76403098cc8565199b29757a29c80150bbaae..b21bcb046ec801a4cb5395034be60d0e event.getPlayer().getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 18ff46d66b1ffd6871fc2b16314d1b3383eb5cdd..038e98c708f9fac8ab6109d02b0297a1d008710c 100644 +index fc76ec97536e5f520b556453f7fcb7aa7572cb19..ca2a2b1f54f06f9035be8b379fad580128811fc2 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -897,6 +897,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { runSync(player, bukkit, rootcommandnode); }); -@@ -433,6 +434,7 @@ public class Commands { +@@ -439,6 +440,7 @@ public class Commands { private void runSync(ServerPlayer player, Collection bukkit, RootCommandNode rootcommandnode) { // Paper end - Async command map building @@ -118,7 +118,7 @@ index b21bcb046ec801a4cb5395034be60d0eb19888eb..2f256d0452617c8f2630f0dd8f16025c PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit)); event.getPlayer().getServer().getPluginManager().callEvent(event); -@@ -451,6 +453,11 @@ public class Commands { +@@ -457,6 +459,11 @@ public class Commands { while (iterator.hasNext()) { CommandNode commandnode2 = (CommandNode) iterator.next(); @@ -131,10 +131,10 @@ index b21bcb046ec801a4cb5395034be60d0eb19888eb..2f256d0452617c8f2630f0dd8f16025c 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 dcaa912fc785620d0458a35144becd0ae0a552d7..8c773cfefbe14f74db455594ec833ca62d7b9e74 100644 +index fc36fb064dc09ea97062fcb782422821ff24940b..773170c5443dce6e64762e4504d222a5b5bb8ae3 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -828,8 +828,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -830,8 +830,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic ParseResults parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { @@ -149,7 +149,7 @@ index dcaa912fc785620d0458a35144becd0ae0a552d7..8c773cfefbe14f74db455594ec833ca6 }); }); } -@@ -844,7 +848,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -846,7 +850,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic builder.suggest(completion.suggestion(), PaperAdventure.asVanilla(completion.tooltip())); } }); diff --git a/patches/unapplied/server/0298-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch b/patches/server/0298-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch similarity index 92% rename from patches/unapplied/server/0298-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch rename to patches/server/0298-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch index 7c7963c4c2..210e7f09f5 100644 --- a/patches/unapplied/server/0298-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch +++ b/patches/server/0298-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch @@ -10,10 +10,10 @@ This made the Bukkit RecipeChoice API not work for Shapeless. This reimplements vanilla logic using the same test logic as Shaped diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java -index dc4d3034b193562c70a929f0af9420a1e6728f13..e7c06d98532160499f2610f69de27e30a326b16f 100644 +index 95eb0d2c624f196e4c4d3d4367a47af881e946a8..f4f3f3a19d3cadaef1ae1a47daa68251a983dcf2 100644 --- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java -@@ -84,16 +84,49 @@ public class ShapelessRecipe implements CraftingRecipe { +@@ -85,16 +85,49 @@ public class ShapelessRecipe implements CraftingRecipe { StackedContents autorecipestackmanager = new StackedContents(); int i = 0; @@ -65,4 +65,4 @@ index dc4d3034b193562c70a929f0af9420a1e6728f13..e7c06d98532160499f2610f69de27e30 + // Paper end } - public ItemStack assemble(CraftingContainer inventory) { + public ItemStack assemble(CraftingContainer inventory, RegistryAccess registryManager) { diff --git a/patches/unapplied/server/0299-Limit-Client-Sign-length-more.patch b/patches/server/0299-Limit-Client-Sign-length-more.patch similarity index 93% rename from patches/unapplied/server/0299-Limit-Client-Sign-length-more.patch rename to patches/server/0299-Limit-Client-Sign-length-more.patch index e25c204940..c0264ab271 100644 --- a/patches/unapplied/server/0299-Limit-Client-Sign-length-more.patch +++ b/patches/server/0299-Limit-Client-Sign-length-more.patch @@ -22,10 +22,10 @@ it only impacts data sent from the client. Set -DPaper.maxSignLength=XX to change limit or -1 to disable diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8c773cfefbe14f74db455594ec833ca62d7b9e74..461bfd99b303fcf7ce6d7ee53184605313f48b10 100644 +index 773170c5443dce6e64762e4504d222a5b5bb8ae3..d754c32b1c1c0cf56a690f3b699eb24a795765e4 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -296,6 +296,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -298,6 +298,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic private final MessageSignatureCache messageSignatureCache; private final FutureChain chatMessageChain; private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit @@ -33,7 +33,7 @@ index 8c773cfefbe14f74db455594ec833ca62d7b9e74..461bfd99b303fcf7ce6d7ee531846053 public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH); -@@ -3182,7 +3183,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3191,7 +3192,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleSignUpdate(ServerboundSignUpdatePacket packet) { diff --git a/patches/unapplied/server/0300-Don-t-check-ConvertSigns-boolean-every-sign-save.patch b/patches/server/0300-Don-t-check-ConvertSigns-boolean-every-sign-save.patch similarity index 100% rename from patches/unapplied/server/0300-Don-t-check-ConvertSigns-boolean-every-sign-save.patch rename to patches/server/0300-Don-t-check-ConvertSigns-boolean-every-sign-save.patch diff --git a/patches/unapplied/server/0301-Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/patches/server/0301-Optimize-Network-Manager-and-add-advanced-packet-sup.patch similarity index 90% rename from patches/unapplied/server/0301-Optimize-Network-Manager-and-add-advanced-packet-sup.patch rename to patches/server/0301-Optimize-Network-Manager-and-add-advanced-packet-sup.patch index d43c1f8d5e..f7ccd1df96 100644 --- a/patches/unapplied/server/0301-Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/patches/server/0301-Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -28,10 +28,10 @@ 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 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6f256d0cd 100644 +index 62ee5e32ac0f5d244fa55f9fe45d34cf4d2becaa..184f36a137ed5e5cd20797e131801bc29449cf5c 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -116,6 +116,10 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -118,6 +118,10 @@ public class Connection extends SimpleChannelInboundHandler> { public int protocolVersion; public java.net.InetSocketAddress virtualHost; private static boolean enableExplicitFlush = Boolean.getBoolean("paper.explicit-flush"); @@ -42,15 +42,15 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6 // Paper end public Connection(PacketFlow side) { -@@ -139,6 +143,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -141,6 +145,7 @@ public class Connection extends SimpleChannelInboundHandler> { } public void setProtocol(ConnectionProtocol state) { + protocol = state; // Paper this.channel.attr(Connection.ATTRIBUTE_PROTOCOL).set(state); + this.channel.attr(BundlerInfo.BUNDLER_PROVIDER).set(state); this.channel.config().setAutoRead(true); - Connection.LOGGER.debug("Enabled auto read"); -@@ -217,19 +222,88 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -220,19 +225,88 @@ public class Connection extends SimpleChannelInboundHandler> { Validate.notNull(listener, "packetListener", new Object[0]); this.packetListener = listener; } @@ -143,7 +143,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6 } private void sendPacket(Packet packet, @Nullable PacketSendListener callbacks) { -@@ -257,6 +331,15 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -264,6 +338,15 @@ public class Connection extends SimpleChannelInboundHandler> { this.setProtocol(packetState); } @@ -159,7 +159,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6 ChannelFuture channelfuture = this.channel.writeAndFlush(packet); if (callbacks != null) { -@@ -275,28 +358,72 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -282,28 +365,72 @@ public class Connection extends SimpleChannelInboundHandler> { }); } @@ -240,7 +240,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6 } finally { // Paper start - add pending task queue Runnable r; while ((r = this.pendingTasks.poll()) != null) { -@@ -304,6 +431,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -311,6 +438,7 @@ public class Connection extends SimpleChannelInboundHandler> { } } // Paper end - add pending task queue } @@ -248,7 +248,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6 public void tick() { this.flushQueue(); -@@ -340,9 +468,22 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -347,9 +475,22 @@ public class Connection extends SimpleChannelInboundHandler> { return this.address; } @@ -271,7 +271,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6 // Spigot End if (this.channel.isOpen()) { this.channel.close(); // We can't wait as this may be called from an event loop. -@@ -460,7 +601,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -478,7 +619,7 @@ public class Connection extends SimpleChannelInboundHandler> { public void handleDisconnection() { if (this.channel != null && !this.channel.isOpen()) { if (this.disconnectionHandled) { @@ -280,7 +280,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6 } else { this.disconnectionHandled = true; if (this.getDisconnectedReason() != null) { -@@ -468,7 +609,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -486,7 +627,7 @@ public class Connection extends SimpleChannelInboundHandler> { } else if (this.getPacketListener() != null) { this.getPacketListener().onDisconnect(Component.translatable("multiplayer.disconnect.generic")); } @@ -289,7 +289,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6 // Paper start - Add PlayerConnectionCloseEvent final PacketListener packetListener = this.getPacketListener(); if (packetListener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl) { -@@ -508,6 +649,18 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -526,6 +667,18 @@ public class Connection extends SimpleChannelInboundHandler> { @Nullable final PacketSendListener listener; @@ -333,10 +333,10 @@ index 74bfe0d3942259c45702b099efdc4e101a4e3022..e8fcd56906d26f6dc87959e32c4c7c78 return false; } diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index 0e04532b8f1d48116eb46dcef7952bfcc0d11394..a24ef433d0c9d06b86fd612978cfd6d877036791 100644 +index 776528e50a5abc0e02d9de99231fb47352aa4f43..fbf375534e2b8bd6ef052c4625764f4f8feb2ed6 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -@@ -65,10 +65,12 @@ public class ServerConnectionListener { +@@ -62,10 +62,12 @@ public class ServerConnectionListener { final List connections = Collections.synchronizedList(Lists.newArrayList()); // Paper start - prevent blocking on adding a new network manager while the server is ticking private final java.util.Queue pending = new java.util.concurrent.ConcurrentLinkedQueue<>(); @@ -349,11 +349,11 @@ index 0e04532b8f1d48116eb46dcef7952bfcc0d11394..a24ef433d0c9d06b86fd612978cfd6d8 } } // Paper end -@@ -103,6 +105,7 @@ public class ServerConnectionListener { +@@ -100,6 +102,7 @@ public class ServerConnectionListener { ; } + if (!disableFlushConsolidation) channel.pipeline().addFirst(new io.netty.handler.flush.FlushConsolidationHandler()); // Paper - channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyQueryHandler(ServerConnectionListener.this)).addLast("splitter", new Varint21FrameDecoder()).addLast("decoder", new PacketDecoder(PacketFlow.SERVERBOUND)).addLast("prepender", new Varint21LengthFieldPrepender()).addLast("encoder", new PacketEncoder(PacketFlow.CLIENTBOUND)); - int j = ServerConnectionListener.this.server.getRateLimitPacketsPerSecond(); - Object object = j > 0 ? new RateKickingConnection(j) : new Connection(PacketFlow.SERVERBOUND); + ChannelPipeline channelpipeline = channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyQueryHandler(ServerConnectionListener.this)); + + Connection.configureSerialization(channelpipeline, PacketFlow.SERVERBOUND); diff --git a/patches/unapplied/server/0302-Handle-Oversized-Tile-Entities-in-chunks.patch b/patches/server/0302-Handle-Oversized-Tile-Entities-in-chunks.patch similarity index 100% rename from patches/unapplied/server/0302-Handle-Oversized-Tile-Entities-in-chunks.patch rename to patches/server/0302-Handle-Oversized-Tile-Entities-in-chunks.patch diff --git a/patches/unapplied/server/0303-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch b/patches/server/0303-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch similarity index 82% rename from patches/unapplied/server/0303-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch rename to patches/server/0303-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch index ce854c4323..1a49202e22 100644 --- a/patches/unapplied/server/0303-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch +++ b/patches/server/0303-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index bcfd6751100bcc689d6eb0669e14fa91d5c4b919..07a2da57a0684231a726a0aac58a9943195b3a11 100644 +index c291339e448cb87c42b7daf5a3c67869c7412d0b..9905d2174582b38913752c2e86e4d610baff181d 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1140,6 +1140,7 @@ public abstract class PlayerList { +@@ -1147,6 +1147,7 @@ public abstract class PlayerList { } public void setUsingWhiteList(boolean whitelistEnabled) { diff --git a/patches/unapplied/server/0304-Entity-getEntitySpawnReason.patch b/patches/server/0304-Entity-getEntitySpawnReason.patch similarity index 79% rename from patches/unapplied/server/0304-Entity-getEntitySpawnReason.patch rename to patches/server/0304-Entity-getEntitySpawnReason.patch index f8421126c2..e4b3b60ca2 100644 --- a/patches/unapplied/server/0304-Entity-getEntitySpawnReason.patch +++ b/patches/server/0304-Entity-getEntitySpawnReason.patch @@ -10,10 +10,10 @@ persistenting Living Entity, SPAWNER for spawners, or DEFAULT since data was not stored. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 2daa8e2e64829df838bde981a56d6e407b8ee004..04826a7684940558368e95d4cfd7f90eda057df8 100644 +index e46f18e342f2e682c4d5bbac22187a171df8eb33..58c1769ea15249df950a40e2f164e2ff7aeb05bd 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1289,6 +1289,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1288,6 +1288,7 @@ public class ServerLevel extends Level implements WorldGenLevel { return true; } // Paper end @@ -22,10 +22,10 @@ index 2daa8e2e64829df838bde981a56d6e407b8ee004..04826a7684940558368e95d4cfd7f90e // Paper start if (DEBUG_ENTITIES) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 07a2da57a0684231a726a0aac58a9943195b3a11..e797d3a730939592a328efa69c61d99d862a1258 100644 +index 9905d2174582b38913752c2e86e4d610baff181d..026bba5551dd77d616eb11c59575f9fea28000af 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -356,7 +356,7 @@ public abstract class PlayerList { +@@ -363,7 +363,7 @@ public abstract class PlayerList { // CraftBukkit start ServerLevel finalWorldServer = worldserver1; Entity entity = EntityType.loadEntityRecursive(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> { @@ -35,19 +35,10 @@ index 07a2da57a0684231a726a0aac58a9943195b3a11..e797d3a730939592a328efa69c61d99d }); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 6d7632ca9b8b63be637c89b374b8769ab01e91cb..74e83b3d2e7e7c89ccba4b6aaf612f41800efe4e 100644 +index b4929ecb7e49266b88eec433a65fd8cf049dd805..80806cd557a481ffbfa9b26e84d1ab1bcba0543f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -74,6 +74,8 @@ import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; - import net.minecraft.world.Nameable; - import net.minecraft.world.damagesource.DamageSource; -+import net.minecraft.world.entity.animal.AbstractFish; -+import net.minecraft.world.entity.animal.Animal; - import net.minecraft.world.entity.item.ItemEntity; - import net.minecraft.world.entity.player.Player; - import net.minecraft.world.entity.vehicle.Boat; -@@ -231,6 +233,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -233,6 +233,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } } // Paper end @@ -55,7 +46,7 @@ index 6d7632ca9b8b63be637c89b374b8769ab01e91cb..74e83b3d2e7e7c89ccba4b6aaf612f41 public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper private CraftEntity bukkitEntity; -@@ -2047,6 +2050,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2061,6 +2062,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } @@ -65,7 +56,7 @@ index 6d7632ca9b8b63be637c89b374b8769ab01e91cb..74e83b3d2e7e7c89ccba4b6aaf612f41 // Save entity's from mob spawner status if (spawnedViaMobSpawner) { nbt.putBoolean("Paper.FromMobSpawner", true); -@@ -2192,6 +2198,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2207,6 +2211,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status @@ -80,7 +71,7 @@ index 6d7632ca9b8b63be637c89b374b8769ab01e91cb..74e83b3d2e7e7c89ccba4b6aaf612f41 + if (spawnReason == null) { + if (spawnedViaMobSpawner) { + spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER; -+ } else if (this instanceof Mob && (this instanceof Animal || this instanceof AbstractFish) && !((Mob) this).removeWhenFarAway(0.0)) { ++ } else if (this instanceof Mob && (this instanceof net.minecraft.world.entity.animal.Animal || this instanceof net.minecraft.world.entity.animal.AbstractFish) && !((Mob) this).removeWhenFarAway(0.0)) { + if (!nbt.getBoolean("PersistenceRequired")) { + spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL; + } @@ -93,7 +84,7 @@ index 6d7632ca9b8b63be637c89b374b8769ab01e91cb..74e83b3d2e7e7c89ccba4b6aaf612f41 } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index eab8634dbf5bbb7eaa65e7e9a3d4a94a2d45ea2a..6ba97a0b4f2cb15d5435657c8e8f5c71c6fee3db 100644 +index 405f36e9e115ad44bb91aad885785761786204ca..091c72b95e3c4c3528812ace4aec64d451f25462 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -185,6 +185,7 @@ public abstract class BaseSpawner { @@ -105,10 +96,10 @@ index eab8634dbf5bbb7eaa65e7e9a3d4a94a2d45ea2a..6ba97a0b4f2cb15d5435657c8e8f5c71 // Spigot Start if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 9ba0135932571c815fec15d2caccc789d3af3464..e900c64b8b07dc9cf47cc565e60df6781ca95756 100644 +index dc4060aee09ec9700a9379e0536fd758c3c1eb25..13169525ce6260f6d4a0501af0f5bea284a5ba96 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1268,5 +1268,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1303,5 +1303,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { public boolean fromMobSpawner() { return getHandle().spawnedViaMobSpawner; } diff --git a/patches/unapplied/server/0305-Fire-event-on-GS4-query.patch b/patches/server/0305-Fire-event-on-GS4-query.patch similarity index 100% rename from patches/unapplied/server/0305-Fire-event-on-GS4-query.patch rename to patches/server/0305-Fire-event-on-GS4-query.patch diff --git a/patches/unapplied/server/0306-Implement-PlayerPostRespawnEvent.patch b/patches/server/0306-Implement-PlayerPostRespawnEvent.patch similarity index 86% rename from patches/unapplied/server/0306-Implement-PlayerPostRespawnEvent.patch rename to patches/server/0306-Implement-PlayerPostRespawnEvent.patch index 1ac3e59871..778210ce7d 100644 --- a/patches/unapplied/server/0306-Implement-PlayerPostRespawnEvent.patch +++ b/patches/server/0306-Implement-PlayerPostRespawnEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerPostRespawnEvent diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index e797d3a730939592a328efa69c61d99d862a1258..ce35bd1bf1e532ec1bf260d72299b0f6c2699e9a 100644 +index 026bba5551dd77d616eb11c59575f9fea28000af..d677a05741e1df4bba2598182256758d4da09a4b 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -736,9 +736,14 @@ public abstract class PlayerList { +@@ -743,9 +743,14 @@ public abstract class PlayerList { boolean flag2 = false; @@ -24,7 +24,7 @@ index e797d3a730939592a328efa69c61d99d862a1258..ce35bd1bf1e532ec1bf260d72299b0f6 ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension()); if (worldserver1 != null) { Optional optional; -@@ -790,6 +795,7 @@ public abstract class PlayerList { +@@ -797,6 +802,7 @@ public abstract class PlayerList { location = respawnEvent.getRespawnLocation(); if (!flag) entityplayer.reset(); // SPIGOT-4785 @@ -32,7 +32,7 @@ index e797d3a730939592a328efa69c61d99d862a1258..ce35bd1bf1e532ec1bf260d72299b0f6 } else { location.setWorld(worldserver.getWorld()); } -@@ -849,6 +855,13 @@ public abstract class PlayerList { +@@ -856,6 +862,13 @@ public abstract class PlayerList { if (entityplayer.connection.isDisconnected()) { this.save(entityplayer); } diff --git a/patches/unapplied/server/0307-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch b/patches/server/0307-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch similarity index 84% rename from patches/unapplied/server/0307-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch rename to patches/server/0307-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch index 9dee89a71a..075001f79d 100644 --- a/patches/unapplied/server/0307-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch +++ b/patches/server/0307-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch @@ -6,10 +6,10 @@ Subject: [PATCH] don't go below 0 for pickupDelay, breaks picking up items vanilla checks for == 0 diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index 42b056d58146991b86de0690fce595716ee5455b..02bd99934066b35a3f4fd59370cdabf0640ee218 100644 +index 298dff12c511e8b767d5a7ee14f94fe0745e5338..007625b1a121f1e7241f7cbfba0b1f168e8be5df 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -112,6 +112,7 @@ public class ItemEntity extends Entity { +@@ -121,6 +121,7 @@ public class ItemEntity extends Entity implements TraceableEntity { // CraftBukkit start - Use wall time for pickup and despawn timers int elapsedTicks = MinecraftServer.currentTick - this.lastTick; if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks; @@ -17,7 +17,7 @@ index 42b056d58146991b86de0690fce595716ee5455b..02bd99934066b35a3f4fd59370cdabf0 if (this.age != -32768) this.age += elapsedTicks; this.lastTick = MinecraftServer.currentTick; // CraftBukkit end -@@ -198,6 +199,7 @@ public class ItemEntity extends Entity { +@@ -207,6 +208,7 @@ public class ItemEntity extends Entity implements TraceableEntity { // CraftBukkit start - Use wall time for pickup and despawn timers int elapsedTicks = MinecraftServer.currentTick - this.lastTick; if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks; diff --git a/patches/unapplied/server/0271-Call-player-spectator-target-events-and-improve-impl.patch b/patches/unapplied/server/0271-Call-player-spectator-target-events-and-improve-impl.patch deleted file mode 100644 index dad3b18b8f..0000000000 --- a/patches/unapplied/server/0271-Call-player-spectator-target-events-and-improve-impl.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Caleb Bassham -Date: Fri, 28 Sep 2018 02:32:19 -0500 -Subject: [PATCH] Call player spectator target events and improve - implementation - -Use a proper teleport for teleporting to entities in different -worlds. - -Implementation improvements authored by Spottedleaf -Validate that the target entity is valid and deny spectate -requests from frozen players. - -Also, make sure the entity is spawned to the client before -sending the camera packet. If the entity isn't spawned clientside -when it receives the camera packet, then the client will not -spectate the target entity. - -Co-authored-by: Spottedleaf - -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 4c8b1d30b82fd7a87f79983577695c680013d3f4..fe6a36015533d31600798a8ef882356caa147274 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1908,15 +1908,59 @@ public class ServerPlayer extends Player { - } - - public void setCamera(@Nullable Entity entity) { -+ // Paper start - Add PlayerStartSpectatingEntityEvent and PlayerStopSpectatingEntity Event and improve implementation - Entity entity1 = this.getCamera(); - -- this.camera = (Entity) (entity == null ? this : entity); -- if (entity1 != this.camera) { -- this.connection.send(new ClientboundSetCameraPacket(this.camera)); -- this.connection.teleport(this.camera.getX(), this.camera.getY(), this.camera.getZ(), this.getYRot(), this.getXRot(), TeleportCause.SPECTATE); // CraftBukkit -- this.connection.resetPosition(); -+ if (entity == null) { -+ entity = this; - } - -+ if (entity1 == entity) return; // new spec target is the current spec target -+ -+ if (entity == this) { -+ com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent playerStopSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity()); -+ -+ if (!playerStopSpectatingEntityEvent.callEvent()) { -+ return; -+ } -+ } else { -+ com.destroystokyo.paper.event.player.PlayerStartSpectatingEntityEvent playerStartSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStartSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity(), entity.getBukkitEntity()); -+ -+ if (!playerStartSpectatingEntityEvent.callEvent()) { -+ return; -+ } -+ } -+ // Validate -+ if (entity != this) { -+ if (entity.isRemoved() || !entity.valid || entity.level == null) { -+ MinecraftServer.LOGGER.info("Blocking player " + this + " from spectating invalid entity " + entity); -+ return; -+ } -+ if (this.isImmobile()) { -+ // use debug: clients might maliciously spam this -+ MinecraftServer.LOGGER.debug("Blocking frozen player " + this + " from spectating entity " + entity); -+ return; -+ } -+ } -+ -+ this.camera = entity; // only set after validating state -+ -+ if (entity != this) { -+ // Make sure we're in the right place -+ this.ejectPassengers(); // teleport can fail if we have passengers... -+ this.getBukkitEntity().teleport(new Location(entity.getCommandSenderWorld().getWorld(), entity.getX(), entity.getY(), entity.getZ(), this.getYRot(), this.getXRot()), TeleportCause.SPECTATE); // Correctly handle cross-world entities from api calls by using CB teleport -+ -+ // Make sure we're tracking the entity before sending -+ ChunkMap.TrackedEntity tracker = ((ServerLevel)entity.level).getChunkSource().chunkMap.entityMap.get(entity.getId()); -+ if (tracker != null) { // dumb plugins... -+ tracker.updatePlayer(this); -+ } -+ } else { -+ this.connection.teleport(this.camera.getX(), this.camera.getY(), this.camera.getZ(), this.getYRot(), this.getXRot(), TeleportCause.SPECTATE); // CraftBukkit -+ } -+ this.connection.send(new ClientboundSetCameraPacket(entity)); -+ this.connection.resetPosition(); -+ // Paper end - } - - @Override