2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/inventory/ContainerLoom.java
|
|
|
|
+++ b/net/minecraft/world/inventory/ContainerLoom.java
|
2022-06-07 18:00:00 +02:00
|
|
|
@@ -24,8 +24,30 @@
|
2021-03-15 23:00:00 +01:00
|
|
|
import net.minecraft.world.level.block.entity.EnumBannerPatternType;
|
2021-11-21 23:00:00 +01:00
|
|
|
import net.minecraft.world.level.block.entity.TileEntityTypes;
|
2019-04-23 04:00:00 +02:00
|
|
|
|
|
|
|
+// 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;
|
|
|
|
+ }
|
|
|
|
+
|
2021-06-11 07:00:00 +02:00
|
|
|
+ CraftInventoryLoom inventory = new CraftInventoryLoom(this.inputContainer, this.outputContainer);
|
2019-04-23 04:00:00 +02:00
|
|
|
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
|
|
|
|
+ return bukkitEntity;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2022-06-07 18:00:00 +02:00
|
|
|
private static final int PATTERN_NOT_SET = -1;
|
2021-06-11 07:00:00 +02:00
|
|
|
private static final int INV_SLOT_START = 4;
|
|
|
|
private static final int INV_SLOT_END = 31;
|
2022-06-07 18:00:00 +02:00
|
|
|
@@ -60,6 +82,13 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
ContainerLoom.this.slotsChanged(this);
|
2021-06-11 07:00:00 +02:00
|
|
|
ContainerLoom.this.slotUpdateListener.run();
|
2019-04-23 04:00:00 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ @Override
|
|
|
|
+ public Location getLocation() {
|
|
|
|
+ return containeraccess.getLocation();
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
};
|
2021-06-11 07:00:00 +02:00
|
|
|
this.outputContainer = new InventorySubcontainer(1) {
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
2022-06-07 18:00:00 +02:00
|
|
|
@@ -67,6 +96,13 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
super.setChanged();
|
2021-06-11 07:00:00 +02:00
|
|
|
ContainerLoom.this.slotUpdateListener.run();
|
2019-04-23 04:00:00 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ @Override
|
|
|
|
+ public Location getLocation() {
|
|
|
|
+ return containeraccess.getLocation();
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
};
|
2021-06-11 07:00:00 +02:00
|
|
|
this.access = containeraccess;
|
2021-11-21 23:00:00 +01:00
|
|
|
this.bannerSlot = this.addSlot(new Slot(this.inputContainer, 0, 13, 26) {
|
2022-06-07 18:00:00 +02:00
|
|
|
@@ -127,10 +163,12 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
}
|
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
this.addDataSlot(this.selectedBannerPatternIndex);
|
2019-04-23 04:00:00 +02:00
|
|
|
+ player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-11-21 23:00:00 +01:00
|
|
|
public boolean stillValid(EntityHuman entityhuman) {
|
2019-04-23 04:00:00 +02:00
|
|
|
+ if (!this.checkReachable) return true; // CraftBukkit
|
2021-11-21 23:00:00 +01:00
|
|
|
return stillValid(this.access, entityhuman, Blocks.LOOM);
|
2019-04-23 04:00:00 +02:00
|
|
|
}
|
|
|
|
|
2023-06-07 17:30:00 +02:00
|
|
|
@@ -308,6 +346,11 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
|
2022-06-07 18:00:00 +02:00
|
|
|
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) {
|