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

This commit is contained in:
aidancbrady 2016-04-23 17:09:01 -04:00
parent ec69b2675e
commit 2873c0c797
15 changed files with 567 additions and 1 deletions

View file

@ -63,6 +63,7 @@ public class MekanismConfig
public static double energyPerHeat = 1000; public static double energyPerHeat = 1000;
public static double maxEnergyPerSteam = 100; public static double maxEnergyPerSteam = 100;
public static double superheatingHeatTransfer = 10000; public static double superheatingHeatTransfer = 10000;
public static double heatPerFuelTick = 1;
} }
public static class client public static class client

View file

@ -31,6 +31,7 @@ import mekanism.client.gui.GuiFactory;
import mekanism.client.gui.GuiFluidTank; import mekanism.client.gui.GuiFluidTank;
import mekanism.client.gui.GuiFluidicPlenisher; import mekanism.client.gui.GuiFluidicPlenisher;
import mekanism.client.gui.GuiFormulaicAssemblicator; import mekanism.client.gui.GuiFormulaicAssemblicator;
import mekanism.client.gui.GuiFuelwoodHeater;
import mekanism.client.gui.GuiGasTank; import mekanism.client.gui.GuiGasTank;
import mekanism.client.gui.GuiInductionMatrix; import mekanism.client.gui.GuiInductionMatrix;
import mekanism.client.gui.GuiLaserAmplifier; 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.RenderEnergyCube;
import mekanism.client.render.tileentity.RenderFluidTank; import mekanism.client.render.tileentity.RenderFluidTank;
import mekanism.client.render.tileentity.RenderFluidicPlenisher; import mekanism.client.render.tileentity.RenderFluidicPlenisher;
import mekanism.client.render.tileentity.RenderFuelwoodHeater;
import mekanism.client.render.tileentity.RenderGasTank; import mekanism.client.render.tileentity.RenderGasTank;
import mekanism.client.render.tileentity.RenderLaser; import mekanism.client.render.tileentity.RenderLaser;
import mekanism.client.render.tileentity.RenderLaserAmplifier; import mekanism.client.render.tileentity.RenderLaserAmplifier;
@ -153,6 +155,7 @@ import mekanism.common.tile.TileEntityFactory;
import mekanism.common.tile.TileEntityFluidTank; import mekanism.common.tile.TileEntityFluidTank;
import mekanism.common.tile.TileEntityFluidicPlenisher; import mekanism.common.tile.TileEntityFluidicPlenisher;
import mekanism.common.tile.TileEntityFormulaicAssemblicator; import mekanism.common.tile.TileEntityFormulaicAssemblicator;
import mekanism.common.tile.TileEntityFuelwoodHeater;
import mekanism.common.tile.TileEntityGasTank; import mekanism.common.tile.TileEntityGasTank;
import mekanism.common.tile.TileEntityInductionCasing; import mekanism.common.tile.TileEntityInductionCasing;
import mekanism.common.tile.TileEntityInductionCell; import mekanism.common.tile.TileEntityInductionCell;
@ -320,6 +323,7 @@ public class ClientProxy extends CommonProxy
ClientRegistry.registerTileEntity(TileEntityBoilerValve.class, "BoilerValve", new RenderThermoelectricBoiler()); ClientRegistry.registerTileEntity(TileEntityBoilerValve.class, "BoilerValve", new RenderThermoelectricBoiler());
ClientRegistry.registerTileEntity(TileEntitySecurityDesk.class, "SecurityDesk", new RenderSecurityDesk()); ClientRegistry.registerTileEntity(TileEntitySecurityDesk.class, "SecurityDesk", new RenderSecurityDesk());
ClientRegistry.registerTileEntity(TileEntityQuantumEntangloporter.class, "QuantumEntangloporter", new RenderQuantumEntangloporter()); ClientRegistry.registerTileEntity(TileEntityQuantumEntangloporter.class, "QuantumEntangloporter", new RenderQuantumEntangloporter());
ClientRegistry.registerTileEntity(TileEntityFuelwoodHeater.class, "FuelwoodHeater", new RenderFuelwoodHeater());
} }
@Override @Override
@ -507,6 +511,8 @@ public class ClientProxy extends CommonProxy
return new GuiFormulaicAssemblicator(player.inventory, (TileEntityFormulaicAssemblicator)tileEntity); return new GuiFormulaicAssemblicator(player.inventory, (TileEntityFormulaicAssemblicator)tileEntity);
case 57: case 57:
return new GuiSecurityDesk(player.inventory, (TileEntitySecurityDesk)tileEntity); return new GuiSecurityDesk(player.inventory, (TileEntitySecurityDesk)tileEntity);
case 58:
return new GuiFuelwoodHeater(player.inventory, (TileEntityFuelwoodHeater)tileEntity);
} }
return null; return null;

