PaperMC/nms-patches/ContainerShulkerBox.patch

39 lines
1.3 KiB
Diff
Raw Normal View History

2016-11-17 02:41:03 +01:00
--- a/net/minecraft/server/ContainerShulkerBox.java
+++ b/net/minecraft/server/ContainerShulkerBox.java
2019-04-23 04:00:00 +02:00
@@ -1,8 +1,27 @@
2016-11-17 02:41:03 +01:00
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 {
2019-04-23 04:00:00 +02:00
private final IInventory c;
2016-11-17 02:41:03 +01:00
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity;
+ private PlayerInventory player;
+
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
2019-04-23 04:00:00 +02:00
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), new CraftInventory(this.c), this);
2016-11-17 02:41:03 +01:00
+ return bukkitEntity;
+ }
+ // CraftBukkit end
2019-04-23 04:00:00 +02:00
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;
2016-11-17 02:41:03 +01:00
+ this.player = playerinventory; // CraftBukkit - save player
2019-04-23 04:00:00 +02:00
iinventory.startOpen(playerinventory.player);
2016-11-17 02:41:03 +01:00
boolean flag = true;
boolean flag1 = true;