Celtic Minstrel 0842bab48b [Bleeding] Implementation of inventory framework. Addresses BUKKIT-856
See the corresponding Bukkit commit for details.

Implementation details:
- Any packets that include an itemstack will send air stacks as null; maybe this will even eliminate the client crash that occurs if the client receives an air stack
- Better handling of null itemstacks in general (ie less converting them to air stacks)
- Inventory.setContents() can now take an array smaller than the inventory without error
- Player.updateInventory() should now correctly update the result slot in a crafting inventory

Some small credit goes to Afforess (initial implementation of openInventory() methods) and Drakia (initial implementation of InventoryOpenEvent and InventoryCloseEvent).
2012-02-29 15:19:07 -05:00

52 lines
1.3 KiB
Java

package org.bukkit.craftbukkit.block;
import net.minecraft.server.TileEntityFurnace;
import org.bukkit.block.Block;
import org.bukkit.block.Furnace;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
import org.bukkit.inventory.FurnaceInventory;
public class CraftFurnace extends CraftBlockState implements Furnace {
private final CraftWorld world;
private final TileEntityFurnace furnace;
public CraftFurnace(final Block block) {
super(block);
world = (CraftWorld) block.getWorld();
furnace = (TileEntityFurnace) world.getTileEntityAt(getX(), getY(), getZ());
}
public FurnaceInventory getInventory() {
return new CraftInventoryFurnace(furnace);
}
@Override
public boolean update(boolean force) {
boolean result = super.update(force);
if (result) {
furnace.update();
}
return result;
}
public short getBurnTime() {
return (short) furnace.burnTime;
}
public void setBurnTime(short burnTime) {
furnace.burnTime = burnTime;
}
public short getCookTime() {
return (short) furnace.cookTime;
}
public void setCookTime(short cookTime) {
furnace.cookTime = cookTime;
}
}