mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 03:52:45 +01:00
9d740b84b0
By: md_5 <git@md-5.net>
86 lines
2.9 KiB
Diff
86 lines
2.9 KiB
Diff
--- a/net/minecraft/world/inventory/ContainerLoom.java
|
|
+++ b/net/minecraft/world/inventory/ContainerLoom.java
|
|
@@ -24,8 +24,30 @@
|
|
import net.minecraft.world.level.block.entity.EnumBannerPatternType;
|
|
import net.minecraft.world.level.block.entity.TileEntityTypes;
|
|
|
|
+// 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.inputContainer, this.outputContainer);
|
|
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
private static final int PATTERN_NOT_SET = -1;
|
|
private static final int INV_SLOT_START = 4;
|
|
private static final int INV_SLOT_END = 31;
|
|
@@ -60,6 +82,13 @@
|
|
ContainerLoom.this.slotsChanged(this);
|
|
ContainerLoom.this.slotUpdateListener.run();
|
|
}
|
|
+
|
|
+ // CraftBukkit start
|
|
+ @Override
|
|
+ public Location getLocation() {
|
|
+ return containeraccess.getLocation();
|
|
+ }
|
|
+ // CraftBukkit end
|
|
};
|
|
this.outputContainer = new InventorySubcontainer(1) {
|
|
@Override
|
|
@@ -67,6 +96,13 @@
|
|
super.setChanged();
|
|
ContainerLoom.this.slotUpdateListener.run();
|
|
}
|
|
+
|
|
+ // CraftBukkit start
|
|
+ @Override
|
|
+ public Location getLocation() {
|
|
+ return containeraccess.getLocation();
|
|
+ }
|
|
+ // CraftBukkit end
|
|
};
|
|
this.access = containeraccess;
|
|
this.bannerSlot = this.addSlot(new Slot(this.inputContainer, 0, 13, 26) {
|
|
@@ -127,10 +163,12 @@
|
|
}
|
|
|
|
this.addDataSlot(this.selectedBannerPatternIndex);
|
|
+ player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit
|
|
}
|
|
|
|
@Override
|
|
public boolean stillValid(EntityHuman entityhuman) {
|
|
+ if (!this.checkReachable) return true; // CraftBukkit
|
|
return stillValid(this.access, entityhuman, Blocks.LOOM);
|
|
}
|
|
|
|
@@ -308,6 +346,11 @@
|
|
|
|
if (nbttagcompound != null && nbttagcompound.contains("Patterns", 9)) {
|
|
nbttaglist = nbttagcompound.getList("Patterns", 10);
|
|
+ // CraftBukkit start
|
|
+ while (nbttaglist.size() > 20) {
|
|
+ nbttaglist.remove(20);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
} else {
|
|
nbttaglist = new NBTTagList();
|
|
if (nbttagcompound == null) {
|