2020-06-25 02:00:00 +02:00
|
|
|
--- a/net/minecraft/server/ContainerSmithing.java
|
|
|
|
+++ b/net/minecraft/server/ContainerSmithing.java
|
|
|
|
@@ -3,12 +3,17 @@
|
|
|
|
import java.util.List;
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
|
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class ContainerSmithing extends ContainerAnvilAbstract {
|
|
|
|
|
|
|
|
private final World g;
|
|
|
|
@Nullable
|
|
|
|
private RecipeSmithing h;
|
|
|
|
private final List<RecipeSmithing> i;
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ private CraftInventoryView bukkitEntity;
|
|
|
|
+ // CraftBukkit end
|
|
|
|
|
|
|
|
public ContainerSmithing(int i, PlayerInventory playerinventory) {
|
|
|
|
this(i, playerinventory, ContainerAccess.a);
|
2020-08-11 23:00:00 +02:00
|
|
|
@@ -54,13 +59,13 @@
|
2020-07-22 10:21:45 +02:00
|
|
|
List<RecipeSmithing> list = this.g.getCraftingManager().b(Recipes.SMITHING, this.repairInventory, this.g);
|
|
|
|
|
|
|
|
if (list.isEmpty()) {
|
|
|
|
- this.resultInventory.setItem(0, ItemStack.b);
|
|
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), ItemStack.b); // CraftBukkit
|
|
|
|
} else {
|
|
|
|
this.h = (RecipeSmithing) list.get(0);
|
|
|
|
ItemStack itemstack = this.h.a(this.repairInventory);
|
|
|
|
|
2020-08-11 23:00:00 +02:00
|
|
|
this.resultInventory.a((IRecipe) this.h);
|
2020-07-22 10:21:45 +02:00
|
|
|
- this.resultInventory.setItem(0, itemstack);
|
|
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), itemstack); // CraftBukkit
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2020-08-11 23:00:00 +02:00
|
|
|
@@ -76,4 +81,18 @@
|
|
|
|
public boolean a(ItemStack itemstack, Slot slot) {
|
|
|
|
return slot.inventory != this.resultInventory && super.a(itemstack, slot);
|
2020-06-25 02:00:00 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ @Override
|
|
|
|
+ public CraftInventoryView getBukkitView() {
|
|
|
|
+ if (bukkitEntity != null) {
|
|
|
|
+ return bukkitEntity;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventorySmithing(
|
2020-09-03 00:18:30 +02:00
|
|
|
+ containerAccess.getLocation(), this.repairInventory, this.resultInventory);
|
2020-06-25 02:00:00 +02:00
|
|
|
+ bukkitEntity = new CraftInventoryView(this.player.getBukkitEntity(), inventory, this);
|
|
|
|
+ return bukkitEntity;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|