From 33bafcbf2de4ed1e77ad702c5a4d0e8145ba2588 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) --- patches/server/Fix-InventoryOpenEvent-cancellation.patch | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/patches/server/Fix-InventoryOpenEvent-cancellation.patch b/patches/server/Fix-InventoryOpenEvent-cancellation.patch index 5afd95b010..ef5d4ddf29 100644 --- a/patches/server/Fix-InventoryOpenEvent-cancellation.patch +++ b/patches/server/Fix-InventoryOpenEvent-cancellation.patch @@ -206,15 +206,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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);