diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/CraftingMenu.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/CraftingMenu.java.patch | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/CraftingMenu.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/CraftingMenu.java.patch new file mode 100644 index 0000000000..becbef811b --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/CraftingMenu.java.patch @@ -0,0 +1,81 @@ +--- a/net/minecraft/world/inventory/CraftingMenu.java ++++ b/net/minecraft/world/inventory/CraftingMenu.java +@@ -14,6 +15,9 @@ + import net.minecraft.world.item.crafting.RecipeType; + import net.minecraft.world.level.Level; + import net.minecraft.world.level.block.Blocks; ++import org.bukkit.craftbukkit.inventory.CraftInventoryCrafting; ++import org.bukkit.craftbukkit.inventory.CraftInventoryView; ++// CraftBukkit end + + public class CraftingMenu extends RecipeBookMenu<CraftingContainer> { + +@@ -24,22 +28,28 @@ + private static final int INV_SLOT_END = 37; + private static final int USE_ROW_SLOT_START = 37; + private static final int USE_ROW_SLOT_END = 46; +- private final CraftingContainer craftSlots; +- private final ResultContainer resultSlots; +- private final ContainerLevelAccess access; ++ public final TransientCraftingContainer craftSlots; // CraftBukkit ++ public final ResultContainer resultSlots; ++ public final ContainerLevelAccess access; + private final Player player; ++ // CraftBukkit start ++ private CraftInventoryView bukkitEntity = null; ++ // CraftBukkit end + + public CraftingMenu(int i, Inventory inventory) { + this(i, inventory, ContainerLevelAccess.NULL); + } + +- public CraftingMenu(int i, Inventory inventory, ContainerLevelAccess containerlevelaccess) { +- super(MenuType.CRAFTING, i); +- this.craftSlots = new TransientCraftingContainer(this, 3, 3); ++ public CraftingMenu(int containerId, Inventory playerInventory, ContainerLevelAccess access) { ++ super(MenuType.CRAFTING, containerId); ++ // CraftBukkit start - Switched order of IInventory construction and stored player + this.resultSlots = new ResultContainer(); +- this.access = containerlevelaccess; +- this.player = inventory.player; +- this.addSlot(new ResultSlot(inventory.player, this.craftSlots, this.resultSlots, 0, 124, 35)); ++ this.craftSlots = new TransientCraftingContainer(this, 3, 3, playerInventory.player); // CraftBukkit - pass player ++ this.craftSlots.resultInventory = this.resultSlots; ++ // CraftBukkit end ++ this.access = access; ++ this.player = playerInventory.player; ++ this.addSlot(new ResultSlot(playerInventory.player, this.craftSlots, this.resultSlots, 0, 124, 35)); + + int j; + int k; +@@ -80,6 +90,7 @@ + } + } + } ++ itemstack = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(container, result, itemstack, menu.getBukkitView(), optional.map(RecipeHolder::toBukkitRecipe).orElse(null) instanceof RepairItemRecipe); // CraftBukkit + + resultcontainer.setItem(0, itemstack); + abstractcontainermenu.setRemoteSlot(0, itemstack); +@@ -126,6 +131,7 @@ + @Override + @Override + public boolean stillValid(Player player) { ++ if (!this.checkReachable) return true; // CraftBukkit + return stillValid(this.access, player, Blocks.CRAFTING_TABLE); + } + +@@ -218,8 +217,14 @@ + } + + @Override ++ public boolean shouldMoveToInventory(int slotIndex) { ++ return slotIndex != this.getResultSlotIndex(); ++ } ++ ++ // CraftBukkit start + @Override + public boolean shouldMoveToInventory(int i) { + return i != this.getResultSlotIndex(); + } ++ // CraftBukkit end + } |