SPIGOT-6434: Smithing Table and Anvil inventories .getType() returns CRAFTING

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-04-25 08:34:44 +10:00
parent 93ddc2d863
commit 4d865daa32
3 changed files with 11 additions and 37 deletions

View File

@@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.inventory;
import net.minecraft.world.IInventory;
import net.minecraft.world.inventory.InventoryCraftResult;
import net.minecraft.world.item.crafting.IRecipe;
import org.bukkit.Location;
import org.bukkit.inventory.ItemStack;
@@ -11,11 +12,16 @@ public class CraftInventorySmithing extends CraftResultInventory implements Smit
private final Location location;
public CraftInventorySmithing(Location location, IInventory inventory, IInventory resultInventory) {
public CraftInventorySmithing(Location location, IInventory inventory, InventoryCraftResult resultInventory) {
super(inventory, resultInventory);
this.location = location;
}
@Override
public InventoryCraftResult getResultInventory() {
return (InventoryCraftResult) super.getResultInventory();
}
@Override
public Location getLocation() {
return location;
@@ -33,7 +39,7 @@ public class CraftInventorySmithing extends CraftResultInventory implements Smit
@Override
public Recipe getRecipe() {
IRecipe recipe = getInventory().getCurrentRecipe();
IRecipe recipe = getResultInventory().ak_();
return (recipe == null) ? null : recipe.toBukkitRecipe();
}
}