net.minecraft.block.BlockFurnace Java Examples

The following examples show how to use net.minecraft.block.BlockFurnace. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HeatBehaviourFurnace.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void update(){
    TileEntityFurnace furnace = getTileEntity();
    if(getHeatExchanger().getTemperature() > 373) {
        if(furnace.furnaceBurnTime < 190 && furnace.getStackInSlot(0) != null) {
            if(furnace.furnaceBurnTime == 0) BlockFurnace.updateFurnaceBlockState(true, furnace.getWorldObj(), furnace.xCoord, furnace.yCoord, furnace.zCoord);
            furnace.currentItemBurnTime = 200;
            furnace.furnaceBurnTime += 10;
            getHeatExchanger().addHeat(-1);
        }
        if(furnace.furnaceCookTime > 0) {//Easy performance saver, the Furnace won't be ticked unnecessary when there's nothing to cook (or when just started cooking).
            int progress = Math.max(0, ((int)getHeatExchanger().getTemperature() - 343) / 30);
            progress = Math.min(5, progress);
            for(int i = 0; i < progress; i++) {
                furnace.updateEntity();
            }
        }
    }
}
 
Example #2
Source File: Furnace.java    From minecraft-roguelike with GNU General Public License v3.0 6 votes vote down vote up
public static void generate(IWorldEditor editor, ItemStack fuel, boolean lit, Cardinal dir, Coord pos){

		if(!RogueConfig.getBoolean(RogueConfig.FURNITURE)) return;
		
		MetaBlock furnace;
		
		if(lit){
			furnace = new MetaBlock(Blocks.LIT_FURNACE);
		} else {
			furnace = new MetaBlock(Blocks.FURNACE);
		}
		
		furnace.withProperty(BlockFurnace.FACING, Cardinal.facing(Cardinal.reverse(dir)));
		
		furnace.set(editor, pos);
		
		if(fuel == null) return;
		
		TileEntity te = editor.getTileEntity(pos);
		if(te == null) return;
		if(!(te instanceof TileEntityFurnace)) return;
		TileEntityFurnace teFurnace = (TileEntityFurnace)te;
		teFurnace.setInventorySlotContents(FUEL_SLOT, fuel);
	}
 
Example #3
Source File: NearbySmeltCommandsImplementation.java    From malmo with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onBlockDestroy(BlockEvent.BreakEvent event) {
    if (!event.isCanceled() && event.getState().getBlock() instanceof BlockFurnace)
        for (int i = furnaces.size() - 1; i >= 0; i--)
            if (furnaces.get(i).equals(event.getPos()))
                furnaces.remove(i);
}
 
Example #4
Source File: NearbySmeltCommandsImplementation.java    From malmo with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onBlockPlace(BlockEvent.PlaceEvent event) {
    if (!event.isCanceled() && event.getPlacedBlock().getBlock() instanceof BlockFurnace)
        furnaces.add(event.getPos());
}