SPIGOT-6078: Add SmithItemEvent and expand SmithingInventory API

By: Julian van den Berkmortel <julianvdberkmortel@outlook.com>
This commit is contained in:
CraftBukkit/Spigot
2021-04-18 18:03:23 +10:00
parent 9d052543d0
commit 8cbaba0a8a
4 changed files with 122 additions and 56 deletions

View File

@@ -18,7 +18,7 @@
public ContainerSmithing(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.a);
@@ -63,13 +68,13 @@
@@ -63,13 +68,16 @@
List<RecipeSmithing> list = this.g.getCraftingManager().b(Recipes.SMITHING, this.repairInventory, this.g);
if (list.isEmpty()) {
@@ -30,11 +30,14 @@
this.resultInventory.a((IRecipe) this.h);
- this.resultInventory.setItem(0, itemstack);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), itemstack); // CraftBukkit
+ // CraftBukkit start
+ this.repairInventory.setCurrentRecipe(this.h);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), itemstack);
+ // CraftBukkit end
}
}
@@ -85,4 +90,18 @@
@@ -85,4 +93,18 @@
public boolean a(ItemStack itemstack, Slot slot) {
return slot.inventory != this.resultInventory && super.a(itemstack, slot);
}