aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/LoomMenu.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/LoomMenu.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/LoomMenu.java.patch121
1 files changed, 121 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/LoomMenu.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/LoomMenu.java.patch
new file mode 100644
index 0000000000..0fa04cefb8
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/LoomMenu.java.patch
@@ -0,0 +1,121 @@
+--- a/net/minecraft/world/inventory/LoomMenu.java
++++ b/net/minecraft/world/inventory/LoomMenu.java
+@@ -24,8 +22,30 @@
+ import net.minecraft.world.level.block.Blocks;
+ import net.minecraft.world.level.block.entity.BannerPattern;
+ import net.minecraft.world.level.block.entity.BlockEntityType;
++// 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 LoomMenu extends AbstractContainerMenu {
++
++ // 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;
+@@ -63,6 +69,39 @@
+
+ public LoomMenu(int containerId, Inventory playerInventory, final ContainerLevelAccess access) {
+ super(MenuType.LOOM, containerId);
++ this.selectedBannerPatternIndex = DataSlot.standalone();
++ this.selectablePatterns = List.of();
++ this.slotUpdateListener = () -> {
++ };
++ this.inputContainer = new SimpleContainer(3) {
++ @Override
++ public void setChanged() {
++ super.setChanged();
++ LoomMenu.this.slotsChanged(this);
++ LoomMenu.this.slotUpdateListener.run();
++ }
++
++ // CraftBukkit start
++ @Override
++ public Location getLocation() {
++ return access.getLocation();
++ }
++ // CraftBukkit end
++ };
++ this.outputContainer = new SimpleContainer(1) {
++ @Override
++ public void setChanged() {
++ super.setChanged();
++ LoomMenu.this.slotUpdateListener.run();
++ }
++
++ // CraftBukkit start
++ @Override
++ public Location getLocation() {
++ return access.getLocation();
++ }
++ // CraftBukkit end
++ };
+ this.access = access;
+ this.bannerSlot = this.addSlot(new Slot(this.inputContainer, 0, 13, 26) {
+ @Override
+@@ -118,10 +161,12 @@
+ }
+
+ this.addDataSlot(this.selectedBannerPatternIndex);
++ player = (Player) playerInventory.player.getBukkitEntity(); // CraftBukkit
+ }
+
+ @Override
+- public boolean stillValid(Player player) {
++ public boolean stillValid(net.minecraft.world.entity.player.Player player) {
++ if (!this.checkReachable) return true; // CraftBukkit
+ return stillValid(this.access, player, Blocks.LOOM);
+ }
+
+@@ -275,16 +332,23 @@
+ }
+
+ private void setupResultSlot(Holder<BannerPattern> pattern) {
+- ItemStack item = this.bannerSlot.getItem();
+- ItemStack item1 = this.dyeSlot.getItem();
+- ItemStack itemStack = ItemStack.EMPTY;
+- if (!item.isEmpty() && !item1.isEmpty()) {
+- itemStack = item.copyWithCount(1);
+- DyeColor dyeColor = ((DyeItem)item1.getItem()).getDyeColor();
+- CompoundTag blockEntityData = BlockItem.getBlockEntityData(itemStack);
+- ListTag list;
+- if (blockEntityData != null && blockEntityData.contains("Patterns", 9)) {
+- list = blockEntityData.getList("Patterns", 10);
++ ItemStack itemstack = this.bannerSlot.getItem();
++ ItemStack itemstack1 = this.dyeSlot.getItem();
++ ItemStack itemstack2 = ItemStack.EMPTY;
++
++ if (!itemstack.isEmpty() && !itemstack1.isEmpty()) {
++ itemstack2 = itemstack.copyWithCount(1);
++ DyeColor enumcolor = ((DyeItem) itemstack1.getItem()).getDyeColor();
++ CompoundTag nbttagcompound = BlockItem.getBlockEntityData(itemstack2);
++ ListTag nbttaglist;
++
++ if (nbttagcompound != null && nbttagcompound.contains("Patterns", 9)) {
++ nbttaglist = nbttagcompound.getList("Patterns", 10);
++ // CraftBukkit start
++ while (nbttaglist.size() > 20) {
++ nbttaglist.remove(20);
++ }
++ // CraftBukkit end
+ } else {
+ list = new ListTag();
+ if (blockEntityData == null) {