diff --git a/src/main/java/mekanism/api/MekanismConfig.java b/src/main/java/mekanism/api/MekanismConfig.java index b3125f1d2..3b0522bc7 100644 --- a/src/main/java/mekanism/api/MekanismConfig.java +++ b/src/main/java/mekanism/api/MekanismConfig.java @@ -63,6 +63,7 @@ public class MekanismConfig public static double energyPerHeat = 1000; public static double maxEnergyPerSteam = 100; public static double superheatingHeatTransfer = 10000; + public static double heatPerFuelTick = 1; } public static class client diff --git a/src/main/java/mekanism/client/ClientProxy.java b/src/main/java/mekanism/client/ClientProxy.java index a8ae79c71..414dd2a69 100644 --- a/src/main/java/mekanism/client/ClientProxy.java +++ b/src/main/java/mekanism/client/ClientProxy.java @@ -31,6 +31,7 @@ import mekanism.client.gui.GuiFactory; import mekanism.client.gui.GuiFluidTank; import mekanism.client.gui.GuiFluidicPlenisher; import mekanism.client.gui.GuiFormulaicAssemblicator; +import mekanism.client.gui.GuiFuelwoodHeater; import mekanism.client.gui.GuiGasTank; import mekanism.client.gui.GuiInductionMatrix; import mekanism.client.gui.GuiLaserAmplifier; @@ -89,6 +90,7 @@ import mekanism.client.render.tileentity.RenderElectrolyticSeparator; import mekanism.client.render.tileentity.RenderEnergyCube; import mekanism.client.render.tileentity.RenderFluidTank; import mekanism.client.render.tileentity.RenderFluidicPlenisher; +import mekanism.client.render.tileentity.RenderFuelwoodHeater; import mekanism.client.render.tileentity.RenderGasTank; import mekanism.client.render.tileentity.RenderLaser; import mekanism.client.render.tileentity.RenderLaserAmplifier; @@ -153,6 +155,7 @@ import mekanism.common.tile.TileEntityFactory; import mekanism.common.tile.TileEntityFluidTank; import mekanism.common.tile.TileEntityFluidicPlenisher; import mekanism.common.tile.TileEntityFormulaicAssemblicator; +import mekanism.common.tile.TileEntityFuelwoodHeater; import mekanism.common.tile.TileEntityGasTank; import mekanism.common.tile.TileEntityInductionCasing; import mekanism.common.tile.TileEntityInductionCell; @@ -320,6 +323,7 @@ public class ClientProxy extends CommonProxy ClientRegistry.registerTileEntity(TileEntityBoilerValve.class, "BoilerValve", new RenderThermoelectricBoiler()); ClientRegistry.registerTileEntity(TileEntitySecurityDesk.class, "SecurityDesk", new RenderSecurityDesk()); ClientRegistry.registerTileEntity(TileEntityQuantumEntangloporter.class, "QuantumEntangloporter", new RenderQuantumEntangloporter()); + ClientRegistry.registerTileEntity(TileEntityFuelwoodHeater.class, "FuelwoodHeater", new RenderFuelwoodHeater()); } @Override @@ -507,6 +511,8 @@ public class ClientProxy extends CommonProxy return new GuiFormulaicAssemblicator(player.inventory, (TileEntityFormulaicAssemblicator)tileEntity); case 57: return new GuiSecurityDesk(player.inventory, (TileEntitySecurityDesk)tileEntity); + case 58: + return new GuiFuelwoodHeater(player.inventory, (TileEntityFuelwoodHeater)tileEntity); } return null; diff --git a/src/main/java/mekanism/client/gui/GuiFuelwoodHeater.java b/src/main/java/mekanism/client/gui/GuiFuelwoodHeater.java new file mode 100644 index 000000000..640d5b73e --- /dev/null +++ b/src/main/java/mekanism/client/gui/GuiFuelwoodHeater.java @@ -0,0 +1,80 @@ +package mekanism.client.gui; + +import java.util.List; + +import mekanism.api.util.ListUtils; +import mekanism.api.util.UnitDisplayUtils; +import mekanism.api.util.UnitDisplayUtils.TemperatureUnit; +import mekanism.client.gui.element.GuiElement.IInfoHandler; +import mekanism.client.gui.element.GuiHeatInfo; +import mekanism.client.gui.element.GuiSecurityTab; +import mekanism.client.gui.element.GuiSlot; +import mekanism.client.gui.element.GuiSlot.SlotType; +import mekanism.common.inventory.container.ContainerFuelwoodHeater; +import mekanism.common.tile.TileEntityFuelwoodHeater; +import mekanism.common.util.LangUtils; +import mekanism.common.util.MekanismUtils; +import mekanism.common.util.MekanismUtils.ResourceType; +import net.minecraft.entity.player.InventoryPlayer; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class GuiFuelwoodHeater extends GuiMekanism +{ + public TileEntityFuelwoodHeater tileEntity; + + public GuiFuelwoodHeater(InventoryPlayer inventory, TileEntityFuelwoodHeater tentity) + { + super(tentity, new ContainerFuelwoodHeater(inventory, tentity)); + tileEntity = tentity; + + guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiFuelwoodHeater.png"), 14, 28)); + guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiFuelwoodHeater.png"))); + guiElements.add(new GuiHeatInfo(new IInfoHandler() { + @Override + public List getInfo() + { + String transfer = UnitDisplayUtils.getDisplayShort(tileEntity.lastTransferLoss, TemperatureUnit.KELVIN); + String environment = UnitDisplayUtils.getDisplayShort(tileEntity.lastEnvironmentLoss, TemperatureUnit.KELVIN); + return ListUtils.asList(LangUtils.localize("gui.transferred") + ": " + transfer + "/t", LangUtils.localize("gui.dissipated") + ": " + environment + "/t"); + } + }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiFuelwoodHeater.png"))); + } + + @Override + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + fontRendererObj.drawString(tileEntity.getInventoryName(), (xSize / 2) - (fontRendererObj.getStringWidth(tileEntity.getInventoryName()) / 2), 6, 0x404040); + fontRendererObj.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 94) + 2, 0x404040); + + renderScaledText(LangUtils.localize("gui.temp") + ": " + MekanismUtils.getTemperatureDisplay(tileEntity.temperature, TemperatureUnit.AMBIENT), 50, 25, 0x00CD00, 76); + renderScaledText(LangUtils.localize("gui.fuel") + ": " + tileEntity.burnTime, 50, 41, 0x00CD00, 76); + + super.drawGuiContainerForegroundLayer(mouseX, mouseY); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY) + { + mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiFuelwoodHeater.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + int guiWidth = (width - xSize) / 2; + int guiHeight = (height - ySize) / 2; + drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize); + + int xAxis = (mouseX - (width - xSize) / 2); + int yAxis = (mouseY - (height - ySize) / 2); + + if(tileEntity.burnTime > 0) + { + int displayInt = tileEntity.burnTime*13 / tileEntity.maxBurnTime; + drawTexturedModalRect(guiWidth + 143, guiHeight + 30 + 12 - displayInt, 176, 12 - displayInt, 14, displayInt + 1); + } + + super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); + } +} diff --git a/src/main/java/mekanism/client/render/block/MachineRenderingHandler.java b/src/main/java/mekanism/client/render/block/MachineRenderingHandler.java index a0baa5454..fdac9a6e3 100644 --- a/src/main/java/mekanism/client/render/block/MachineRenderingHandler.java +++ b/src/main/java/mekanism/client/render/block/MachineRenderingHandler.java @@ -61,6 +61,7 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler public ModelSolarNeutronActivator solarNeutronActivator = new ModelSolarNeutronActivator(); public ModelResistiveHeater resistiveHeater = new ModelResistiveHeater(); public ModelQuantumEntangloporter quantumEntangloporter = new ModelQuantumEntangloporter(); + public ModelResistiveHeater fuelwoodHeater = new ModelResistiveHeater(); @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) @@ -226,6 +227,14 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ResistiveHeater.png")); resistiveHeater.render(0.0625F, false, mc.renderEngine); } + else if(type == MachineType.FUELWOOD_HEATER) + { + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F); + GL11.glTranslatef(0.05F, -0.96F, 0.05F); + mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "FuelwoodHeater.png")); + fuelwoodHeater.render(0.0625F, false, mc.renderEngine); + } else if(type == MachineType.SOLAR_NEUTRON_ACTIVATOR) { GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); diff --git a/src/main/java/mekanism/client/render/tileentity/RenderFuelwoodHeater.java b/src/main/java/mekanism/client/render/tileentity/RenderFuelwoodHeater.java new file mode 100644 index 000000000..a4727be12 --- /dev/null +++ b/src/main/java/mekanism/client/render/tileentity/RenderFuelwoodHeater.java @@ -0,0 +1,44 @@ +package mekanism.client.render.tileentity; + +import mekanism.client.model.ModelResistiveHeater; +import mekanism.common.tile.TileEntityFuelwoodHeater; +import mekanism.common.util.MekanismUtils; +import mekanism.common.util.MekanismUtils.ResourceType; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class RenderFuelwoodHeater extends TileEntitySpecialRenderer +{ + private ModelResistiveHeater model = new ModelResistiveHeater(); + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) + { + renderAModelAt((TileEntityFuelwoodHeater)tileEntity, x, y, z, partialTick); + } + + private void renderAModelAt(TileEntityFuelwoodHeater tileEntity, double x, double y, double z, float partialTick) + { + GL11.glPushMatrix(); + GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F); + bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "FuelwoodHeater.png")); + + switch(tileEntity.facing) + { + case 2: GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); break; + case 3: GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); break; + case 4: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break; + case 5: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break; + } + + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + model.render(0.0625F, tileEntity.isActive, field_147501_a.field_147553_e); + GL11.glPopMatrix(); + } +} diff --git a/src/main/java/mekanism/common/CommonProxy.java b/src/main/java/mekanism/common/CommonProxy.java index ed46e1993..1b238ac20 100644 --- a/src/main/java/mekanism/common/CommonProxy.java +++ b/src/main/java/mekanism/common/CommonProxy.java @@ -35,6 +35,7 @@ import mekanism.common.inventory.container.ContainerFilter; import mekanism.common.inventory.container.ContainerFluidTank; import mekanism.common.inventory.container.ContainerFluidicPlenisher; import mekanism.common.inventory.container.ContainerFormulaicAssemblicator; +import mekanism.common.inventory.container.ContainerFuelwoodHeater; import mekanism.common.inventory.container.ContainerGasTank; import mekanism.common.inventory.container.ContainerInductionMatrix; import mekanism.common.inventory.container.ContainerLaserAmplifier; @@ -90,6 +91,7 @@ import mekanism.common.tile.TileEntityFactory; import mekanism.common.tile.TileEntityFluidTank; import mekanism.common.tile.TileEntityFluidicPlenisher; import mekanism.common.tile.TileEntityFormulaicAssemblicator; +import mekanism.common.tile.TileEntityFuelwoodHeater; import mekanism.common.tile.TileEntityGasTank; import mekanism.common.tile.TileEntityInductionCasing; import mekanism.common.tile.TileEntityInductionCell; @@ -209,6 +211,7 @@ public class CommonProxy implements IGuiProvider GameRegistry.registerTileEntity(TileEntityBoilerValve.class, "BoilerValve"); GameRegistry.registerTileEntity(TileEntitySecurityDesk.class, "SecurityDesk"); GameRegistry.registerTileEntity(TileEntityQuantumEntangloporter.class, "QuantumEntangloporter"); + GameRegistry.registerTileEntity(TileEntityFuelwoodHeater.class, "FuelwoodHeater"); } public void handleTeleporterUpdate(PortableTeleporterMessage message) {} @@ -292,6 +295,7 @@ public class CommonProxy implements IGuiProvider general.energyPerHeat = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnergyPerHeat", 1000D).getDouble(); general.maxEnergyPerSteam = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "MaxEnergyPerSteam", 100D).getDouble(); general.superheatingHeatTransfer = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "SuperheatingHeatTransfer", 10000D).getDouble(); + general.heatPerFuelTick = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "HeatPerFuelTick", 1D).getDouble(); general.blacklistIC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistIC2Power", false).getBoolean(); general.blacklistRF = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistRFPower", false).getBoolean(); @@ -560,6 +564,8 @@ public class CommonProxy implements IGuiProvider return new ContainerFormulaicAssemblicator(player.inventory, (TileEntityFormulaicAssemblicator)tileEntity); case 57: return new ContainerSecurityDesk(player.inventory, (TileEntitySecurityDesk)tileEntity); + case 58: + return new ContainerFuelwoodHeater(player.inventory, (TileEntityFuelwoodHeater)tileEntity); } return null; diff --git a/src/main/java/mekanism/common/Mekanism.java b/src/main/java/mekanism/common/Mekanism.java index 4a84ad285..388cd5703 100644 --- a/src/main/java/mekanism/common/Mekanism.java +++ b/src/main/java/mekanism/common/Mekanism.java @@ -528,6 +528,9 @@ public class Mekanism "SGS", "CIC", "STS", Character.valueOf('S'), "ingotSteel", Character.valueOf('G'), "blockGlass", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ELITE), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('T'), MekanismItems.TeleportationCore })); + MachineType.FUELWOOD_HEATER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock3, 1, 6), new Object[] { + "SCS", "FHF", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('F'), Blocks.furnace, Character.valueOf('H'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) + })); //Energy Cube recipes CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getEnergyCube(EnergyCubeTier.BASIC), new Object[] { diff --git a/src/main/java/mekanism/common/block/BlockMachine.java b/src/main/java/mekanism/common/block/BlockMachine.java index 09efe6fb7..71572bc90 100644 --- a/src/main/java/mekanism/common/block/BlockMachine.java +++ b/src/main/java/mekanism/common/block/BlockMachine.java @@ -65,6 +65,7 @@ import mekanism.common.tile.TileEntityFactory; import mekanism.common.tile.TileEntityFluidTank; import mekanism.common.tile.TileEntityFluidicPlenisher; import mekanism.common.tile.TileEntityFormulaicAssemblicator; +import mekanism.common.tile.TileEntityFuelwoodHeater; import mekanism.common.tile.TileEntityLaser; import mekanism.common.tile.TileEntityLaserAmplifier; import mekanism.common.tile.TileEntityLaserTractorBeam; @@ -155,6 +156,7 @@ import cpw.mods.fml.relauncher.SideOnly; * 2:3: Oredictionificator * 2:4: Resistive Heater * 2:5: Formulaic Assemblicator + * 2:6: Fuelwood Heater * * @author AidanBrady * @@ -1187,7 +1189,8 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo AMBIENT_ACCUMULATOR(MachineBlock.MACHINE_BLOCK_3, 2, "AmbientAccumulator", 48, TileEntityAmbientAccumulator.class, true, false, false), OREDICTIONIFICATOR(MachineBlock.MACHINE_BLOCK_3, 3, "Oredictionificator", 52, TileEntityOredictionificator.class, false, false, false), RESISTIVE_HEATER(MachineBlock.MACHINE_BLOCK_3, 4, "ResistiveHeater", 53, TileEntityResistiveHeater.class, true, true, false), - FORMULAIC_ASSEMBLICATOR(MachineBlock.MACHINE_BLOCK_3, 5, "FormulaicAssemblicator", 56, TileEntityFormulaicAssemblicator.class, true, false, true); + FORMULAIC_ASSEMBLICATOR(MachineBlock.MACHINE_BLOCK_3, 5, "FormulaicAssemblicator", 56, TileEntityFormulaicAssemblicator.class, true, false, true), + FUELWOOD_HEATER(MachineBlock.MACHINE_BLOCK_3, 6, "FuelwoodHeater", 58, TileEntityFuelwoodHeater.class, false, true, false); public MachineBlock typeBlock; public int meta; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerFuelwoodHeater.java b/src/main/java/mekanism/common/inventory/container/ContainerFuelwoodHeater.java new file mode 100644 index 000000000..d22546b70 --- /dev/null +++ b/src/main/java/mekanism/common/inventory/container/ContainerFuelwoodHeater.java @@ -0,0 +1,123 @@ +package mekanism.common.inventory.container; + +import mekanism.common.tile.TileEntityFuelwoodHeater; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntityFurnace; + +public class ContainerFuelwoodHeater extends Container +{ + private TileEntityFuelwoodHeater tileEntity; + + public ContainerFuelwoodHeater(InventoryPlayer inventory, TileEntityFuelwoodHeater tentity) + { + tileEntity = tentity; + addSlotToContainer(new Slot(tentity, 0, 15, 29)); + + int slotY; + + for(slotY = 0; slotY < 3; slotY++) + { + for(int slotX = 0; slotX < 9; slotX++) + { + addSlotToContainer(new Slot(inventory, slotX + slotY * 9 + 9, 8 + slotX * 18, 84 + slotY * 18)); + } + } + + for(slotY = 0; slotY < 9; slotY++) + { + addSlotToContainer(new Slot(inventory, slotY, 8 + slotY * 18, 142)); + } + + tileEntity.open(inventory.player); + tileEntity.openInventory(); + } + + @Override + public void onContainerClosed(EntityPlayer entityplayer) + { + super.onContainerClosed(entityplayer); + + tileEntity.close(entityplayer); + tileEntity.closeInventory(); + } + + @Override + public boolean canInteractWith(EntityPlayer entityplayer) + { + return tileEntity.isUseableByPlayer(entityplayer); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotID) + { + ItemStack stack = null; + Slot currentSlot = (Slot)inventorySlots.get(slotID); + + if(currentSlot != null && currentSlot.getHasStack()) + { + ItemStack slotStack = currentSlot.getStack(); + stack = slotStack.copy(); + + if(TileEntityFurnace.getItemBurnTime(slotStack) > 0) + { + if(slotID != 0) + { + if(!mergeItemStack(slotStack, 0, 1, false)) + { + return null; + } + } + else if(slotID == 0) + { + if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) + { + return null; + } + } + } + else { + if(slotID >= 1 && slotID <= 27) + { + if(!mergeItemStack(slotStack, 28, inventorySlots.size(), false)) + { + return null; + } + } + else if(slotID > 27) + { + if(!mergeItemStack(slotStack, 1, 27, false)) + { + return null; + } + } + else { + if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) + { + return null; + } + } + } + + if(slotStack.stackSize == 0) + { + currentSlot.putStack((ItemStack)null); + } + else { + currentSlot.onSlotChanged(); + } + + if(slotStack.stackSize == stack.stackSize) + { + return null; + } + + currentSlot.onPickupFromSlot(player, slotStack); + } + + return stack; + } +} diff --git a/src/main/java/mekanism/common/item/ItemBlockMachine.java b/src/main/java/mekanism/common/item/ItemBlockMachine.java index 5354c8cf8..0d48336ce 100644 --- a/src/main/java/mekanism/common/item/ItemBlockMachine.java +++ b/src/main/java/mekanism/common/item/ItemBlockMachine.java @@ -103,6 +103,7 @@ import cpw.mods.fml.relauncher.SideOnly; * 2:3: Oredictionificator * 2:4: Resistive Heater * 2:5: Formulaic Assemblicator + * 2:6: Fuelwood Heater * @author AidanBrady * */ diff --git a/src/main/java/mekanism/common/network/PacketConfigSync.java b/src/main/java/mekanism/common/network/PacketConfigSync.java index a6cbed45d..2f7a2e638 100644 --- a/src/main/java/mekanism/common/network/PacketConfigSync.java +++ b/src/main/java/mekanism/common/network/PacketConfigSync.java @@ -70,6 +70,7 @@ public class PacketConfigSync implements IMessageHandler 0) + { + updateDelay--; + + if(updateDelay == 0 && clientActive != isActive) + { + isActive = clientActive; + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } + } + + if(!worldObj.isRemote) + { + if(updateDelay > 0) + { + updateDelay--; + + if(updateDelay == 0 && clientActive != isActive) + { + Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); + } + } + + boolean burning = false; + + if(burnTime > 0) + { + burnTime--; + burning = true; + } + else { + if(inventory[0] != null) + { + maxBurnTime = burnTime = TileEntityFurnace.getItemBurnTime(inventory[0])/2; + + if(burnTime > 0) + { + inventory[0].stackSize--; + + if(inventory[0].stackSize == 0) + { + inventory[0] = inventory[0].getItem().getContainerItem(inventory[0]); + } + + burning = true; + } + } + } + + if(burning) + { + heatToAbsorb += general.heatPerFuelTick; + } + + double[] loss = simulateHeat(); + applyTemperatureChange(); + + lastTransferLoss = loss[0]; + lastEnvironmentLoss = loss[1]; + + setActive(burning); + } + } + + @Override + public void readFromNBT(NBTTagCompound nbtTags) + { + super.readFromNBT(nbtTags); + + temperature = nbtTags.getDouble("temperature"); + clientActive = isActive = nbtTags.getBoolean("isActive"); + burnTime = nbtTags.getInteger("burnTime"); + maxBurnTime = nbtTags.getInteger("maxBurnTime"); + } + + @Override + public void writeToNBT(NBTTagCompound nbtTags) + { + super.writeToNBT(nbtTags); + + nbtTags.setDouble("temperature", temperature); + nbtTags.setBoolean("isActive", isActive); + nbtTags.setInteger("burnTime", burnTime); + nbtTags.setInteger("maxBurnTime", maxBurnTime); + } + + @Override + public void handlePacketData(ByteBuf dataStream) + { + super.handlePacketData(dataStream); + + temperature = dataStream.readDouble(); + clientActive = dataStream.readBoolean(); + burnTime = dataStream.readInt(); + maxBurnTime = dataStream.readInt(); + + lastTransferLoss = dataStream.readDouble(); + lastEnvironmentLoss = dataStream.readDouble(); + + if(updateDelay == 0 && clientActive != isActive) + { + updateDelay = general.UPDATE_DELAY; + isActive = clientActive; + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } + } + + @Override + public ArrayList getNetworkedData(ArrayList data) + { + super.getNetworkedData(data); + + data.add(temperature); + data.add(isActive); + data.add(burnTime); + data.add(maxBurnTime); + + data.add(lastTransferLoss); + data.add(lastEnvironmentLoss); + + return data; + } + + @Override + public boolean canSetFacing(int side) + { + return side != 0 && side != 1; + } + + @Override + public void setActive(boolean active) + { + isActive = active; + + if(clientActive != active && updateDelay == 0) + { + Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); + + updateDelay = 10; + clientActive = active; + } + } + + @Override + public boolean getActive() + { + return isActive; + } + + @Override + public boolean renderUpdate() + { + return false; + } + + @Override + public boolean lightUpdate() + { + return true; + } + + @Override + public double getTemp() + { + return temperature; + } + + @Override + public double getInverseConductionCoefficient() + { + return 1; + } + + @Override + public double getInsulationCoefficient(ForgeDirection side) + { + return 1000; + } + + @Override + public void transferHeatTo(double heat) + { + heatToAbsorb += heat; + } + + @Override + public double[] simulateHeat() + { + return HeatUtils.simulate(this); + } + + @Override + public double applyTemperatureChange() + { + temperature += heatToAbsorb; + heatToAbsorb = 0; + + return temperature; + } + + @Override + public boolean canConnectHeat(ForgeDirection side) + { + return true; + } + + @Override + public IHeatTransfer getAdjacent(ForgeDirection side) + { + TileEntity adj = Coord4D.get(this).getFromSide(side).getTileEntity(worldObj); + + if(adj instanceof IHeatTransfer) + { + return (IHeatTransfer)adj; + } + + return null; + } + + @Override + public TileComponentSecurity getSecurity() + { + return securityComponent; + } +} diff --git a/src/main/java/mekanism/common/tile/TileEntityResistiveHeater.java b/src/main/java/mekanism/common/tile/TileEntityResistiveHeater.java index cab51c08f..40f2c845a 100644 --- a/src/main/java/mekanism/common/tile/TileEntityResistiveHeater.java +++ b/src/main/java/mekanism/common/tile/TileEntityResistiveHeater.java @@ -3,6 +3,7 @@ package mekanism.common.tile; import io.netty.buffer.ByteBuf; import java.util.ArrayList; +import java.util.EnumSet; import mekanism.api.Coord4D; import mekanism.api.IHeatTransfer; @@ -119,6 +120,12 @@ public class TileEntityResistiveHeater extends TileEntityNoisyElectricBlock impl } } + @Override + public EnumSet getConsumingSides() + { + return EnumSet.of(MekanismUtils.getLeft(facing), MekanismUtils.getRight(facing)); + } + @Override public boolean canSetFacing(int side) { diff --git a/src/main/resources/assets/mekanism/gui/GuiFuelwoodHeater.png b/src/main/resources/assets/mekanism/gui/GuiFuelwoodHeater.png new file mode 100644 index 000000000..f42eff054 Binary files /dev/null and b/src/main/resources/assets/mekanism/gui/GuiFuelwoodHeater.png differ diff --git a/src/main/resources/assets/mekanism/lang/en_US.lang b/src/main/resources/assets/mekanism/lang/en_US.lang index 48afbaf4a..0f0bfd485 100644 --- a/src/main/resources/assets/mekanism/lang/en_US.lang +++ b/src/main/resources/assets/mekanism/lang/en_US.lang @@ -157,6 +157,7 @@ tile.MachineBlock3.SolarNeutronActivator.name=Solar Neutron Activator tile.MachineBlock3.Oredictionificator.name=Oredictionificator tile.MachineBlock3.ResistiveHeater.name=Resistive Heater tile.MachineBlock3.FormulaicAssemblicator.name=Formulaic Assemblicator +tile.MachineBlock3.FuelwoodHeater.name=Fuelwood Heater //Plastic tile.PlasticBlock.name=Plastic Block @@ -828,6 +829,7 @@ tooltip.Oredictionificator=A machine used to unify and translate between various tooltip.Factory=A machine that serves as an upgrade to regular machinery, allowing for multiple processing operations to occur at once. tooltip.ResistiveHeater=A condensed, coiled resistor capable of converting electrical energy directly into heat energy. tooltip.FormulaicAssemblicator=A machine that uses energy to rapidly craft items and blocks from Crafting Formulas. Doubles as an advanced crafting bench. +tooltip.FuelwoodHeater=A machine that is capable of producing large quantities of heat energy by burning combustible items. tooltip.HeatGenerator=A generator that uses the heat of lava or other burnable resources to produce energy. tooltip.SolarGenerator=A generator that uses the power of the sun to produce energy.