diff options
Diffstat (limited to 'patch-remap/og/net/minecraft/world/inventory/ContainerSmithing.patch')
-rw-r--r-- | patch-remap/og/net/minecraft/world/inventory/ContainerSmithing.patch | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/inventory/ContainerSmithing.patch b/patch-remap/og/net/minecraft/world/inventory/ContainerSmithing.patch new file mode 100644 index 0000000000..3484de6c67 --- /dev/null +++ b/patch-remap/og/net/minecraft/world/inventory/ContainerSmithing.patch @@ -0,0 +1,60 @@ +--- a/net/minecraft/world/inventory/ContainerSmithing.java ++++ b/net/minecraft/world/inventory/ContainerSmithing.java +@@ -13,6 +13,8 @@ + import net.minecraft.world.level.block.Blocks; + import net.minecraft.world.level.block.state.IBlockData; + ++import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit ++ + public class ContainerSmithing extends ContainerAnvilAbstract { + + public static final int TEMPLATE_SLOT = 0; +@@ -28,6 +30,9 @@ + @Nullable + private RecipeHolder<SmithingRecipe> selectedRecipe; + private final List<RecipeHolder<SmithingRecipe>> recipes; ++ // CraftBukkit start ++ private CraftInventoryView bukkitEntity; ++ // CraftBukkit end + + public ContainerSmithing(int i, PlayerInventory playerinventory) { + this(i, playerinventory, ContainerAccess.NULL); +@@ -97,7 +102,7 @@ + List<RecipeHolder<SmithingRecipe>> list = this.level.getRecipeManager().getRecipesFor(Recipes.SMITHING, this.inputSlots, this.level); + + if (list.isEmpty()) { +- this.resultSlots.setItem(0, ItemStack.EMPTY); ++ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit + } else { + RecipeHolder<SmithingRecipe> recipeholder = (RecipeHolder) list.get(0); + ItemStack itemstack = ((SmithingRecipe) recipeholder.value()).assemble(this.inputSlots, this.level.registryAccess()); +@@ -105,7 +110,9 @@ + if (itemstack.isItemEnabled(this.level.enabledFeatures())) { + this.selectedRecipe = recipeholder; + this.resultSlots.setRecipeUsed(recipeholder); +- this.resultSlots.setItem(0, itemstack); ++ // CraftBukkit start ++ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), itemstack); ++ // CraftBukkit end + } + } + +@@ -137,4 +144,18 @@ + return !this.getSlot(i).hasItem(); + }).findFirst(); + } ++ ++ // CraftBukkit start ++ @Override ++ public CraftInventoryView getBukkitView() { ++ if (bukkitEntity != null) { ++ return bukkitEntity; ++ } ++ ++ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventorySmithing( ++ access.getLocation(), this.inputSlots, this.resultSlots); ++ bukkitEntity = new CraftInventoryView(this.player.getBukkitEntity(), inventory, this); ++ return bukkitEntity; ++ } ++ // CraftBukkit end + } |