Paper/nms-patches/ContainerShulkerBox.patch
2019-04-23 12:00:00 +10:00

39 lines
1.3 KiB
Diff

--- a/net/minecraft/server/ContainerShulkerBox.java
+++ b/net/minecraft/server/ContainerShulkerBox.java
@@ -1,8 +1,27 @@
package net.minecraft.server;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventory;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
+
public class ContainerShulkerBox extends Container {
private final IInventory c;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity;
+ private PlayerInventory player;
+
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), new CraftInventory(this.c), this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
public ContainerShulkerBox(int i, PlayerInventory playerinventory) {
this(i, playerinventory, new InventorySubcontainer(27));
@@ -12,6 +31,7 @@
super(Containers.SHULKER_BOX, i);
a(iinventory, 27);
this.c = iinventory;
+ this.player = playerinventory; // CraftBukkit - save player
iinventory.startOpen(playerinventory.player);
boolean flag = true;
boolean flag1 = true;