From 6735c60738ae1723edafb37d705550fe4b11cc6a Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Mon, 18 Nov 2024 20:47:52 +0100 Subject: [PATCH] Fix enderchest opening animation (#11635) --- .../1017-Fix-InventoryOpenEvent-cancellation.patch | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/patches/server/1017-Fix-InventoryOpenEvent-cancellation.patch b/patches/server/1017-Fix-InventoryOpenEvent-cancellation.patch index 2ac771df85..eb14b552dc 100644 --- a/patches/server/1017-Fix-InventoryOpenEvent-cancellation.patch +++ b/patches/server/1017-Fix-InventoryOpenEvent-cancellation.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix InventoryOpenEvent cancellation diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index b6b8687fc79c060cd65e04dc67c855c775ab7684..e2527f3e2b96df539c765ae23c83a09d3298d430 100644 +index a13f88ed2ce39848b1fe1673265cf6c62adbfb66..08a82b7a3456f58b3d0fdbb8e8dbce6972ad1672 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1942,6 +1942,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -198,7 +198,7 @@ index 500c56c4ef0878434582a50d6dba2ccca9773275..5a6c153fa2873aecba0d0d02be2cc2a5 } diff --git a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java -index ef0d469176ee74b6bb5f9e9cc508735145fda5b8..ebb9baca7a65173f7c9fdf9bf47a8db876719625 100644 +index ef0d469176ee74b6bb5f9e9cc508735145fda5b8..2a207fb2e1c26b562de42240e11c856bd2a23458 100644 --- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java @@ -86,11 +86,13 @@ public class EnderChestBlock extends AbstractChestBlock i @@ -206,15 +206,16 @@ index ef0d469176ee74b6bb5f9e9cc508735145fda5b8..ebb9baca7a65173f7c9fdf9bf47a8db8 return InteractionResult.SUCCESS; } else { - if (world instanceof ServerLevel serverLevel) { +- playerEnderChestContainer.setActiveChest(enderChestBlockEntity); +- player.openMenu( +- new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE) +- ); + // Paper start - Fix InventoryOpenEvent cancellation - moved up; ++ playerEnderChestContainer.setActiveChest(enderChestBlockEntity); // Needs to happen before ChestMenu.threeRows as it is required for opening animations + if (world instanceof ServerLevel serverLevel && player.openMenu( + new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE) + ).isPresent()) { + // Paper end - Fix InventoryOpenEvent cancellation - moved up; - playerEnderChestContainer.setActiveChest(enderChestBlockEntity); -- player.openMenu( -- new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE) -- ); + // Paper - Fix InventoryOpenEvent cancellation - moved up; player.awardStat(Stats.OPEN_ENDERCHEST); PiglinAi.angerNearbyPiglins(serverLevel, player, true);