From 2873c0c797a67f4778e7b6f7b6d0b433c2697e2e Mon Sep 17 00:00:00 2001 From: aidancbrady Date: Sat, 23 Apr 2016 17:09:01 -0400 Subject: [PATCH] Added Fuelwood Heater, currently has no texture. After doing some server timing tests, the last thing we need to make efficient is the Formulaic Assemblicator --- .../java/mekanism/api/MekanismConfig.java | 1 + .../java/mekanism/client/ClientProxy.java | 6 + .../client/gui/GuiFuelwoodHeater.java | 80 +++++ .../render/block/MachineRenderingHandler.java | 9 + .../tileentity/RenderFuelwoodHeater.java | 44 +++ .../java/mekanism/common/CommonProxy.java | 6 + src/main/java/mekanism/common/Mekanism.java | 3 + .../mekanism/common/block/BlockMachine.java | 5 +- .../container/ContainerFuelwoodHeater.java | 123 ++++++++ .../common/item/ItemBlockMachine.java | 1 + .../common/network/PacketConfigSync.java | 2 + .../common/tile/TileEntityFuelwoodHeater.java | 279 ++++++++++++++++++ .../tile/TileEntityResistiveHeater.java | 7 + .../assets/mekanism/gui/GuiFuelwoodHeater.png | Bin 0 -> 5359 bytes .../resources/assets/mekanism/lang/en_US.lang | 2 + 15 files changed, 567 insertions(+), 1 deletion(-) create mode 100644 src/main/java/mekanism/client/gui/GuiFuelwoodHeater.java create mode 100644 src/main/java/mekanism/client/render/tileentity/RenderFuelwoodHeater.java create mode 100644 src/main/java/mekanism/common/inventory/container/ContainerFuelwoodHeater.java create mode 100644 src/main/java/mekanism/common/tile/TileEntityFuelwoodHeater.java create mode 100644 src/main/resources/assets/mekanism/gui/GuiFuelwoodHeater.png 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 0000000000000000000000000000000000000000..f42eff054834236823da34655a542616174262d3 GIT binary patch literal 5359 zcmeHLX*3&J*G|$XQDUsAh?depOSy(pq1VuAi)s)pO6jFkNKtb_s%^BUwpv3C;r6zM zn9>R*L{x~jh7N`_F%>nFB2q;7a^Ll?^?g6TU*Egd_rAZ*v(DOQpM9QZ@3r?j4=y^M zkrY=E2LJ$)_GfJ_0RTWD1Omi%3m4C@QhxvdEE#BRebL_9TH|6^sDEJa9{_-9TAHiZ z4OLfpI3+wlQ>zCN{M)^VQcKB$l9_J571uT<3=bQJWZ4_D4$NHVE%oHQ?=dx`2#TF- zFUFsk%af)bCtaLLc{QJFZkQX`NE-QLDSowpQy90@ z5Wo?cX()HkdMpoAcwTi((O^6rpOI{F^wC{>k>c)Rq_f&lud)juW2Ze)WRFqnc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ks{`^O zAU}guqWN=No4e-lE&UTbx>X0XC`z!N&rC1GJMnFbQc_YDX-FipEL_qfT}wY!^ifX3 zrxJNWw4tLDTxvCNG^fL&PyKfq2LLU8SqWCK6Q)d!ri1L8Mp~T#^UQvJwh$*DFF&*7S)` zh_mQMdmjkct_6I`+&r(T<0JvfpX%N>{RU5aak=u!r?NAhD`M|HdB+Gg$bM39z?yw5j^t=gxltPxPRq literal 0 HcmV?d00001 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.