View file

@ -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<String> 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);
}
}

View file

@ -61,6 +61,7 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
public ModelSolarNeutronActivator solarNeutronActivator = new ModelSolarNeutronActivator(); public ModelSolarNeutronActivator solarNeutronActivator = new ModelSolarNeutronActivator();
public ModelResistiveHeater resistiveHeater = new ModelResistiveHeater(); public ModelResistiveHeater resistiveHeater = new ModelResistiveHeater();
public ModelQuantumEntangloporter quantumEntangloporter = new ModelQuantumEntangloporter(); public ModelQuantumEntangloporter quantumEntangloporter = new ModelQuantumEntangloporter();
public ModelResistiveHeater fuelwoodHeater = new ModelResistiveHeater();
@Override @Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) 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")); mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ResistiveHeater.png"));
resistiveHeater.render(0.0625F, false, mc.renderEngine); 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) else if(type == MachineType.SOLAR_NEUTRON_ACTIVATOR)
{ {
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);

View file

@ -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();
}
}

View file

@ -35,6 +35,7 @@ import mekanism.common.inventory.container.ContainerFilter;
import mekanism.common.inventory.container.ContainerFluidTank; import mekanism.common.inventory.container.ContainerFluidTank;
import mekanism.common.inventory.container.ContainerFluidicPlenisher; import mekanism.common.inventory.container.ContainerFluidicPlenisher;
import mekanism.common.inventory.container.ContainerFormulaicAssemblicator; import mekanism.common.inventory.container.ContainerFormulaicAssemblicator;
import mekanism.common.inventory.container.ContainerFuelwoodHeater;
import mekanism.common.inventory.container.ContainerGasTank; import mekanism.common.inventory.container.ContainerGasTank;
import mekanism.common.inventory.container.ContainerInductionMatrix; import mekanism.common.inventory.container.ContainerInductionMatrix;
import mekanism.common.inventory.container.ContainerLaserAmplifier; import mekanism.common.inventory.container.ContainerLaserAmplifier;
@ -90,6 +91,7 @@ import mekanism.common.tile.TileEntityFactory;
import mekanism.common.tile.TileEntityFluidTank; import mekanism.common.tile.TileEntityFluidTank;
import mekanism.common.tile.TileEntityFluidicPlenisher; import mekanism.common.tile.TileEntityFluidicPlenisher;
import mekanism.common.tile.TileEntityFormulaicAssemblicator; import mekanism.common.tile.TileEntityFormulaicAssemblicator;
import mekanism.common.tile.TileEntityFuelwoodHeater;
import mekanism.common.tile.TileEntityGasTank; import mekanism.common.tile.TileEntityGasTank;
import mekanism.common.tile.TileEntityInductionCasing; import mekanism.common.tile.TileEntityInductionCasing;
import mekanism.common.tile.TileEntityInductionCell; import mekanism.common.tile.TileEntityInductionCell;
@ -209,6 +211,7 @@ public class CommonProxy implements IGuiProvider
GameRegistry.registerTileEntity(TileEntityBoilerValve.class, "BoilerValve"); GameRegistry.registerTileEntity(TileEntityBoilerValve.class, "BoilerValve");
GameRegistry.registerTileEntity(TileEntitySecurityDesk.class, "SecurityDesk"); GameRegistry.registerTileEntity(TileEntitySecurityDesk.class, "SecurityDesk");
GameRegistry.registerTileEntity(TileEntityQuantumEntangloporter.class, "QuantumEntangloporter"); GameRegistry.registerTileEntity(TileEntityQuantumEntangloporter.class, "QuantumEntangloporter");
GameRegistry.registerTileEntity(TileEntityFuelwoodHeater.class, "FuelwoodHeater");
} }
public void handleTeleporterUpdate(PortableTeleporterMessage message) {} 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.energyPerHeat = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnergyPerHeat", 1000D).getDouble();
general.maxEnergyPerSteam = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "MaxEnergyPerSteam", 100D).getDouble(); general.maxEnergyPerSteam = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "MaxEnergyPerSteam", 100D).getDouble();
general.superheatingHeatTransfer = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "SuperheatingHeatTransfer", 10000D).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.blacklistIC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistIC2Power", false).getBoolean();
general.blacklistRF = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistRFPower", 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); return new ContainerFormulaicAssemblicator(player.inventory, (TileEntityFormulaicAssemblicator)tileEntity);
case 57: case 57:
return new ContainerSecurityDesk(player.inventory, (TileEntitySecurityDesk)tileEntity); return new ContainerSecurityDesk(player.inventory, (TileEntitySecurityDesk)tileEntity);
case 58:
return new ContainerFuelwoodHeater(player.inventory, (TileEntityFuelwoodHeater)tileEntity);
} }
return null; return null;

