diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/BeaconMenu.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/BeaconMenu.java.patch | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/BeaconMenu.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/BeaconMenu.java.patch new file mode 100644 index 0000000000..1ff8b5d884 --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/BeaconMenu.java.patch @@ -0,0 +1,67 @@ +--- a/net/minecraft/world/inventory/BeaconMenu.java ++++ b/net/minecraft/world/inventory/BeaconMenu.java +@@ -11,6 +12,8 @@ + import net.minecraft.world.item.ItemStack; + import net.minecraft.world.level.Level; + import net.minecraft.world.level.block.Blocks; ++import org.bukkit.craftbukkit.inventory.CraftInventoryView; ++// CraftBukkit end + + public class BeaconMenu extends AbstractContainerMenu { + private static final int PAYMENT_SLOT = 0; +@@ -35,6 +29,10 @@ + private final BeaconMenu.PaymentSlot paymentSlot; + private final ContainerLevelAccess access; + private final ContainerData beaconData; ++ // CraftBukkit start ++ private CraftInventoryView bukkitEntity = null; ++ private Inventory player; ++ // CraftBukkit end + + public BeaconMenu(int containerId, Container container) { + this(containerId, container, new SimpleContainerData(3), ContainerLevelAccess.NULL); +@@ -42,6 +40,18 @@ + + public BeaconMenu(int containerId, Container container, ContainerData beaconData, ContainerLevelAccess access) { + super(MenuType.BEACON, containerId); ++ player = (Inventory) container; // CraftBukkit - TODO: check this ++ this.beacon = new SimpleContainer(1) { ++ @Override ++ public boolean canPlaceItem(int index, ItemStack stack) { ++ return stack.is(ItemTags.BEACON_PAYMENT_ITEMS); ++ } ++ ++ @Override ++ public int getMaxStackSize() { ++ return 1; ++ } ++ }; + checkContainerDataCount(beaconData, 3); + this.beaconData = beaconData; + this.access = access; +@@ -75,6 +90,7 @@ + + @Override + public boolean stillValid(Player player) { ++ if (!this.checkReachable) return true; // CraftBukkit + return stillValid(this.access, player, Blocks.BEACON); + } + +@@ -180,4 +200,17 @@ + return 1; + } + } ++ ++ // CraftBukkit start ++ @Override ++ public CraftInventoryView getBukkitView() { ++ if (bukkitEntity != null) { ++ return bukkitEntity; ++ } ++ ++ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryBeacon(this.beacon); ++ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this); ++ return bukkitEntity; ++ } ++ // CraftBukkit end + } |