mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-30 20:03:51 -07:00
60
paper-server/nms-patches/ContainerLectern.patch
Normal file
60
paper-server/nms-patches/ContainerLectern.patch
Normal file
@@ -0,0 +1,60 @@
|
||||
--- a/net/minecraft/server/ContainerLectern.java
|
||||
+++ b/net/minecraft/server/ContainerLectern.java
|
||||
@@ -1,15 +1,38 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.inventory.CraftInventoryLectern;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
+import org.bukkit.entity.Player;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class ContainerLectern extends Container {
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private CraftInventoryView bukkitEntity = null;
|
||||
+ private Player player;
|
||||
+
|
||||
+ @Override
|
||||
+ public CraftInventoryView getBukkitView() {
|
||||
+ if (bukkitEntity != null) {
|
||||
+ return bukkitEntity;
|
||||
+ }
|
||||
+
|
||||
+ CraftInventoryLectern inventory = new CraftInventoryLectern(this.inventory);
|
||||
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
|
||||
+ return bukkitEntity;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
private final IInventory inventory;
|
||||
private final IContainerProperties containerProperties;
|
||||
|
||||
- public ContainerLectern(int i) {
|
||||
- this(i, new InventorySubcontainer(1), new ContainerProperties(1));
|
||||
+ // CraftBukkit start - add player
|
||||
+ public ContainerLectern(int i, PlayerInventory playerinventory) {
|
||||
+ this(i, new InventorySubcontainer(1), new ContainerProperties(1), playerinventory);
|
||||
}
|
||||
|
||||
- public ContainerLectern(int i, IInventory iinventory, IContainerProperties icontainerproperties) {
|
||||
+ public ContainerLectern(int i, IInventory iinventory, IContainerProperties icontainerproperties, PlayerInventory playerinventory) {
|
||||
+ // CraftBukkit end
|
||||
super(Containers.LECTERN, i);
|
||||
a(iinventory, 1);
|
||||
a(icontainerproperties, 1);
|
||||
@@ -23,6 +46,7 @@
|
||||
}
|
||||
});
|
||||
this.a(icontainerproperties);
|
||||
+ player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,6 +94,7 @@
|
||||
|
||||
@Override
|
||||
public boolean canUse(EntityHuman entityhuman) {
|
||||
+ if (!this.checkReachable) return true; // CraftBukkit
|
||||
return this.inventory.a(entityhuman);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user