View file

@ -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), "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 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 //Energy Cube recipes
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getEnergyCube(EnergyCubeTier.BASIC), new Object[] { CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getEnergyCube(EnergyCubeTier.BASIC), new Object[] {

View file

@ -65,6 +65,7 @@ import mekanism.common.tile.TileEntityFactory;
import mekanism.common.tile.TileEntityFluidTank; import mekanism.common.tile.TileEntityFluidTank;
import mekanism.common.tile.TileEntityFluidicPlenisher; import mekanism.common.tile.TileEntityFluidicPlenisher;
import mekanism.common.tile.TileEntityFormulaicAssemblicator; import mekanism.common.tile.TileEntityFormulaicAssemblicator;
import mekanism.common.tile.TileEntityFuelwoodHeater;
import mekanism.common.tile.TileEntityLaser; import mekanism.common.tile.TileEntityLaser;
import mekanism.common.tile.TileEntityLaserAmplifier; import mekanism.common.tile.TileEntityLaserAmplifier;
import mekanism.common.tile.TileEntityLaserTractorBeam; import mekanism.common.tile.TileEntityLaserTractorBeam;
@ -155,6 +156,7 @@ import cpw.mods.fml.relauncher.SideOnly;
* 2:3: Oredictionificator * 2:3: Oredictionificator
* 2:4: Resistive Heater * 2:4: Resistive Heater
* 2:5: Formulaic Assemblicator * 2:5: Formulaic Assemblicator
* 2:6: Fuelwood Heater
* *
* @author AidanBrady * @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), 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), 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), 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 MachineBlock typeBlock;
public int meta; public int meta;

View file

@ -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;
}
}

View file

@ -103,6 +103,7 @@ import cpw.mods.fml.relauncher.SideOnly;
* 2:3: Oredictionificator * 2:3: Oredictionificator
* 2:4: Resistive Heater * 2:4: Resistive Heater
* 2:5: Formulaic Assemblicator * 2:5: Formulaic Assemblicator
* 2:6: Fuelwood Heater
* @author AidanBrady * @author AidanBrady
* *
*/ */

View file

