mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
bfad1aa117
By: Miles Holder <mwholder2005@gmail.com>
72 lines
2.9 KiB
Diff
72 lines
2.9 KiB
Diff
--- a/net/minecraft/world/inventory/ContainerBeacon.java
|
|
+++ b/net/minecraft/world/inventory/ContainerBeacon.java
|
|
@@ -13,6 +13,11 @@
|
|
import net.minecraft.world.level.World;
|
|
import net.minecraft.world.level.block.Blocks;
|
|
|
|
+// CraftBukkit start
|
|
+import net.minecraft.world.entity.player.PlayerInventory;
|
|
+import org.bukkit.craftbukkit.inventory.view.CraftBeaconView;
|
|
+// CraftBukkit end
|
|
+
|
|
public class ContainerBeacon extends Container {
|
|
|
|
private static final int PAYMENT_SLOT = 0;
|
|
@@ -27,6 +32,10 @@
|
|
private final ContainerBeacon.SlotBeacon paymentSlot;
|
|
private final ContainerAccess access;
|
|
private final IContainerProperties beaconData;
|
|
+ // CraftBukkit start
|
|
+ private CraftBeaconView bukkitEntity = null;
|
|
+ private PlayerInventory player;
|
|
+ // CraftBukkit end
|
|
|
|
public ContainerBeacon(int i, IInventory iinventory) {
|
|
this(i, iinventory, new ContainerProperties(3), ContainerAccess.NULL);
|
|
@@ -34,7 +43,8 @@
|
|
|
|
public ContainerBeacon(int i, IInventory iinventory, IContainerProperties icontainerproperties, ContainerAccess containeraccess) {
|
|
super(Containers.BEACON, i);
|
|
- this.beacon = new InventorySubcontainer(this, 1) {
|
|
+ player = (PlayerInventory) iinventory; // CraftBukkit - TODO: check this
|
|
+ this.beacon = new InventorySubcontainer(1) { // CraftBukkit - decompile error
|
|
@Override
|
|
public boolean canPlaceItem(int j, ItemStack itemstack) {
|
|
return itemstack.is(TagsItem.BEACON_PAYMENT_ITEMS);
|
|
@@ -83,6 +93,7 @@
|
|
|
|
@Override
|
|
public boolean stillValid(EntityHuman entityhuman) {
|
|
+ if (!this.checkReachable) return true; // CraftBukkit
|
|
return stillValid(this.access, entityhuman, Blocks.BEACON);
|
|
}
|
|
|
|
@@ -164,8 +175,8 @@
|
|
|
|
public void updateEffects(Optional<Holder<MobEffectList>> optional, Optional<Holder<MobEffectList>> optional1) {
|
|
if (this.paymentSlot.hasItem()) {
|
|
- this.beaconData.set(1, encodeEffect((Holder) optional.orElse((Object) null)));
|
|
- this.beaconData.set(2, encodeEffect((Holder) optional1.orElse((Object) null)));
|
|
+ this.beaconData.set(1, encodeEffect((Holder) optional.orElse(null)));// CraftBukkit - decompile error
|
|
+ this.beaconData.set(2, encodeEffect((Holder) optional1.orElse(null)));// CraftBukkit - decompile error
|
|
this.paymentSlot.remove(1);
|
|
this.access.execute(World::blockEntityChanged);
|
|
}
|
|
@@ -192,4 +203,17 @@
|
|
return 1;
|
|
}
|
|
}
|
|
+
|
|
+ // CraftBukkit start
|
|
+ @Override
|
|
+ public CraftBeaconView getBukkitView() {
|
|
+ if (bukkitEntity != null) {
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+
|
|
+ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryBeacon(this.beacon);
|
|
+ bukkitEntity = new CraftBeaconView(this.player.player.getBukkitEntity(), inventory, this);
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|