Restore players being the inventory holder of an enderchest (#12923)

This commit is contained in:
Warrior
2025-08-04 13:53:50 +02:00
committed by GitHub
parent bf465e0029
commit c60f4436f0
@@ -1,27 +1,20 @@
--- a/net/minecraft/world/inventory/PlayerEnderChestContainer.java
+++ b/net/minecraft/world/inventory/PlayerEnderChestContainer.java
@@ -12,9 +_,22 @@
public class PlayerEnderChestContainer extends SimpleContainer {
@@ -13,8 +_,15 @@
@Nullable
private EnderChestBlockEntity activeChest;
-
- public PlayerEnderChestContainer() {
+ // CraftBukkit start
+ private final Player owner;
+
+ public org.bukkit.inventory.InventoryHolder getBukkitOwner() {
+ return this.owner.getBukkitEntity();
+ }
+
- super(27);
+ // Paper start
+ @Override
+ public @Nullable org.bukkit.Location getLocation() {
+ return this.activeChest != null ? org.bukkit.craftbukkit.util.CraftLocation.toBukkit(this.activeChest.getBlockPos(), this.activeChest.getLevel().getWorld()) : null;
+ }
+
+ public PlayerEnderChestContainer(Player owner) {
super(27);
+ this.owner = owner;
+ // CraftBukkit end
+ super(27, owner.getBukkitEntity());
+ // Paper end
}
public void setActiveChest(EnderChestBlockEntity enderChestBlockEntity) {