From 3ea4a03fbc3372966091e06f1d9eb91346a171fd Mon Sep 17 00:00:00 2001 From: Noah van der Aa Date: Wed, 24 Apr 2024 22:32:38 +0200 Subject: [PATCH] more more work (757) --- .../server/Add-EntityPortalReadyEvent.patch | 4 +- .../server/Add-Player-getFishHook.patch | 0 .../server/Add-PlayerStopUsingItemEvent.patch | 0 .../Add-Velocity-IP-Forwarding-Support.patch | 8 ++-- .../server/Add-WardenAngerChangeEvent.patch | 2 +- .../Add-and-fix-missing-BlockFadeEvents.patch | 0 ...rtant-BlockStateListPopulator-method.patch | 0 ...-strict-advancement-dimension-checks.patch | 0 .../Add-support-for-Proxy-Protocol.patch | 2 +- ...us-missing-EntityDropItemEvent-calls.patch | 2 +- .../server/Block-Ticking-API.patch | 0 .../server/Collision-API.patch | 0 ...stom-Chat-Completion-Suggestions-API.patch | 0 ...t-selector-resolving-in-books-by-def.patch | 14 +++---- ...-chunk-for-dynamic-game-event-listen.patch | 0 ...broadcast-messages-to-command-blocks.patch | 0 .../server/Don-t-tick-markers.patch | 0 ...-level-random-in-entity-constructors.patch | 0 .../Dont-resent-entity-on-art-update.patch | 0 .../server/Expand-FallingBlock-API.patch | 0 ...-CauldronLevelChange-on-initial-fill.patch | 39 +++++++++---------- .../server/Fix-Bee-flower-NPE.patch | 0 ...shPotion-and-LingeringPotion-spawnin.patch | 0 ...ntory-for-smokers-and-blast-furnaces.patch | 0 ...ix-OfflinePlayer-getBedSpawnLocation.patch | 0 ...g-not-using-commands.spam-exclusions.patch | 0 ...and-message-for-brigadier-syntax-exc.patch | 0 .../server/More-Teleport-API.patch | 0 .../server/Nameable-Banner-API.patch | 4 +- ...mpty-items-from-being-added-to-world.patch | 0 ...entity-loading-causing-async-lookups.patch | 27 ++++++++----- .../Sanitize-sent-BlockEntity-NBT.patch | 17 ++++---- ...ck-entities-after-destroy-prediction.patch | 0 ...n-on-world-create-while-being-ticked.patch | 0 ...-on-plugins-accessing-faraway-chunks.patch | 0 ...-snow-cauldrons-not-turning-to-water.patch | 0 ...y-read-and-store-sus-effect-duration.patch | 0 37 files changed, 64 insertions(+), 55 deletions(-) rename patches/{unapplied => }/server/Add-EntityPortalReadyEvent.patch (90%) rename patches/{unapplied => }/server/Add-Player-getFishHook.patch (100%) rename patches/{unapplied => }/server/Add-PlayerStopUsingItemEvent.patch (100%) rename patches/{unapplied => }/server/Add-Velocity-IP-Forwarding-Support.patch (98%) rename patches/{unapplied => }/server/Add-WardenAngerChangeEvent.patch (94%) rename patches/{unapplied => }/server/Add-and-fix-missing-BlockFadeEvents.patch (100%) rename patches/{unapplied => }/server/Add-missing-important-BlockStateListPopulator-method.patch (100%) rename patches/{unapplied => }/server/Add-option-for-strict-advancement-dimension-checks.patch (100%) rename patches/{unapplied => }/server/Add-support-for-Proxy-Protocol.patch (99%) rename patches/{unapplied => }/server/Add-various-missing-EntityDropItemEvent-calls.patch (98%) rename patches/{unapplied => }/server/Block-Ticking-API.patch (100%) rename patches/{unapplied => }/server/Collision-API.patch (100%) rename patches/{unapplied => }/server/Custom-Chat-Completion-Suggestions-API.patch (100%) rename patches/{unapplied => }/server/Disable-component-selector-resolving-in-books-by-def.patch (54%) rename patches/{unapplied => }/server/Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch (100%) rename patches/{unapplied => }/server/Don-t-broadcast-messages-to-command-blocks.patch (100%) rename patches/{unapplied => }/server/Don-t-tick-markers.patch (100%) rename patches/{unapplied => }/server/Don-t-use-level-random-in-entity-constructors.patch (100%) rename patches/{unapplied => }/server/Dont-resent-entity-on-art-update.patch (100%) rename patches/{unapplied => }/server/Expand-FallingBlock-API.patch (100%) rename patches/{unapplied => }/server/Fire-CauldronLevelChange-on-initial-fill.patch (80%) rename patches/{unapplied => }/server/Fix-Bee-flower-NPE.patch (100%) rename patches/{unapplied => }/server/Fix-CCE-for-SplashPotion-and-LingeringPotion-spawnin.patch (100%) rename patches/{unapplied => }/server/Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch (100%) rename patches/{unapplied => }/server/Fix-OfflinePlayer-getBedSpawnLocation.patch (100%) rename patches/{unapplied => }/server/Fix-Spigot-Config-not-using-commands.spam-exclusions.patch (100%) rename patches/{unapplied => }/server/Fix-suggest-command-message-for-brigadier-syntax-exc.patch (100%) rename patches/{unapplied => }/server/More-Teleport-API.patch (100%) rename patches/{unapplied => }/server/Nameable-Banner-API.patch (93%) rename patches/{unapplied => }/server/Prevent-empty-items-from-being-added-to-world.patch (100%) rename patches/{unapplied => }/server/Prevent-entity-loading-causing-async-lookups.patch (77%) rename patches/{unapplied => }/server/Sanitize-sent-BlockEntity-NBT.patch (84%) rename patches/{unapplied => }/server/Send-block-entities-after-destroy-prediction.patch (100%) rename patches/{unapplied => }/server/Throw-exception-on-world-create-while-being-ticked.patch (100%) rename patches/{unapplied => }/server/Warn-on-plugins-accessing-faraway-chunks.patch (100%) rename patches/{unapplied => }/server/fix-powder-snow-cauldrons-not-turning-to-water.patch (100%) rename patches/unapplied/server/properly-read-and-store-sus-effect-duration.patch => removed-patches-1-20-5/0757-properly-read-and-store-sus-effect-duration.patch (100%) diff --git a/patches/unapplied/server/Add-EntityPortalReadyEvent.patch b/patches/server/Add-EntityPortalReadyEvent.patch similarity index 90% rename from patches/unapplied/server/Add-EntityPortalReadyEvent.patch rename to patches/server/Add-EntityPortalReadyEvent.patch index 0396b1f3ea..27c43c0df1 100644 --- a/patches/unapplied/server/Add-EntityPortalReadyEvent.patch +++ b/patches/server/Add-EntityPortalReadyEvent.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit this.level().getProfiler().push("portal"); this.portalTime = i; @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.setPortalCooldown(); // CraftBukkit start if (this instanceof ServerPlayer) { -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } else { this.changeDimension(worldserver1); } diff --git a/patches/unapplied/server/Add-Player-getFishHook.patch b/patches/server/Add-Player-getFishHook.patch similarity index 100% rename from patches/unapplied/server/Add-Player-getFishHook.patch rename to patches/server/Add-Player-getFishHook.patch diff --git a/patches/unapplied/server/Add-PlayerStopUsingItemEvent.patch b/patches/server/Add-PlayerStopUsingItemEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PlayerStopUsingItemEvent.patch rename to patches/server/Add-PlayerStopUsingItemEvent.patch diff --git a/patches/unapplied/server/Add-Velocity-IP-Forwarding-Support.patch b/patches/server/Add-Velocity-IP-Forwarding-Support.patch similarity index 98% rename from patches/unapplied/server/Add-Velocity-IP-Forwarding-Support.patch rename to patches/server/Add-Velocity-IP-Forwarding-Support.patch index 424526d9f8..be95337bf8 100644 --- a/patches/unapplied/server/Add-Velocity-IP-Forwarding-Support.patch +++ b/patches/server/Add-Velocity-IP-Forwarding-Support.patch @@ -138,16 +138,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, - private final String serverId; + private final boolean transferred; private ServerPlayer player; // CraftBukkit public boolean iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation = false; // Paper - username validation overriding + private int velocityLoginMessageId = -1; // Paper - Add Velocity IP Forwarding Support - public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection) { + public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection, boolean transferred) { this.state = ServerLoginPacketListenerImpl.State.HELLO; @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, this.state = ServerLoginPacketListenerImpl.State.KEY; - this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge)); + this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge, true)); } else { + // Paper start - Add Velocity IP Forwarding Support + if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) { @@ -224,7 +224,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return; + } + // Paper end - Add Velocity IP Forwarding Support - this.disconnect(ServerLoginPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY); + this.disconnect(ServerCommonPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/patches/unapplied/server/Add-WardenAngerChangeEvent.patch b/patches/server/Add-WardenAngerChangeEvent.patch similarity index 94% rename from patches/unapplied/server/Add-WardenAngerChangeEvent.patch rename to patches/server/Add-WardenAngerChangeEvent.patch index 6eee3abe80..e4b670e3f6 100644 --- a/patches/unapplied/server/Add-WardenAngerChangeEvent.patch +++ b/patches/server/Add-WardenAngerChangeEvent.patch @@ -35,5 +35,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + amount = event.getNewAnger() - activeAnger; + // Paper end - Add WardenAngerChangeEvent WardenAi.setDigCooldown(this); - boolean flag1 = !(this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null) instanceof Player); // CraftBukkit - decompile error + boolean flag1 = !(this.getTarget() instanceof Player); int j = this.angerManagement.increaseAnger(entity, amount); diff --git a/patches/unapplied/server/Add-and-fix-missing-BlockFadeEvents.patch b/patches/server/Add-and-fix-missing-BlockFadeEvents.patch similarity index 100% rename from patches/unapplied/server/Add-and-fix-missing-BlockFadeEvents.patch rename to patches/server/Add-and-fix-missing-BlockFadeEvents.patch diff --git a/patches/unapplied/server/Add-missing-important-BlockStateListPopulator-method.patch b/patches/server/Add-missing-important-BlockStateListPopulator-method.patch similarity index 100% rename from patches/unapplied/server/Add-missing-important-BlockStateListPopulator-method.patch rename to patches/server/Add-missing-important-BlockStateListPopulator-method.patch diff --git a/patches/unapplied/server/Add-option-for-strict-advancement-dimension-checks.patch b/patches/server/Add-option-for-strict-advancement-dimension-checks.patch similarity index 100% rename from patches/unapplied/server/Add-option-for-strict-advancement-dimension-checks.patch rename to patches/server/Add-option-for-strict-advancement-dimension-checks.patch diff --git a/patches/unapplied/server/Add-support-for-Proxy-Protocol.patch b/patches/server/Add-support-for-Proxy-Protocol.patch similarity index 99% rename from patches/unapplied/server/Add-support-for-Proxy-Protocol.patch rename to patches/server/Add-support-for-Proxy-Protocol.patch index cc5ee7e4ab..4597796a7e 100644 --- a/patches/unapplied/server/Add-support-for-Proxy-Protocol.patch +++ b/patches/server/Add-support-for-Proxy-Protocol.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 alsoShade(log4jPlugins.output) + implementation("io.netty:netty-codec-haproxy:4.1.97.Final") // Paper - Add support for proxy protocol // Paper end - implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion + implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion implementation("org.ow2.asm:asm-commons:9.7") diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/unapplied/server/Add-various-missing-EntityDropItemEvent-calls.patch b/patches/server/Add-various-missing-EntityDropItemEvent-calls.patch similarity index 98% rename from patches/unapplied/server/Add-various-missing-EntityDropItemEvent-calls.patch rename to patches/server/Add-various-missing-EntityDropItemEvent-calls.patch index 402a1e40a0..c413cae20a 100644 --- a/patches/unapplied/server/Add-various-missing-EntityDropItemEvent-calls.patch +++ b/patches/server/Add-various-missing-EntityDropItemEvent-calls.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess stack.setCount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe entityitem.setDefaultPickUpDelay(); diff --git a/patches/unapplied/server/Block-Ticking-API.patch b/patches/server/Block-Ticking-API.patch similarity index 100% rename from patches/unapplied/server/Block-Ticking-API.patch rename to patches/server/Block-Ticking-API.patch diff --git a/patches/unapplied/server/Collision-API.patch b/patches/server/Collision-API.patch similarity index 100% rename from patches/unapplied/server/Collision-API.patch rename to patches/server/Collision-API.patch diff --git a/patches/unapplied/server/Custom-Chat-Completion-Suggestions-API.patch b/patches/server/Custom-Chat-Completion-Suggestions-API.patch similarity index 100% rename from patches/unapplied/server/Custom-Chat-Completion-Suggestions-API.patch rename to patches/server/Custom-Chat-Completion-Suggestions-API.patch diff --git a/patches/unapplied/server/Disable-component-selector-resolving-in-books-by-def.patch b/patches/server/Disable-component-selector-resolving-in-books-by-def.patch similarity index 54% rename from patches/unapplied/server/Disable-component-selector-resolving-in-books-by-def.patch rename to patches/server/Disable-component-selector-resolving-in-books-by-def.patch index 4f722a32ca..632bc49be4 100644 --- a/patches/unapplied/server/Disable-component-selector-resolving-in-books-by-def.patch +++ b/patches/server/Disable-component-selector-resolving-in-books-by-def.patch @@ -10,10 +10,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/item/WrittenBookItem.java @@ -0,0 +0,0 @@ public class WrittenBookItem extends Item { - public static boolean resolveBookComponents(ItemStack book, @Nullable CommandSourceStack commandSource, @Nullable Player player) { - CompoundTag compoundTag = book.getTag(); -- if (compoundTag != null && !compoundTag.getBoolean("resolved")) { -+ if (io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.resolveSelectorsInBooks && compoundTag != null && !compoundTag.getBoolean("resolved")) { // Paper - Disable component selector resolving in books by default - compoundTag.putBoolean("resolved", true); - if (!makeSureTagIsValid(compoundTag)) { - return false; + public static boolean resolveBookComponents(ItemStack book, CommandSourceStack commandSource, @Nullable Player player) { + WrittenBookContent writtenBookContent = book.get(DataComponents.WRITTEN_BOOK_CONTENT); +- if (writtenBookContent != null && !writtenBookContent.resolved()) { ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.resolveSelectorsInBooks && writtenBookContent != null && !writtenBookContent.resolved()) { // Paper - Disable component selector resolving in books by default + WrittenBookContent writtenBookContent2 = writtenBookContent.resolve(commandSource, player); + if (writtenBookContent2 != null) { + book.set(DataComponents.WRITTEN_BOOK_CONTENT, writtenBookContent2); diff --git a/patches/unapplied/server/Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch b/patches/server/Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch similarity index 100% rename from patches/unapplied/server/Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch rename to patches/server/Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch diff --git a/patches/unapplied/server/Don-t-broadcast-messages-to-command-blocks.patch b/patches/server/Don-t-broadcast-messages-to-command-blocks.patch similarity index 100% rename from patches/unapplied/server/Don-t-broadcast-messages-to-command-blocks.patch rename to patches/server/Don-t-broadcast-messages-to-command-blocks.patch diff --git a/patches/unapplied/server/Don-t-tick-markers.patch b/patches/server/Don-t-tick-markers.patch similarity index 100% rename from patches/unapplied/server/Don-t-tick-markers.patch rename to patches/server/Don-t-tick-markers.patch diff --git a/patches/unapplied/server/Don-t-use-level-random-in-entity-constructors.patch b/patches/server/Don-t-use-level-random-in-entity-constructors.patch similarity index 100% rename from patches/unapplied/server/Don-t-use-level-random-in-entity-constructors.patch rename to patches/server/Don-t-use-level-random-in-entity-constructors.patch diff --git a/patches/unapplied/server/Dont-resent-entity-on-art-update.patch b/patches/server/Dont-resent-entity-on-art-update.patch similarity index 100% rename from patches/unapplied/server/Dont-resent-entity-on-art-update.patch rename to patches/server/Dont-resent-entity-on-art-update.patch diff --git a/patches/unapplied/server/Expand-FallingBlock-API.patch b/patches/server/Expand-FallingBlock-API.patch similarity index 100% rename from patches/unapplied/server/Expand-FallingBlock-API.patch rename to patches/server/Expand-FallingBlock-API.patch diff --git a/patches/unapplied/server/Fire-CauldronLevelChange-on-initial-fill.patch b/patches/server/Fire-CauldronLevelChange-on-initial-fill.patch similarity index 80% rename from patches/unapplied/server/Fire-CauldronLevelChange-on-initial-fill.patch rename to patches/server/Fire-CauldronLevelChange-on-initial-fill.patch index b8b35bc2bb..8d8d836fff 100644 --- a/patches/unapplied/server/Fire-CauldronLevelChange-on-initial-fill.patch +++ b/patches/server/Fire-CauldronLevelChange-on-initial-fill.patch @@ -11,39 +11,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java +++ b/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java @@ -0,0 +0,0 @@ public interface CauldronInteraction { - } else { + if (potioncontents != null && potioncontents.is(Potions.WATER)) { if (!world.isClientSide) { // CraftBukkit start - if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) { + if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent - return InteractionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; } // CraftBukkit end @@ -0,0 +0,0 @@ public interface CauldronInteraction { - if ((Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) != 3 && PotionUtils.getPotion(itemstack) == Potions.WATER) { - if (!world.isClientSide) { - // CraftBukkit start -- if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) { -+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent - return InteractionResult.SUCCESS; - } - // CraftBukkit end + if (potioncontents != null && potioncontents.is(Potions.WATER)) { + if (!world.isClientSide) { + // CraftBukkit start +- if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) { ++ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent + return ItemInteractionResult.SUCCESS; + } + // CraftBukkit end @@ -0,0 +0,0 @@ public interface CauldronInteraction { } else { if (!world.isClientSide) { // CraftBukkit start - if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.CAULDRON.defaultBlockState(), player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) { + if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.CAULDRON.defaultBlockState(), player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL, false)) { // Paper - Call CauldronLevelChangeEvent - return InteractionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; } // CraftBukkit end @@ -0,0 +0,0 @@ public interface CauldronInteraction { - static InteractionResult emptyBucket(Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, BlockState state, SoundEvent soundEvent) { + static ItemInteractionResult emptyBucket(Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, BlockState state, SoundEvent soundEvent) { if (!world.isClientSide) { // CraftBukkit start - if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY)) { + if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent - return InteractionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; } // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/level/block/CauldronBlock.java b/src/main/java/net/minecraft/world/level/block/CauldronBlock.java @@ -54,23 +54,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void handlePrecipitation(BlockState state, Level world, BlockPos pos, Biome.Precipitation precipitation) { if (CauldronBlock.shouldHandlePrecipitation(world, precipitation)) { if (precipitation == Biome.Precipitation.RAIN) { -- world.setBlockAndUpdate(pos, Blocks.WATER_CAULDRON.defaultBlockState()); + // Paper start - Call CauldronLevelChangeEvent + if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.WATER_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL, false)) { // avoid duplicate game event + return; + } + // Paper end - Call CauldronLevelChangeEvent - world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, pos); + world.setBlockAndUpdate(pos, Blocks.WATER_CAULDRON.defaultBlockState()); + world.gameEvent((Entity) null, (Holder) GameEvent.BLOCK_CHANGE, pos); } else if (precipitation == Biome.Precipitation.SNOW) { -- world.setBlockAndUpdate(pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState()); + // Paper start - Call CauldronLevelChangeEvent + if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL, false)) { // avoid duplicate game event + return; + } + // Paper end - Call CauldronLevelChangeEvent - world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, pos); + world.setBlockAndUpdate(pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState()); + world.gameEvent((Entity) null, (Holder) GameEvent.BLOCK_CHANGE, pos); } - @@ -0,0 +0,0 @@ public class CauldronBlock extends AbstractCauldronBlock { if (fluid == Fluids.WATER) { @@ -116,8 +115,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return false; } newState.update(true); -- world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock)); -+ if (sendGameEvent) world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock)); // Paper - Call CauldronLevelChangeEvent +- world.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock)); ++ if (sendGameEvent) world.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock)); // Paper - Call CauldronLevelChangeEvent return true; } // CraftBukkit end diff --git a/patches/unapplied/server/Fix-Bee-flower-NPE.patch b/patches/server/Fix-Bee-flower-NPE.patch similarity index 100% rename from patches/unapplied/server/Fix-Bee-flower-NPE.patch rename to patches/server/Fix-Bee-flower-NPE.patch diff --git a/patches/unapplied/server/Fix-CCE-for-SplashPotion-and-LingeringPotion-spawnin.patch b/patches/server/Fix-CCE-for-SplashPotion-and-LingeringPotion-spawnin.patch similarity index 100% rename from patches/unapplied/server/Fix-CCE-for-SplashPotion-and-LingeringPotion-spawnin.patch rename to patches/server/Fix-CCE-for-SplashPotion-and-LingeringPotion-spawnin.patch diff --git a/patches/unapplied/server/Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch b/patches/server/Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch similarity index 100% rename from patches/unapplied/server/Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch rename to patches/server/Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch diff --git a/patches/unapplied/server/Fix-OfflinePlayer-getBedSpawnLocation.patch b/patches/server/Fix-OfflinePlayer-getBedSpawnLocation.patch similarity index 100% rename from patches/unapplied/server/Fix-OfflinePlayer-getBedSpawnLocation.patch rename to patches/server/Fix-OfflinePlayer-getBedSpawnLocation.patch diff --git a/patches/unapplied/server/Fix-Spigot-Config-not-using-commands.spam-exclusions.patch b/patches/server/Fix-Spigot-Config-not-using-commands.spam-exclusions.patch similarity index 100% rename from patches/unapplied/server/Fix-Spigot-Config-not-using-commands.spam-exclusions.patch rename to patches/server/Fix-Spigot-Config-not-using-commands.spam-exclusions.patch diff --git a/patches/unapplied/server/Fix-suggest-command-message-for-brigadier-syntax-exc.patch b/patches/server/Fix-suggest-command-message-for-brigadier-syntax-exc.patch similarity index 100% rename from patches/unapplied/server/Fix-suggest-command-message-for-brigadier-syntax-exc.patch rename to patches/server/Fix-suggest-command-message-for-brigadier-syntax-exc.patch diff --git a/patches/unapplied/server/More-Teleport-API.patch b/patches/server/More-Teleport-API.patch similarity index 100% rename from patches/unapplied/server/More-Teleport-API.patch rename to patches/server/More-Teleport-API.patch diff --git a/patches/unapplied/server/Nameable-Banner-API.patch b/patches/server/Nameable-Banner-API.patch similarity index 93% rename from patches/unapplied/server/Nameable-Banner-API.patch rename to patches/server/Nameable-Banner-API.patch index 107b1bdb9e..f0c7ce41d3 100644 --- a/patches/unapplied/server/Nameable-Banner-API.patch +++ b/patches/server/Nameable-Banner-API.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java @@ -0,0 +0,0 @@ public class CraftBanner extends CraftBlockEntityState implem - public CraftBanner copy() { - return new CraftBanner(this); + public CraftBanner copy(Location location) { + return new CraftBanner(this, location); } + + // Paper start diff --git a/patches/unapplied/server/Prevent-empty-items-from-being-added-to-world.patch b/patches/server/Prevent-empty-items-from-being-added-to-world.patch similarity index 100% rename from patches/unapplied/server/Prevent-empty-items-from-being-added-to-world.patch rename to patches/server/Prevent-empty-items-from-being-added-to-world.patch diff --git a/patches/unapplied/server/Prevent-entity-loading-causing-async-lookups.patch b/patches/server/Prevent-entity-loading-causing-async-lookups.patch similarity index 77% rename from patches/unapplied/server/Prevent-entity-loading-causing-async-lookups.patch rename to patches/server/Prevent-entity-loading-causing-async-lookups.patch index ed586ebd89..7f36832eb7 100644 --- a/patches/unapplied/server/Prevent-entity-loading-causing-async-lookups.patch +++ b/patches/server/Prevent-entity-loading-causing-async-lookups.patch @@ -8,12 +8,12 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public void baseTick() { this.level().getProfiler().push("entityBaseTick"); + if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Prevent entity loading causing async lookups - this.feetBlockState = null; + this.inBlockState = null; if (this.isPassenger() && this.getVehicle().isRemoved()) { this.stopRiding(); diff --git a/src/main/java/net/minecraft/world/entity/NeutralMob.java b/src/main/java/net/minecraft/world/entity/NeutralMob.java @@ -28,11 +28,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - - if (entity != null) { - if (entity instanceof Mob) { -- this.setLastHurtByMob((Mob) entity); +- Mob entityinsentient = (Mob) entity; +- +- this.setTarget(entityinsentient); +- this.setLastHurtByMob(entityinsentient); - } - -- if (entity.getType() == EntityType.PLAYER) { -- this.setLastHurtByPlayer((Player) entity); +- if (entity instanceof Player) { +- Player entityhuman = (Player) entity; +- +- this.setTarget(entityhuman); +- this.setLastHurtByPlayer(entityhuman); - } - - } @@ -60,14 +66,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Entity entity = ((ServerLevel) level).getEntity(target); + + if (entity != null) { -+ if (entity instanceof Mob) { -+ this.setLastHurtByMob((Mob) entity); ++ if (entity instanceof Mob mob) { ++ this.setTarget(mob); ++ this.setLastHurtByMob(mob); + } + -+ if (entity.getType() == EntityType.PLAYER) { -+ this.setLastHurtByPlayer((Player) entity); ++ if (entity instanceof Player player) { ++ this.setTarget(player); ++ this.setLastHurtByPlayer(player); + } -+ + } + } + // Paper end - Prevent entity loading causing async lookups diff --git a/patches/unapplied/server/Sanitize-sent-BlockEntity-NBT.patch b/patches/server/Sanitize-sent-BlockEntity-NBT.patch similarity index 84% rename from patches/unapplied/server/Sanitize-sent-BlockEntity-NBT.patch rename to patches/server/Sanitize-sent-BlockEntity-NBT.patch index 6dc0f0c9ba..6ad7ed40ff 100644 --- a/patches/unapplied/server/Sanitize-sent-BlockEntity-NBT.patch +++ b/patches/server/Sanitize-sent-BlockEntity-NBT.patch @@ -9,11 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java @@ -0,0 +0,0 @@ public class ClientboundBlockEntityDataPacket implements Packet nbtGetter) { -- return new ClientboundBlockEntityDataPacket(blockEntity.getBlockPos(), blockEntity.getType(), nbtGetter.apply(blockEntity)); -+ return new ClientboundBlockEntityDataPacket(blockEntity.getBlockPos(), blockEntity.getType(), blockEntity.sanitizeSentNbt(nbtGetter.apply(blockEntity))); // Paper - Sanitize sent data + public static ClientboundBlockEntityDataPacket create(BlockEntity blockEntity, BiFunction nbtGetter) { + RegistryAccess registryAccess = blockEntity.getLevel().registryAccess(); +- return new ClientboundBlockEntityDataPacket(blockEntity.getBlockPos(), blockEntity.getType(), nbtGetter.apply(blockEntity, registryAccess)); ++ return new ClientboundBlockEntityDataPacket(blockEntity.getBlockPos(), blockEntity.getType(), blockEntity.sanitizeSentNbt(nbtGetter.apply(blockEntity, registryAccess))); // Paper - Sanitize sent data } public static ClientboundBlockEntityDataPacket create(BlockEntity blockEntity) { @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java @@ -0,0 +0,0 @@ public class ClientboundLevelChunkPacketData { - CompoundTag compoundTag = blockEntity.getUpdateTag(); + CompoundTag compoundTag = blockEntity.getUpdateTag(blockEntity.getLevel().registryAccess()); BlockPos blockPos = blockEntity.getBlockPos(); int i = SectionPos.sectionRelative(blockPos.getX()) << 4 | SectionPos.sectionRelative(blockPos.getZ()); + blockEntity.sanitizeSentNbt(compoundTag); // Paper - Sanitize sent data @@ -34,9 +34,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java @@ -0,0 +0,0 @@ public abstract class BlockEntity { - return null; } // CraftBukkit end + + // Paper start - Sanitize sent data + public CompoundTag sanitizeSentNbt(CompoundTag tag) { + tag.remove("PublicBukkitValues"); @@ -44,4 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return tag; + } + // Paper end - Sanitize sent data - } ++ + private static class ComponentHelper { + + public static final Codec COMPONENTS_CODEC = DataComponentMap.CODEC.optionalFieldOf("components", DataComponentMap.EMPTY).codec(); diff --git a/patches/unapplied/server/Send-block-entities-after-destroy-prediction.patch b/patches/server/Send-block-entities-after-destroy-prediction.patch similarity index 100% rename from patches/unapplied/server/Send-block-entities-after-destroy-prediction.patch rename to patches/server/Send-block-entities-after-destroy-prediction.patch diff --git a/patches/unapplied/server/Throw-exception-on-world-create-while-being-ticked.patch b/patches/server/Throw-exception-on-world-create-while-being-ticked.patch similarity index 100% rename from patches/unapplied/server/Throw-exception-on-world-create-while-being-ticked.patch rename to patches/server/Throw-exception-on-world-create-while-being-ticked.patch diff --git a/patches/unapplied/server/Warn-on-plugins-accessing-faraway-chunks.patch b/patches/server/Warn-on-plugins-accessing-faraway-chunks.patch similarity index 100% rename from patches/unapplied/server/Warn-on-plugins-accessing-faraway-chunks.patch rename to patches/server/Warn-on-plugins-accessing-faraway-chunks.patch diff --git a/patches/unapplied/server/fix-powder-snow-cauldrons-not-turning-to-water.patch b/patches/server/fix-powder-snow-cauldrons-not-turning-to-water.patch similarity index 100% rename from patches/unapplied/server/fix-powder-snow-cauldrons-not-turning-to-water.patch rename to patches/server/fix-powder-snow-cauldrons-not-turning-to-water.patch diff --git a/patches/unapplied/server/properly-read-and-store-sus-effect-duration.patch b/removed-patches-1-20-5/0757-properly-read-and-store-sus-effect-duration.patch similarity index 100% rename from patches/unapplied/server/properly-read-and-store-sus-effect-duration.patch rename to removed-patches-1-20-5/0757-properly-read-and-store-sus-effect-duration.patch