aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/inventory/PlayerEnderChestContainer.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/inventory/PlayerEnderChestContainer.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/inventory/PlayerEnderChestContainer.java.patch117
1 files changed, 117 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/inventory/PlayerEnderChestContainer.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/inventory/PlayerEnderChestContainer.java.patch
new file mode 100644
index 0000000000..cd5e46f6f0
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/inventory/PlayerEnderChestContainer.java.patch
@@ -0,0 +1,117 @@
+--- a/net/minecraft/world/inventory/PlayerEnderChestContainer.java
++++ b/net/minecraft/world/inventory/PlayerEnderChestContainer.java
+@@ -7,72 +7,86 @@
+ import net.minecraft.world.entity.player.Player;
+ import net.minecraft.world.item.ItemStack;
+ import net.minecraft.world.level.block.entity.EnderChestBlockEntity;
++// CraftBukkit start
++import org.bukkit.Location;
++import org.bukkit.craftbukkit.util.CraftLocation;
++import org.bukkit.inventory.InventoryHolder;
++// CraftBukkit end
+
+ public class PlayerEnderChestContainer extends SimpleContainer {
+
+ @Nullable
+ private EnderChestBlockEntity activeChest;
++ // CraftBukkit start
++ private final Player owner;
+
+- public PlayerEnderChestContainer() {
++ public InventoryHolder getBukkitOwner() {
++ return owner.getBukkitEntity();
++ }
++
++ @Override
++ public Location getLocation() {
++ return this.activeChest != null ? CraftLocation.toBukkit(this.activeChest.getBlockPos(), this.activeChest.getLevel().getWorld()) : null;
++ }
++
++ public PlayerEnderChestContainer(Player owner) {
+ super(27);
++ this.owner = owner;
++ // CraftBukkit end
+ }
+
+- public void setActiveChest(EnderChestBlockEntity enderchestblockentity) {
+- this.activeChest = enderchestblockentity;
++ public void setActiveChest(EnderChestBlockEntity enderChestBlockEntity) {
++ this.activeChest = enderChestBlockEntity;
+ }
+
+- public boolean isActiveChest(EnderChestBlockEntity enderchestblockentity) {
+- return this.activeChest == enderchestblockentity;
++ public boolean isActiveChest(EnderChestBlockEntity enderChest) {
++ return this.activeChest == enderChest;
+ }
+
+ @Override
+- @Override
+- public void fromTag(ListTag listtag) {
++ public void fromTag(ListTag containerNbt) {
+ int i;
+
+ for (i = 0; i < this.getContainerSize(); ++i) {
+ this.setItem(i, ItemStack.EMPTY);
+ }
+
+- for (i = 0; i < listtag.size(); ++i) {
+- CompoundTag compoundtag = listtag.getCompound(i);
+- int j = compoundtag.getByte("Slot") & 255;
++ for (i = 0; i < containerNbt.size(); ++i) {
++ CompoundTag nbttagcompound = containerNbt.getCompound(i);
++ int j = nbttagcompound.getByte("Slot") & 255;
+
+ if (j >= 0 && j < this.getContainerSize()) {
+- this.setItem(j, ItemStack.of(compoundtag));
++ this.setItem(j, ItemStack.of(nbttagcompound));
+ }
+ }
+
+ }
+
+ @Override
+- @Override
+ public ListTag createTag() {
+- ListTag listtag = new ListTag();
++ ListTag nbttaglist = new ListTag();
+
+ for (int i = 0; i < this.getContainerSize(); ++i) {
+ ItemStack itemstack = this.getItem(i);
+
+ if (!itemstack.isEmpty()) {
+- CompoundTag compoundtag = new CompoundTag();
++ CompoundTag nbttagcompound = new CompoundTag();
+
+- compoundtag.putByte("Slot", (byte) i);
+- itemstack.save(compoundtag);
+- listtag.add(compoundtag);
++ nbttagcompound.putByte("Slot", (byte) i);
++ itemstack.save(nbttagcompound);
++ nbttaglist.add(nbttagcompound);
+ }
+ }
+
+- return listtag;
++ return nbttaglist;
+ }
+
+ @Override
+- @Override
+ public boolean stillValid(Player player) {
+ return this.activeChest != null && !this.activeChest.stillValid(player) ? false : super.stillValid(player);
+ }
+
+ @Override
+- @Override
+ public void startOpen(Player player) {
+ if (this.activeChest != null) {
+ this.activeChest.startOpen(player);
+@@ -82,7 +96,6 @@
+ }
+
+ @Override
+- @Override
+ public void stopOpen(Player player) {
+ if (this.activeChest != null) {
+ this.activeChest.stopOpen(player);