mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 11:38:29 +01:00
Fix enderchest opening animation (#11635)
This commit is contained in:
parent
d8b66dd93d
commit
6735c60738
@ -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<EnderChestBlockEntity> 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);
|
||||
|
Loading…
Reference in New Issue
Block a user