mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 10:17:38 +01:00
8a3c8cfcd4
By: md_5 <git@md-5.net>
71 lines
2.8 KiB
Diff
71 lines
2.8 KiB
Diff
--- a/net/minecraft/world/inventory/ContainerBeacon.java
|
|
+++ b/net/minecraft/world/inventory/ContainerBeacon.java
|
|
@@ -12,6 +12,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.CraftInventoryView;
|
|
+// CraftBukkit end
|
|
+
|
|
public class ContainerBeacon extends Container {
|
|
|
|
private static final int PAYMENT_SLOT = 0;
|
|
@@ -26,6 +31,10 @@
|
|
private final ContainerBeacon.SlotBeacon paymentSlot;
|
|
private final ContainerAccess access;
|
|
private final IContainerProperties beaconData;
|
|
+ // CraftBukkit start
|
|
+ private CraftInventoryView bukkitEntity = null;
|
|
+ private PlayerInventory player;
|
|
+ // CraftBukkit end
|
|
|
|
public ContainerBeacon(int i, IInventory iinventory) {
|
|
this(i, iinventory, new ContainerProperties(3), ContainerAccess.NULL);
|
|
@@ -33,6 +42,7 @@
|
|
|
|
public ContainerBeacon(int i, IInventory iinventory, IContainerProperties icontainerproperties, ContainerAccess containeraccess) {
|
|
super(Containers.BEACON, i);
|
|
+ player = (PlayerInventory) iinventory; // CraftBukkit - TODO: check this
|
|
this.beacon = new InventorySubcontainer(1) {
|
|
@Override
|
|
public boolean canPlaceItem(int j, ItemStack itemstack) {
|
|
@@ -82,6 +92,7 @@
|
|
|
|
@Override
|
|
public boolean stillValid(EntityHuman entityhuman) {
|
|
+ if (!this.checkReachable) return true; // CraftBukkit
|
|
return stillValid(this.access, entityhuman, Blocks.BEACON);
|
|
}
|
|
|
|
@@ -163,8 +174,8 @@
|
|
|
|
public void updateEffects(Optional<MobEffectList> optional, Optional<MobEffectList> optional1) {
|
|
if (this.paymentSlot.hasItem()) {
|
|
- this.beaconData.set(1, encodeEffect((MobEffectList) optional.orElse((Object) null)));
|
|
- this.beaconData.set(2, encodeEffect((MobEffectList) optional1.orElse((Object) null)));
|
|
+ this.beaconData.set(1, encodeEffect((MobEffectList) optional.orElse(null))); // CraftBukkit - decompile error
|
|
+ this.beaconData.set(2, encodeEffect((MobEffectList) optional1.orElse(null))); // CraftBukkit - decompile error
|
|
this.paymentSlot.remove(1);
|
|
this.access.execute(World::blockEntityChanged);
|
|
}
|
|
@@ -191,4 +202,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
|
|
}
|