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

@@ -1,7 +1,10 @@
package org.bukkit.craftbukkit.inventory;
import net.minecraft.world.IInventory;
import net.minecraft.world.item.crafting.IRecipe;
import org.bukkit.Location;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.SmithingInventory;
public class CraftInventorySmithing extends CraftResultInventory implements SmithingInventory {
@@ -17,4 +20,20 @@ public class CraftInventorySmithing extends CraftResultInventory implements Smit
public Location getLocation() {
return location;
}
@Override
public ItemStack getResult() {
return getItem(2);
}
@Override
public void setResult(ItemStack item) {
setItem(2, item);
}
@Override
public Recipe getRecipe() {
IRecipe recipe = getInventory().getCurrentRecipe();
return (recipe == null) ? null : recipe.toBukkitRecipe();
}
}