SPIGOT-6078: Add SmithItemEvent and expand SmithingInventory API
By: Julian van den Berkmortel <julianvdberkmortel@outlook.com>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user