blob: 033120bdecbcd3b4ad8fe6bcbfa6ed90767f4622 [file] [log] [blame] [raw]
package li.cil.oc.integration.vanilla;
import li.cil.oc.api.driver.NamedBlock;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.prefab.DriverTileEntity;
import li.cil.oc.integration.ManagedTileEntityEnvironment;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.world.World;
public final class DriverFurnace extends DriverTileEntity {
@Override
public Class<?> getTileEntityClass() {
return TileEntityFurnace.class;
}
@Override
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
return new Environment((TileEntityFurnace) world.getTileEntity(x, y, z));
}
public static final class Environment extends ManagedTileEntityEnvironment<TileEntityFurnace> implements NamedBlock {
public Environment(final TileEntityFurnace tileEntity) {
super(tileEntity, "furnace");
}
@Override
public String preferredName() {
return "furnace";
}
@Override
public int priority() {
return 0;
}
@Callback(doc = "function():number -- The number of ticks that the furnace will keep burning from the last consumed fuel.")
public Object[] getBurnTime(final Context context, final Arguments args) {
return new Object[]{tileEntity.furnaceBurnTime};
}
@Callback(doc = "function():number -- The number of ticks that the current item has been cooking for.")
public Object[] getCookTime(final Context context, final Arguments args) {
return new Object[]{tileEntity.furnaceCookTime};
}
@Callback(doc = "function():number -- The number of ticks that the currently burning fuel lasts in total.")
public Object[] getCurrentItemBurnTime(final Context context, final Arguments args) {
return new Object[]{tileEntity.currentItemBurnTime};
}
@Callback(doc = "function():boolean -- Get whether the furnace is currently active.")
public Object[] isBurning(final Context context, final Arguments args) {
return new Object[]{tileEntity.isBurning()};
}
}
}