craftbukkit/nms-patches/net/minecraft/world/inventory/ContainerShulkerBox.patch

41 lines
1.4 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/inventory/ContainerShulkerBox.java
+++ b/net/minecraft/world/inventory/ContainerShulkerBox.java
2021-06-11 15:00:00 +10:00
@@ -6,10 +6,29 @@
2021-03-16 09:00:00 +11:00
import net.minecraft.world.entity.player.PlayerInventory;
import net.minecraft.world.item.ItemStack;
2016-11-17 12:41:03 +11:00
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventory;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
+
public class ContainerShulkerBox extends Container {
2021-06-11 15:00:00 +10:00
private static final int CONTAINER_SIZE = 27;
private final IInventory container;
2016-11-17 12:41:03 +11:00
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity;
+ private PlayerInventory player;
+
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
2021-06-11 15:00:00 +10:00
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), new CraftInventory(this.container), this);
2016-11-17 12:41:03 +11:00
+ return bukkitEntity;
+ }
+ // CraftBukkit end
2019-04-23 12:00:00 +10:00
public ContainerShulkerBox(int i, PlayerInventory playerinventory) {
this(i, playerinventory, new InventorySubcontainer(27));
2021-06-11 15:00:00 +10:00
@@ -19,6 +38,7 @@
2019-04-23 12:00:00 +10:00
super(Containers.SHULKER_BOX, i);
2021-11-22 09:00:00 +11:00
checkContainerSize(iinventory, 27);
2021-06-11 15:00:00 +10:00
this.container = iinventory;
2016-11-17 12:41:03 +11:00
+ this.player = playerinventory; // CraftBukkit - save player
2019-04-23 12:00:00 +10:00
iinventory.startOpen(playerinventory.player);
2016-11-17 12:41:03 +11:00
boolean flag = true;
boolean flag1 = true;