--- a/net/minecraft/world/inventory/ContainerFurnace.java +++ b/net/minecraft/world/inventory/ContainerFurnace.java @@ -12,6 +12,11 @@ import net.minecraft.world.level.World; import net.minecraft.world.level.block.entity.TileEntityFurnace; +// CraftBukkit start +import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace; +import org.bukkit.craftbukkit.inventory.CraftInventoryView; +// CraftBukkit end + public abstract class ContainerFurnace extends ContainerRecipeBook { public static final int INGREDIENT_SLOT = 0; @@ -29,6 +34,22 @@ private final Recipes recipeType; private final RecipeBookType recipeBookType; + // CraftBukkit start + private CraftInventoryView bukkitEntity = null; + private PlayerInventory player; + + @Override + public CraftInventoryView getBukkitView() { + if (bukkitEntity != null) { + return bukkitEntity; + } + + CraftInventoryFurnace inventory = new CraftInventoryFurnace((TileEntityFurnace) this.container); + bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this); + return bukkitEntity; + } + // CraftBukkit end + protected ContainerFurnace(Containers containers, Recipes recipes, RecipeBookType recipebooktype, int i, PlayerInventory playerinventory) { this(containers, recipes, recipebooktype, i, playerinventory, new InventorySubcontainer(3), new ContainerProperties(4)); } @@ -45,6 +66,7 @@ this.addSlot(new Slot(iinventory, 0, 56, 17)); this.addSlot(new SlotFurnaceFuel(this, iinventory, 1, 56, 53)); this.addSlot(new SlotFurnaceResult(playerinventory.player, iinventory, 2, 116, 35)); + this.player = playerinventory; // CraftBukkit - save player int j; @@ -102,6 +124,7 @@ @Override public boolean stillValid(EntityHuman entityhuman) { + if (!this.checkReachable) return true; // CraftBukkit return this.container.stillValid(entityhuman); } @@ -157,7 +180,7 @@ } protected boolean canSmelt(ItemStack itemstack) { - return this.level.getRecipeManager().getRecipeFor(this.recipeType, new InventorySubcontainer(new ItemStack[]{itemstack}), this.level).isPresent(); + return this.level.getRecipeManager().getRecipeFor((Recipes) this.recipeType, new InventorySubcontainer(new ItemStack[]{itemstack}), this.level).isPresent(); // Eclipse fail } protected boolean isFuel(ItemStack itemstack) {