Added Electric Pump energy usage config value, also fixed a few bugs with the new Gas-Burning Generator

This commit is contained in:
Aidan C. Brady 2014-06-10 12:24:44 +02:00
parent d7fdc3a243
commit 8685664d51
23 changed files with 110 additions and 87 deletions

View file

@ -28,10 +28,12 @@ public class FuelHandler
if(gas.hasFluid())
{
Fuel bcFuel = IronEngineFuel.getFuelForFluid(gas.getFluid());
if(bcFuel != null)
{
FuelGas fuel = new FuelGas(bcFuel);
fuels.put(gas.getName(), fuel);
return fuel;
}
}

View file

@ -64,7 +64,7 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
int yAxis = (mouseY - (height - ySize) / 2);
fontRendererObj.drawString(tileEntity.getInventoryName(), (xSize/2)-(fontRendererObj.getStringWidth(tileEntity.getInventoryName())/2), 6, 0x404040);
fontRendererObj.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
if(xAxis >= 61 && xAxis <= 67 && yAxis >= 37 && yAxis <= 49)
{

View file

@ -57,7 +57,7 @@ public class GuiElectricMachine extends GuiMekanism
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
fontRendererObj.drawString(tileEntity.getInventoryName(), 45, 6, 0x404040);
fontRendererObj.drawString(tileEntity.getInventoryName(), (xSize/2)-(fontRendererObj.getStringWidth(tileEntity.getInventoryName())/2), 6, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
super.drawGuiContainerForegroundLayer(mouseX, mouseY);

View file

@ -31,7 +31,7 @@ public class GuiGasGauge extends GuiGauge
@Override
public String getTooltipText()
{
return (infoHandler.getTank().getGas() != null) ? infoHandler.getTank().getGas().getGas().getLocalizedName() + ": " + infoHandler.getTank().getStored() + "mB" : MekanismUtils.localize("gui.empty");
return (infoHandler.getTank().getGas() != null) ? infoHandler.getTank().getGas().getGas().getLocalizedName() + ": " + infoHandler.getTank().getStored() : MekanismUtils.localize("gui.empty");
}
public static interface IGasInfoHandler

View file

@ -37,7 +37,7 @@ public class GuiGasTank extends GuiMekanism
String capacityInfo = tileEntity.gasTank.getStored() + "/" + tileEntity.MAX_GAS;
fontRendererObj.drawString(tileEntity.getInventoryName(), 43, 6, 0x404040);
fontRendererObj.drawString(tileEntity.getInventoryName(), (xSize/2)-(fontRendererObj.getStringWidth(tileEntity.getInventoryName())/2), 6, 0x404040);
fontRendererObj.drawString(capacityInfo, 45, 40, 0x404040);
fontRendererObj.drawString("Gas: " + (tileEntity.gasTank.getGas() != null ? tileEntity.gasTank.getGas().getGas().getLocalizedName() : "None"), 45, 49, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, ySize - 96 + 2, 0x404040);

View file

@ -58,19 +58,13 @@ public class GuiSlot extends GuiElement
}
@Override
public void renderForeground(int xAxis, int yAxis)
{
}
public void renderForeground(int xAxis, int yAxis) {}
@Override
public void preMouseClicked(int xAxis, int yAxis, int button)
{
}
public void preMouseClicked(int xAxis, int yAxis, int button) {}
@Override
public void mouseClicked(int xAxis, int yAxis, int button)
{
}
public void mouseClicked(int xAxis, int yAxis, int button) {}
public enum SlotType
{

View file

@ -223,6 +223,7 @@ public class CommonProxy
Mekanism.purificationChamberUsage = Mekanism.configuration.get("usage", "PurificationChamberUsage", 200D).getDouble(200D);
Mekanism.energizedSmelterUsage = Mekanism.configuration.get("usage", "EnergizedSmelterUsage", 50D).getDouble(50D);
Mekanism.digitalMinerUsage = Mekanism.configuration.get("usage", "DigitalMinerUsage", 100D).getDouble(100D);
Mekanism.electricPumpUsage = Mekanism.configuration.get("usage", "ElectricPumpUsage", 100D).getDouble(100D);
Mekanism.rotaryCondensentratorUsage = Mekanism.configuration.get("usage", "RotaryCondensentratorUsage", 50D).getDouble(50D);
Mekanism.oxidationChamberUsage = Mekanism.configuration.get("usage", "OxidationChamberUsage", 200D).getDouble(200D);
Mekanism.chemicalInfuserUsage = Mekanism.configuration.get("usage", "ChemicalInfuserUsage", 200D).getDouble(200D);

View file

@ -328,6 +328,7 @@ public class Mekanism
public static double purificationChamberUsage;
public static double energizedSmelterUsage;
public static double digitalMinerUsage;
public static double electricPumpUsage;
public static double rotaryCondensentratorUsage;
public static double oxidationChamberUsage;
public static double chemicalInfuserUsage;

View file

@ -49,6 +49,7 @@ public class PacketConfigSync extends MekanismPacket
dataStream.writeDouble(Mekanism.purificationChamberUsage);
dataStream.writeDouble(Mekanism.energizedSmelterUsage);
dataStream.writeDouble(Mekanism.digitalMinerUsage);
dataStream.writeDouble(Mekanism.electricPumpUsage);
dataStream.writeDouble(Mekanism.rotaryCondensentratorUsage);
dataStream.writeDouble(Mekanism.oxidationChamberUsage);
dataStream.writeDouble(Mekanism.chemicalInfuserUsage);
@ -107,6 +108,7 @@ public class PacketConfigSync extends MekanismPacket
Mekanism.purificationChamberUsage = dataStream.readDouble();
Mekanism.energizedSmelterUsage = dataStream.readDouble();
Mekanism.digitalMinerUsage = dataStream.readDouble();
Mekanism.electricPumpUsage = dataStream.readDouble();
Mekanism.rotaryCondensentratorUsage = dataStream.readDouble();
Mekanism.oxidationChamberUsage = dataStream.readDouble();
Mekanism.chemicalInfuserUsage = dataStream.readDouble();

View file

@ -102,7 +102,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
if(!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0)
{
if(getEnergy() >= 100 && (fluidTank.getFluid() == null || fluidTank.getFluid().amount+FluidContainerRegistry.BUCKET_VOLUME <= 10000))
if(getEnergy() >= Mekanism.electricPumpUsage && (fluidTank.getFluid() == null || fluidTank.getFluid().amount+FluidContainerRegistry.BUCKET_VOLUME <= 10000))
{
if(suck(true))
{
@ -150,7 +150,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
{
if(take)
{
setEnergy(getEnergy() - 100);
setEnergy(getEnergy() - Mekanism.electricPumpUsage);
recurringNodes.add(wrapper.clone());
fluidTank.fill(MekanismUtils.getFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord), true);
worldObj.setBlockToAir(wrapper.xCoord, wrapper.yCoord, wrapper.zCoord);
@ -169,7 +169,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
{
if(take)
{
setEnergy(getEnergy() - 100);
setEnergy(getEnergy() - Mekanism.electricPumpUsage);
fluidTank.fill(MekanismUtils.getFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord), true);
worldObj.setBlockToAir(wrapper.xCoord, wrapper.yCoord, wrapper.zCoord);
}
@ -187,7 +187,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
{
if(take)
{
setEnergy(electricityStored - 100);
setEnergy(getEnergy() - Mekanism.electricPumpUsage);
fluidTank.fill(MekanismUtils.getFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord), true);
worldObj.setBlockToAir(wrapper.xCoord, wrapper.yCoord, wrapper.zCoord);
}
@ -208,7 +208,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
{
if(take)
{
setEnergy(electricityStored - 100);
setEnergy(getEnergy() - Mekanism.electricPumpUsage);
recurringNodes.add(side);
fluidTank.fill(MekanismUtils.getFluid(worldObj, side.xCoord, side.yCoord, side.zCoord), true);
worldObj.setBlockToAir(side.xCoord, side.yCoord, side.zCoord);

View file

@ -6,7 +6,7 @@ import mekanism.common.util.MekanismUtils.ResourceType;
import mekanism.generators.client.model.ModelAdvancedSolarGenerator;
import mekanism.generators.client.model.ModelBioGenerator;
import mekanism.generators.client.model.ModelHeatGenerator;
import mekanism.generators.client.model.ModelHydrogenGenerator;
import mekanism.generators.client.model.ModelGasGenerator;
import mekanism.generators.client.model.ModelSolarGenerator;
import mekanism.generators.client.model.ModelWindTurbine;
import mekanism.generators.common.MekanismGenerators;
@ -29,7 +29,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
public ModelSolarGenerator solarGenerator = new ModelSolarGenerator();
public ModelBioGenerator bioGenerator = new ModelBioGenerator();
public ModelHeatGenerator heatGenerator = new ModelHeatGenerator();
public ModelHydrogenGenerator hydrogenGenerator = new ModelHydrogenGenerator();
public ModelGasGenerator hydrogenGenerator = new ModelGasGenerator();
public ModelWindTurbine windTurbine = new ModelWindTurbine();
@Override
@ -72,12 +72,12 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "HeatGenerator.png"));
heatGenerator.render(0.0625F);
}
else if(metadata == GeneratorType.HYDROGEN_GENERATOR.meta)
else if(metadata == GeneratorType.GAS_GENERATOR.meta)
{
GL11.glRotatef(180F, 0.0F, 1.0F, 1.0F);
GL11.glRotatef(90F, -1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.0F, -1.0F, 0.0F);
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "HydrogenGenerator.png"));
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "GasGenerator.png"));
hydrogenGenerator.render(0.0625F);
}
else if(metadata == GeneratorType.WIND_TURBINE.meta)
@ -88,7 +88,8 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "WindTurbine.png"));
windTurbine.render(0.018F, 0);
}
else if(metadata != 2) {
else if(metadata != 2)
{
MekanismRenderer.renderItem(renderer, metadata, block);
}
}