@ -70,6 +70,7 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
dataStream.writeDouble(general.energyPerHeat); dataStream.writeDouble(general.energyPerHeat);
dataStream.writeDouble(general.maxEnergyPerSteam); dataStream.writeDouble(general.maxEnergyPerSteam);
dataStream.writeDouble(general.superheatingHeatTransfer); dataStream.writeDouble(general.superheatingHeatTransfer);
dataStream.writeDouble(general.heatPerFuelTick);
for(MachineType type : MachineType.getValidMachines()) for(MachineType type : MachineType.getValidMachines())
{ {
@ -156,6 +157,7 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
general.energyPerHeat = dataStream.readDouble(); general.energyPerHeat = dataStream.readDouble();
general.maxEnergyPerSteam = dataStream.readDouble(); general.maxEnergyPerSteam = dataStream.readDouble();
general.superheatingHeatTransfer = dataStream.readDouble(); general.superheatingHeatTransfer = dataStream.readDouble();
general.heatPerFuelTick = dataStream.readDouble();
for(MachineType type : MachineType.getValidMachines()) for(MachineType type : MachineType.getValidMachines())
{ {

View file

@ -0,0 +1,279 @@
package mekanism.common.tile;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import mekanism.api.Coord4D;
import mekanism.api.IHeatTransfer;
import mekanism.api.MekanismConfig.general;
import mekanism.api.Range4D;
import mekanism.common.Mekanism;
import mekanism.common.base.IActiveState;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.security.ISecurityTile;
import mekanism.common.tile.component.TileComponentSecurity;
import mekanism.common.util.HeatUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityFuelwoodHeater extends TileEntityContainerBlock implements IHeatTransfer, ISecurityTile, IActiveState
{
public double temperature;
public double heatToAbsorb = 0;
public int burnTime;
public int maxBurnTime;
/** Whether or not this machine is in it's active state. */
public boolean isActive;
/** The client's current active state. */
public boolean clientActive;
/** How many ticks must pass until this block's active state can sync with the client. */
public int updateDelay;
public double lastTransferLoss;
public double lastEnvironmentLoss;
public TileComponentSecurity securityComponent = new TileComponentSecurity(this);
public TileEntityFuelwoodHeater()
{
super("FuelwoodHeater");
inventory = new ItemStack[1];
}
@Override
public void onUpdate()
{
if(worldObj.isRemote && updateDelay > 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;
}
}

View file

@ -3,6 +3,7 @@ package mekanism.common.tile;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet;
import mekanism.api.Coord4D; import mekanism.api.Coord4D;
import mekanism.api.IHeatTransfer; import mekanism.api.IHeatTransfer;
@ -119,6 +120,12 @@ public class TileEntityResistiveHeater extends TileEntityNoisyElectricBlock impl
} }
} }
@Override
public EnumSet<ForgeDirection> getConsumingSides()
{
return EnumSet.of(MekanismUtils.getLeft(facing), MekanismUtils.getRight(facing));
}
@Override @Override
public boolean canSetFacing(int side) public boolean canSetFacing(int side)
{ {

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View file

@ -157,6 +157,7 @@ tile.MachineBlock3.SolarNeutronActivator.name=Solar Neutron Activator
tile.MachineBlock3.Oredictionificator.name=Oredictionificator tile.MachineBlock3.Oredictionificator.name=Oredictionificator
tile.MachineBlock3.ResistiveHeater.name=Resistive Heater tile.MachineBlock3.ResistiveHeater.name=Resistive Heater
tile.MachineBlock3.FormulaicAssemblicator.name=Formulaic Assemblicator tile.MachineBlock3.FormulaicAssemblicator.name=Formulaic Assemblicator
tile.MachineBlock3.FuelwoodHeater.name=Fuelwood Heater
//Plastic //Plastic
tile.PlasticBlock.name=Plastic Block 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.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.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.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.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. tooltip.SolarGenerator=A generator that uses the power of the sun to produce energy.