mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
b3a8254758
By: md_5 <git@md-5.net>
57 lines
2.3 KiB
Diff
57 lines
2.3 KiB
Diff
--- a/net/minecraft/world/inventory/ContainerSmithing.java
|
|
+++ b/net/minecraft/world/inventory/ContainerSmithing.java
|
|
@@ -11,12 +11,17 @@
|
|
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 {
|
|
|
|
private final World level;
|
|
@Nullable
|
|
private RecipeSmithing selectedRecipe;
|
|
private final List<RecipeSmithing> recipes;
|
|
+ // CraftBukkit start
|
|
+ private CraftInventoryView bukkitEntity;
|
|
+ // CraftBukkit end
|
|
|
|
public ContainerSmithing(int i, PlayerInventory playerinventory) {
|
|
this(i, playerinventory, ContainerAccess.NULL);
|
|
@@ -61,13 +66,15 @@
|
|
List<RecipeSmithing> list = this.level.getCraftingManager().b(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 {
|
|
this.selectedRecipe = (RecipeSmithing) list.get(0);
|
|
ItemStack itemstack = this.selectedRecipe.a(this.inputSlots);
|
|
|
|
this.resultSlots.setRecipeUsed(this.selectedRecipe);
|
|
- this.resultSlots.setItem(0, itemstack);
|
|
+ // CraftBukkit start
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), itemstack);
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
}
|
|
@@ -83,4 +90,18 @@
|
|
public boolean a(ItemStack itemstack, Slot slot) {
|
|
return slot.container != this.resultSlots && super.a(itemstack, slot);
|
|
}
|
|
+
|
|
+ // 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
|
|
}
|