View file

@ -2,20 +2,20 @@ package mekanism.generators.client;
import mekanism.generators.client.gui.GuiBioGenerator;
import mekanism.generators.client.gui.GuiHeatGenerator;
import mekanism.generators.client.gui.GuiHydrogenGenerator;
import mekanism.generators.client.gui.GuiGasGenerator;
import mekanism.generators.client.gui.GuiSolarGenerator;
import mekanism.generators.client.gui.GuiWindTurbine;
import mekanism.generators.client.render.RenderAdvancedSolarGenerator;
import mekanism.generators.client.render.RenderBioGenerator;
import mekanism.generators.client.render.RenderHeatGenerator;
import mekanism.generators.client.render.RenderHydrogenGenerator;
import mekanism.generators.client.render.RenderGasGenerator;
import mekanism.generators.client.render.RenderSolarGenerator;
import mekanism.generators.client.render.RenderWindTurbine;
import mekanism.generators.common.GeneratorsCommonProxy;
import mekanism.generators.common.tile.TileEntityAdvancedSolarGenerator;
import mekanism.generators.common.tile.TileEntityBioGenerator;
import mekanism.generators.common.tile.TileEntityHeatGenerator;
import mekanism.generators.common.tile.TileEntityHydrogenGenerator;
import mekanism.generators.common.tile.TileEntityGasGenerator;
import mekanism.generators.common.tile.TileEntitySolarGenerator;
import mekanism.generators.common.tile.TileEntityWindTurbine;
import net.minecraft.client.gui.GuiScreen;
@ -39,7 +39,7 @@ public class GeneratorsClientProxy extends GeneratorsCommonProxy
ClientRegistry.registerTileEntity(TileEntitySolarGenerator.class, "SolarGenerator", new RenderSolarGenerator());
ClientRegistry.registerTileEntity(TileEntityBioGenerator.class, "BioGenerator", new RenderBioGenerator());
ClientRegistry.registerTileEntity(TileEntityHeatGenerator.class, "HeatGenerator", new RenderHeatGenerator());
ClientRegistry.registerTileEntity(TileEntityHydrogenGenerator.class, "HydrogenGenerator", new RenderHydrogenGenerator());
ClientRegistry.registerTileEntity(TileEntityGasGenerator.class, "GasGenerator", new RenderGasGenerator());
ClientRegistry.registerTileEntity(TileEntityWindTurbine.class, "WindTurbine", new RenderWindTurbine());
}
@ -64,7 +64,7 @@ public class GeneratorsClientProxy extends GeneratorsCommonProxy
case 1:
return new GuiSolarGenerator(player.inventory, (TileEntitySolarGenerator)tileEntity);
case 3:
return new GuiHydrogenGenerator(player.inventory, (TileEntityHydrogenGenerator)tileEntity);
return new GuiGasGenerator(player.inventory, (TileEntityGasGenerator)tileEntity);
case 4:
return new GuiBioGenerator(player.inventory, (TileEntityBioGenerator)tileEntity);
case 5:

