mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 20:46:59 +01:00
86 lines
2.7 KiB
Diff
86 lines
2.7 KiB
Diff
--- a/net/minecraft/server/ContainerLoom.java
|
|
+++ b/net/minecraft/server/ContainerLoom.java
|
|
@@ -1,7 +1,29 @@
|
|
package net.minecraft.server;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.Location;
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryLoom;
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
|
+import org.bukkit.entity.Player;
|
|
+// CraftBukkit end
|
|
+
|
|
public class ContainerLoom extends Container {
|
|
|
|
+ // CraftBukkit start
|
|
+ private CraftInventoryView bukkitEntity = null;
|
|
+ private Player player;
|
|
+
|
|
+ @Override
|
|
+ public CraftInventoryView getBukkitView() {
|
|
+ if (bukkitEntity != null) {
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+
|
|
+ CraftInventoryLoom inventory = new CraftInventoryLoom(this.craftInventory, this.resultInventory);
|
|
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
private final ContainerAccess containerAccess;
|
|
private final ContainerProperty d;
|
|
private Runnable e;
|
|
@@ -28,6 +50,13 @@
|
|
ContainerLoom.this.a((IInventory) this);
|
|
ContainerLoom.this.e.run();
|
|
}
|
|
+
|
|
+ // CraftBukkit start
|
|
+ @Override
|
|
+ public Location getLocation() {
|
|
+ return containeraccess.getLocation();
|
|
+ }
|
|
+ // CraftBukkit end
|
|
};
|
|
this.resultInventory = new InventorySubcontainer(1) {
|
|
@Override
|
|
@@ -35,6 +64,13 @@
|
|
super.update();
|
|
ContainerLoom.this.e.run();
|
|
}
|
|
+
|
|
+ // CraftBukkit start
|
|
+ @Override
|
|
+ public Location getLocation() {
|
|
+ return containeraccess.getLocation();
|
|
+ }
|
|
+ // CraftBukkit end
|
|
};
|
|
this.containerAccess = containeraccess;
|
|
this.f = this.a(new Slot(this.craftInventory, 0, 13, 26) {
|
|
@@ -89,10 +125,12 @@
|
|
}
|
|
|
|
this.a(this.d);
|
|
+ player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit
|
|
}
|
|
|
|
@Override
|
|
public boolean canUse(EntityHuman entityhuman) {
|
|
+ if (!this.checkReachable) return true; // CraftBukkit
|
|
return a(this.containerAccess, entityhuman, Blocks.LOOM);
|
|
}
|
|
|
|
@@ -211,6 +249,11 @@
|
|
|
|
if (nbttagcompound.hasKeyOfType("Patterns", 9)) {
|
|
nbttaglist = nbttagcompound.getList("Patterns", 10);
|
|
+ // CraftBukkit start
|
|
+ while (nbttaglist.size() > 20) {
|
|
+ nbttaglist.remove(20);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
} else {
|
|
nbttaglist = new NBTTagList();
|
|
nbttagcompound.set("Patterns", nbttaglist);
|