View file

@ -17,8 +17,8 @@ import mekanism.client.gui.GuiSlot.SlotOverlay;
import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import mekanism.generators.common.inventory.container.ContainerHydrogenGenerator;
import mekanism.generators.common.tile.TileEntityHydrogenGenerator;
import mekanism.generators.common.inventory.container.ContainerGasGenerator;
import mekanism.generators.common.tile.TileEntityGasGenerator;
import net.minecraft.entity.player.InventoryPlayer;
import org.lwjgl.opengl.GL11;
@ -27,15 +27,15 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiHydrogenGenerator extends GuiMekanism
public class GuiGasGenerator extends GuiMekanism
{
public TileEntityHydrogenGenerator tileEntity;
public TileEntityGasGenerator tileEntity;
public GuiHydrogenGenerator(InventoryPlayer inventory, TileEntityHydrogenGenerator tentity)
public GuiGasGenerator(InventoryPlayer inventory, TileEntityGasGenerator tentity)
{
super(new ContainerHydrogenGenerator(inventory, tentity));
super(new ContainerGasGenerator(inventory, tentity));
tileEntity = tentity;
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.png")));
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiGasGenerator.png")));
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
@ -45,17 +45,17 @@ public class GuiHydrogenGenerator extends GuiMekanism
"Storing: " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()),
"Max Output: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t");
}
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.png")));
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiGasGenerator.png")));
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
@Override
public GasTank getTank()
{
return tileEntity.fuelTank;
}
}, Type.WIDE, this, MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.png"), 55, 18));
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.png"), 164, 15));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.png"), 16, 34).with(SlotOverlay.MINUS));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.png"), 142, 34).with(SlotOverlay.POWER));
}, Type.WIDE, this, MekanismUtils.getResource(ResourceType.GUI, "GuiGasGenerator.png"), 55, 18));
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiGasGenerator.png"), 164, 15));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiGasGenerator.png"), 16, 34).with(SlotOverlay.MINUS));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiGasGenerator.png"), 142, 34).with(SlotOverlay.POWER));
}
@Override
@ -63,14 +63,14 @@ public class GuiHydrogenGenerator extends GuiMekanism
{
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
fontRendererObj.drawString(tileEntity.getInventoryName(), 45, 6, 0x404040);
fontRendererObj.drawString(tileEntity.getInventoryName(), (xSize/2)-(fontRendererObj.getStringWidth(tileEntity.getInventoryName())/2), 6, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
{
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.png"));
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiGasGenerator.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;

View file

@ -6,7 +6,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelHydrogenGenerator extends ModelBase
public class ModelGasGenerator extends ModelBase
{
ModelRenderer A;
ModelRenderer B;
@ -28,7 +28,7 @@ public class ModelHydrogenGenerator extends ModelBase
ModelRenderer R;
ModelRenderer S;
public ModelHydrogenGenerator()
public ModelGasGenerator()
{
textureWidth = 128;
textureHeight = 128;

View file

@ -2,8 +2,8 @@ package mekanism.generators.client.render;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import mekanism.generators.client.model.ModelHydrogenGenerator;
import mekanism.generators.common.tile.TileEntityHydrogenGenerator;
import mekanism.generators.client.model.ModelGasGenerator;
import mekanism.generators.common.tile.TileEntityGasGenerator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@ -13,21 +13,21 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderHydrogenGenerator extends TileEntitySpecialRenderer
public class RenderGasGenerator extends TileEntitySpecialRenderer
{
private ModelHydrogenGenerator model = new ModelHydrogenGenerator();
private ModelGasGenerator model = new ModelGasGenerator();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
{
renderAModelAt((TileEntityHydrogenGenerator)tileEntity, x, y, z, partialTick);
renderAModelAt((TileEntityGasGenerator)tileEntity, x, y, z, partialTick);
}
private void renderAModelAt(TileEntityHydrogenGenerator tileEntity, double x, double y, double z, float partialTick)
private void renderAModelAt(TileEntityGasGenerator 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, "HydrogenGenerator.png"));
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "GasGenerator.png"));
switch(tileEntity.facing)
{

View file

@ -3,13 +3,13 @@ package mekanism.generators.common;
import mekanism.common.Mekanism;
import mekanism.generators.common.inventory.container.ContainerBioGenerator;
import mekanism.generators.common.inventory.container.ContainerHeatGenerator;
import mekanism.generators.common.inventory.container.ContainerHydrogenGenerator;
import mekanism.generators.common.inventory.container.ContainerGasGenerator;
import mekanism.generators.common.inventory.container.ContainerSolarGenerator;
import mekanism.generators.common.inventory.container.ContainerWindTurbine;
import mekanism.generators.common.tile.TileEntityAdvancedSolarGenerator;
import mekanism.generators.common.tile.TileEntityBioGenerator;
import mekanism.generators.common.tile.TileEntityHeatGenerator;
import mekanism.generators.common.tile.TileEntityHydrogenGenerator;
import mekanism.generators.common.tile.TileEntityGasGenerator;
import mekanism.generators.common.tile.TileEntitySolarGenerator;
import mekanism.generators.common.tile.TileEntityWindTurbine;
import net.minecraft.entity.player.EntityPlayer;
@ -34,7 +34,7 @@ public class GeneratorsCommonProxy
GameRegistry.registerTileEntity(TileEntitySolarGenerator.class, "SolarGenerator");
GameRegistry.registerTileEntity(TileEntityBioGenerator.class, "BioGenerator");
GameRegistry.registerTileEntity(TileEntityHeatGenerator.class, "HeatGenerator");
GameRegistry.registerTileEntity(TileEntityHydrogenGenerator.class, "HydrogenGenerator");
GameRegistry.registerTileEntity(TileEntityGasGenerator.class, "GasGenerator");
GameRegistry.registerTileEntity(TileEntityWindTurbine.class, "WindTurbine");
}
@ -49,11 +49,11 @@ public class GeneratorsCommonProxy
public void loadConfiguration()
{
Mekanism.configuration.load();
MekanismGenerators.advancedSolarGeneration = Mekanism.configuration.get("generation", "AdvancedSolarGeneration", 400D).getDouble(400D);
MekanismGenerators.bioGeneration = Mekanism.configuration.get("generation", "BioGeneration", 250D).getDouble(250D);
MekanismGenerators.advancedSolarGeneration = Mekanism.configuration.get("generation", "AdvancedSolarGeneration", 300D).getDouble(300D);
MekanismGenerators.bioGeneration = Mekanism.configuration.get("generation", "BioGeneration", 350D).getDouble(350D);
MekanismGenerators.heatGeneration = Mekanism.configuration.get("generation", "HeatGeneration", 150D).getDouble(150D);
MekanismGenerators.solarGeneration = Mekanism.configuration.get("generation", "SolarGeneration", 50D).getDouble(50D);
MekanismGenerators.windGeneration = Mekanism.configuration.get("generation", "WindGeneration", 100D).getDouble(100D);
MekanismGenerators.windGeneration = Mekanism.configuration.get("generation", "WindGeneration", 60D).getDouble(60D);
Mekanism.configuration.save();
}
@ -93,7 +93,7 @@ public class GeneratorsCommonProxy
case 1:
return new ContainerSolarGenerator(player.inventory, (TileEntitySolarGenerator)tileEntity);
case 3:
return new ContainerHydrogenGenerator(player.inventory, (TileEntityHydrogenGenerator)tileEntity);
return new ContainerGasGenerator(player.inventory, (TileEntityGasGenerator)tileEntity);
case 4:
return new ContainerBioGenerator(player.inventory, (TileEntityBioGenerator)tileEntity);
case 5:

View file

@ -19,7 +19,7 @@ import mekanism.generators.common.MekanismGenerators;
import mekanism.generators.common.tile.TileEntityAdvancedSolarGenerator;
import mekanism.generators.common.tile.TileEntityBioGenerator;
import mekanism.generators.common.tile.TileEntityHeatGenerator;
import mekanism.generators.common.tile.TileEntityHydrogenGenerator;
import mekanism.generators.common.tile.TileEntityGasGenerator;
import mekanism.generators.common.tile.TileEntitySolarGenerator;
import mekanism.generators.common.tile.TileEntityWindTurbine;
import net.minecraft.block.Block;
@ -524,7 +524,7 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds
{
HEAT_GENERATOR(0, "HeatGenerator", 0, 160000, TileEntityHeatGenerator.class, true),
SOLAR_GENERATOR(1, "SolarGenerator", 1, 96000, TileEntitySolarGenerator.class, true),
HYDROGEN_GENERATOR(3, "HydrogenGenerator", 3, 40000, TileEntityHydrogenGenerator.class, true),
GAS_GENERATOR(3, "GasGenerator", 3, 40000, TileEntityGasGenerator.class, true),
BIO_GENERATOR(4, "BioGenerator", 4, 160000, TileEntityBioGenerator.class, true),
ADVANCED_SOLAR_GENERATOR(5, "AdvancedSolarGenerator", 1, 200000, TileEntityAdvancedSolarGenerator.class, true),
WIND_TURBINE(6, "WindTurbine", 5, 200000, TileEntityWindTurbine.class, true);

View file

@ -4,18 +4,18 @@ import mekanism.api.gas.GasRegistry;
import mekanism.api.gas.IGasItem;
import mekanism.common.inventory.slot.SlotEnergy.SlotCharge;
import mekanism.common.util.ChargeUtils;
import mekanism.generators.common.tile.TileEntityHydrogenGenerator;
import mekanism.generators.common.tile.TileEntityGasGenerator;
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;
public class ContainerHydrogenGenerator extends Container
public class ContainerGasGenerator extends Container
{
private TileEntityHydrogenGenerator tileEntity;
private TileEntityGasGenerator tileEntity;
public ContainerHydrogenGenerator(InventoryPlayer inventory, TileEntityHydrogenGenerator tentity)
public ContainerGasGenerator(InventoryPlayer inventory, TileEntityGasGenerator tentity)
{
tileEntity = tentity;
addSlotToContainer(new Slot(tentity, 0, 17, 35));

View file

@ -23,7 +23,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess;
public class TileEntityHydrogenGenerator extends TileEntityGenerator implements IGasHandler, ITubeConnection
public class TileEntityGasGenerator extends TileEntityGenerator implements IGasHandler, ITubeConnection
{
/** The maximum amount of gas this block can store. */
public int MAX_GAS = 18000;
@ -34,9 +34,9 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
public int burnTicks = 0;
public double generationRate = 0;
public TileEntityHydrogenGenerator()
public TileEntityGasGenerator()
{
super("HydrogenGenerator", Mekanism.FROM_H2*100, Mekanism.FROM_H2*2);
super("GasGenerator", Mekanism.FROM_H2*100, Mekanism.FROM_H2*2);
inventory = new ItemStack[2];
fuelTank = new GasTank(MAX_GAS);
}
@ -53,6 +53,7 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
if(inventory[0] != null && fuelTank.getStored() < MAX_GAS)
{
Gas gasType = null;
if(fuelTank.getGas() != null)
{
gasType = fuelTank.getGas().getGas();
@ -61,9 +62,10 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
{
gasType = ((IGasItem)inventory[0].getItem()).getGas(inventory[0]).getGas();
}
if(gasType != null)
if(gasType != null && FuelHandler.getFuel(gasType) != null)
{
GasStack removed = GasTransmission.removeGas(inventory[0], gasType, MAX_GAS-fuelTank.getStored());
GasStack removed = GasTransmission.removeGas(inventory[0], gasType, fuelTank.getNeeded());
fuelTank.receive(removed, true);
}
}
@ -80,10 +82,14 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
else if(fuelTank.getStored() > 0)
{
FuelGas fuel = FuelHandler.getFuel(fuelTank.getGas().getGas());
burnTicks = fuel.burnTicks - 1;
generationRate = fuel.energyPerTick;
fuelTank.draw(1, true);
setEnergy(electricityStored + generationRate);
if(fuel != null)
{
burnTicks = fuel.burnTicks - 1;
generationRate = fuel.energyPerTick;
fuelTank.draw(1, true);
setEnergy(getEnergy() + generationRate);
}
}
else {
burnTicks = 0;
@ -117,8 +123,7 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
if(slotID == 0)
{
return itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).getGas(itemstack) != null &&
(((IGasItem)itemstack.getItem()).getGas(itemstack).getGas() == GasRegistry.getGas("hydrogen") ||
((IGasItem)itemstack.getItem()).getGas(itemstack).getGas() == GasRegistry.getGas("ethene"));
FuelHandler.getFuel((((IGasItem)itemstack.getItem()).getGas(itemstack).getGas())) != null;
}
else if(slotID == 1)
{
@ -137,15 +142,15 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
@Override
public boolean canOperate()
{
return electricityStored < MAX_ELECTRICITY && fuelTank.getStored() > 0 && MekanismUtils.canFunction(this);
return getEnergy() < getMaxEnergy() && fuelTank.getStored() > 0 && MekanismUtils.canFunction(this);
}
/**
* Gets the scaled hydrogen level for the GUI.
* Gets the scaled gas level for the GUI.
* @param i - multiplier
* @return
*/
public int getScaledHydrogenLevel(int i)
public int getScaledGasLevel(int i)
{
return fuelTank.getStored()*i / MAX_GAS;
}
@ -153,7 +158,7 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
@Override
public String[] getMethodNames()
{
return new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded", "getHydrogen", "getHydrogenNeeded"};
return new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded", "getGas", "getGasNeeded"};
}
@Override
@ -162,13 +167,13 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
switch(method)
{
case 0:
return new Object[] {electricityStored};
return new Object[] {getEnergy()};
case 1:
return new Object[] {output};
case 2:
return new Object[] {MAX_ELECTRICITY};
return new Object[] {getMaxEnergy()};
case 3:
return new Object[] {(MAX_ELECTRICITY-electricityStored)};
return new Object[] {getMaxEnergy()-getEnergy()};
case 4:
return new Object[] {fuelTank.getStored()};
case 5:
@ -184,7 +189,14 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
{
super.handlePacketData(dataStream);
fuelTank.setGas(new GasStack(dataStream.readInt(), dataStream.readInt()));
if(dataStream.readBoolean())
{
fuelTank.setGas(new GasStack(GasRegistry.getGas(dataStream.readInt()), dataStream.readInt()));
}
else {
fuelTank.setGas(null);
}
generationRate = dataStream.readDouble();
}
@ -192,9 +204,19 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
public ArrayList getNetworkedData(ArrayList data)
{
super.getNetworkedData(data);
data.add(fuelTank.getGas() == null ? 0 : fuelTank.getGas().getGas().getID());
data.add(fuelTank.getStored());
if(fuelTank.getGas() != null)
{
data.add(true);
data.add(fuelTank.getGas().getGas().getID());
data.add(fuelTank.getStored());
}
else {
data.add(false);
}
data.add(generationRate);
return data;
}

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -493,7 +493,7 @@ tooltip.SeismicVibrator=A machine that uses seismic vibrations to !nprovide info
tooltip.HeatGenerator=A generator that uses the heat of lava or !nother burnable resources to produce energy.
tooltip.SolarGenerator=A generator that uses the the power of the !nsun to produce energy.
tooltip.HydrogenGenerator=A generator that harnesses the molecular !npower of hydrogen to produce energy.
tooltip.GasGenerator=A generator that harnesses the molecular !nvarying gasses to produce energy.
tooltip.BioGenerator=A generator that burns organic materials of !nthe world to produce energy.
tooltip.AdvancedSolarGenerator=An advanced generator that directly !nabsorbs the sun's rays with little loss !nto produce energy.
tooltip.WindTurbine=A generator that uses the strength of the wind !n to produce energy, with greater efficiency !nat higher levels.
@ -571,7 +571,7 @@ infuse.bio=Biomass
//Generators
tile.Generator.HeatGenerator.name=Heat Generator
tile.Generator.SolarGenerator.name=Solar Generator
tile.Generator.HydrogenGenerator.name=Gas-Burning Generator
tile.Generator.GasGenerator.name=Gas-Burning Generator
tile.Generator.BioGenerator.name=Bio-Generator
tile.Generator.AdvancedSolarGenerator.name=Advanced Solar Generator
tile.Generator.WindTurbine.name=Wind Turbine

View file

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB