Add Chlorine, do more E. Separator work, including temporary lava/brine substitute. I think it's pretty much finished for now, though maybe it could do with a new model.
This commit is contained in:
parent
ea96a7d747
commit
87a95e0732
12 changed files with 110 additions and 76 deletions
|
@ -11,7 +11,7 @@ public interface IGasHandler
|
|||
{
|
||||
/**
|
||||
* Transfer a certain amount of gas to this block.
|
||||
* @param amount - amount to transfer
|
||||
* @param stack - gas to add
|
||||
* @return gas added
|
||||
*/
|
||||
public int receiveGas(ForgeDirection side, GasStack stack);
|
||||
|
|
|
@ -68,6 +68,7 @@ public class MekanismRenderer
|
|||
GasRegistry.getGas("hydrogen").setIcon(event.map.registerIcon("mekanism:LiquidHydrogen"));
|
||||
GasRegistry.getGas("oxygen").setIcon(event.map.registerIcon("mekanism:LiquidOxygen"));
|
||||
GasRegistry.getGas("water").setIcon(event.map.registerIcon("mekanism:WaterVapor"));
|
||||
GasRegistry.getGas("chlorine").setIcon(event.map.registerIcon("mekanism:Chlorine"));
|
||||
GasRegistry.getGas("sulfurDioxideGas").setIcon(event.map.registerIcon("mekanism:LiquidSulfurDioxide"));
|
||||
GasRegistry.getGas("sulfurTrioxideGas").setIcon(event.map.registerIcon("mekanism:LiquidSulfurTrioxide"));
|
||||
GasRegistry.getGas("sulfuricAcid").setIcon(event.map.registerIcon("mekanism:LiquidSulfuricAcid"));
|
||||
|
|
|
@ -637,6 +637,7 @@ public class Mekanism
|
|||
|
||||
//Electrolytic Separator Recipes
|
||||
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("water", 2), new ChemicalInput(new GasStack(GasRegistry.getGas("hydrogen"), 2), new GasStack(GasRegistry.getGas("oxygen"), 1)));
|
||||
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("lava", 10), new ChemicalInput(new GasStack(GasRegistry.getGas("hydrogen"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1)));
|
||||
|
||||
//Infuse objects
|
||||
InfuseRegistry.registerInfuseObject(new ItemStack(Item.coal, 1, 0), new InfuseObject(InfuseRegistry.get("CARBON"), 10));
|
||||
|
@ -982,6 +983,7 @@ public class Mekanism
|
|||
GasRegistry.register(new Gas("hydrogen")).registerFluid();
|
||||
GasRegistry.register(new Gas("oxygen")).registerFluid();
|
||||
GasRegistry.register(new Gas("water")).registerFluid();
|
||||
GasRegistry.register(new Gas("chlorine")).registerFluid();
|
||||
GasRegistry.register(new Gas("sulfurDioxideGas")).registerFluid();
|
||||
GasRegistry.register(new Gas("sulfurTrioxideGas")).registerFluid();
|
||||
GasRegistry.register(new Gas("sulfuricAcid")).registerFluid();
|
||||
|
|
|
@ -347,12 +347,40 @@ public final class RecipeHandler
|
|||
return true;
|
||||
}
|
||||
}
|
||||
if(entry.getKey() instanceof FluidStack)
|
||||
{
|
||||
if(((FluidStack)entry.getKey()).isFluidEqual(input))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean containsRecipe(Fluid input)
|
||||
{
|
||||
for(Object obj : get().entrySet())
|
||||
{
|
||||
if(obj instanceof Map.Entry)
|
||||
{
|
||||
Map.Entry entry = (Map.Entry)obj;
|
||||
|
||||
if(entry.getKey() instanceof FluidStack)
|
||||
{
|
||||
if(((FluidStack)entry.getKey()).getFluid() == input)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public HashMap get()
|
||||
{
|
||||
return recipes;
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package mekanism.generators.client.gui;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.network.PacketTileEntity;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mekanism.generators.common.inventory.container.ContainerElectrolyticSeparator;
|
||||
|
@ -13,6 +17,8 @@ import org.lwjgl.opengl.GL11;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiElectrolyticSeparator extends GuiContainer
|
||||
{
|
||||
|
@ -32,55 +38,23 @@ public class GuiElectrolyticSeparator extends GuiContainer
|
|||
int xAxis = (x - (width - xSize) / 2);
|
||||
int yAxis = (y - (height - ySize) / 2);
|
||||
|
||||
if(xAxis > 160 && xAxis < 169 && yAxis > 73 && yAxis < 82)
|
||||
if(xAxis > 8 && xAxis < 17 && yAxis > 73 && yAxis < 82)
|
||||
{
|
||||
Gas gasToSet = null;
|
||||
/*
|
||||
if(tileEntity.outputType == GasRegistry.getGas("hydrogen"))
|
||||
{
|
||||
gasToSet = GasRegistry.getGas("oxygen");
|
||||
}
|
||||
else if(tileEntity.outputType == GasRegistry.getGas("oxygen"))
|
||||
{
|
||||
gasToSet = null;
|
||||
}
|
||||
else if(tileEntity.outputType == null)
|
||||
{
|
||||
gasToSet = GasRegistry.getGas("hydrogen");
|
||||
}
|
||||
|
||||
ArrayList data = new ArrayList();
|
||||
data.add((byte)0);
|
||||
data.add(GasRegistry.getGasID(gasToSet));
|
||||
|
||||
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Coord4D.get(tileEntity), data));
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
*/
|
||||
|
||||
}
|
||||
else if(xAxis > 8 && xAxis < 17 && yAxis > 73 && yAxis < 82)
|
||||
else if(xAxis > 160 && xAxis < 169 && yAxis > 73 && yAxis < 82)
|
||||
{
|
||||
Gas gasToSet = null;
|
||||
/*
|
||||
if(tileEntity.dumpType == null)
|
||||
{
|
||||
gasToSet = GasRegistry.getGas("oxygen");
|
||||
}
|
||||
else if(tileEntity.dumpType == GasRegistry.getGas("oxygen"))
|
||||
{
|
||||
gasToSet = GasRegistry.getGas("hydrogen");
|
||||
}
|
||||
else if(tileEntity.dumpType == GasRegistry.getGas("hydrogen"))
|
||||
{
|
||||
gasToSet = null;
|
||||
}
|
||||
|
||||
ArrayList data = new ArrayList();
|
||||
data.add((byte)1);
|
||||
data.add(GasRegistry.getGasID(gasToSet));
|
||||
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Coord4D.get(tileEntity), data));
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,10 +65,24 @@ public class GuiElectrolyticSeparator extends GuiContainer
|
|||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRenderer.drawString(tileEntity.getInvName(), 45, 6, 0x404040);
|
||||
fontRenderer.drawString(MekanismUtils.localize("gui.output"), 124, 73, 0x404040);
|
||||
fontRenderer.drawString(MekanismUtils.localize("gui.electrolyticSeparator.dump"), 21, 73, 0x404040);
|
||||
|
||||
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
||||
String name = tileEntity.leftTank.getGas() == null ? MekanismUtils.localize("gui.none") : tileEntity.leftTank.getGas().getGas().getLocalizedName();
|
||||
fontRenderer.drawString(name, 21, 73, 0x404040);
|
||||
name = tileEntity.rightTank.getGas() == null ? MekanismUtils.localize("gui.none") : tileEntity.rightTank.getGas().getGas().getLocalizedName();
|
||||
fontRenderer.drawString(name, 152-(name.length()*5), 73, 0x404040);
|
||||
|
||||
if(xAxis >= 7 && xAxis <= 11 && yAxis >= 17 && yAxis <= 69)
|
||||
{
|
||||
drawCreativeTabHoveringText(tileEntity.fluidTank.getFluid() != null ? tileEntity.fluidTank.getFluid().getFluid().getLocalizedName() + ": " + tileEntity.fluidTank.getFluidAmount() + "mB" : MekanismUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
}
|
||||
if(xAxis >= 65 && xAxis <= 69 && yAxis >= 17 && yAxis <= 48)
|
||||
{
|
||||
drawCreativeTabHoveringText(tileEntity.leftTank.getGas() != null ? tileEntity.leftTank.getGas().getGas().getLocalizedName() + ": " + tileEntity.leftTank.getStored() : MekanismUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
}
|
||||
if(xAxis >= 107 && xAxis <= 111 && yAxis >= 17 && yAxis <= 48)
|
||||
{
|
||||
drawCreativeTabHoveringText(tileEntity.rightTank.getGas() != null ? tileEntity.rightTank.getGas().getGas().getLocalizedName() + ": " + tileEntity.rightTank.getStored() : MekanismUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
}
|
||||
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
||||
{
|
||||
drawCreativeTabHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis);
|
||||
}
|
||||
|
@ -109,11 +97,11 @@ public class GuiElectrolyticSeparator extends GuiContainer
|
|||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
int outputDisplay = 1;//tileEntity.outputType == GasRegistry.getGas("oxygen") ? 82 : (tileEntity.outputType == GasRegistry.getGas("hydrogen") ? 90 : 98);
|
||||
drawTexturedModalRect(guiWidth + 160, guiHeight + 73, 176, outputDisplay, 8, 8);
|
||||
int leftDisplay = tileEntity.dumpLeft ? 90 : 82;
|
||||
drawTexturedModalRect(guiWidth + 8, guiHeight + 73, 176, leftDisplay, 8, 8);
|
||||
|
||||
int dumpDisplay = 1;//tileEntity.dumpType == GasRegistry.getGas("oxygen") ? 82 : (tileEntity.dumpType == GasRegistry.getGas("hydrogen") ? 90 : 98);
|
||||
drawTexturedModalRect(guiWidth + 8, guiHeight + 73, 176, dumpDisplay, 8, 8);
|
||||
int rightDisplay = tileEntity.dumpRight ? 90 : 82;
|
||||
drawTexturedModalRect(guiWidth + 160, guiHeight + 73, 176, rightDisplay, 8, 8);
|
||||
|
||||
int displayInt;
|
||||
|
||||
|
|
|
@ -32,10 +32,10 @@ public class RenderElectrolyticSeparator extends TileEntitySpecialRenderer
|
|||
|
||||
switch(tileEntity.facing)
|
||||
{
|
||||
case 2: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break;
|
||||
case 3: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break;
|
||||
case 4: GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); break;
|
||||
case 5: GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); break;
|
||||
case 2: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break;
|
||||
case 3: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break;
|
||||
case 4: GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); break;
|
||||
case 5: GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); break;
|
||||
}
|
||||
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
|
|
|
@ -2,6 +2,7 @@ package mekanism.generators.common.inventory.container;
|
|||
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.gas.IGasItem;
|
||||
import mekanism.common.RecipeHandler;
|
||||
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
|
||||
import mekanism.common.inventory.slot.SlotStorageTank;
|
||||
import mekanism.common.util.ChargeUtils;
|
||||
|
@ -23,8 +24,8 @@ public class ContainerElectrolyticSeparator extends Container
|
|||
{
|
||||
tileEntity = tentity;
|
||||
addSlotToContainer(new Slot(tentity, 0, 17, 35));
|
||||
addSlotToContainer(new SlotStorageTank(tentity, GasRegistry.getGas("hydrogen"), false, 1, 59, 52));
|
||||
addSlotToContainer(new SlotStorageTank(tentity, GasRegistry.getGas("oxygen"), false, 2, 101, 52));
|
||||
addSlotToContainer(new SlotStorageTank(tentity, null, true, 1, 59, 52));
|
||||
addSlotToContainer(new SlotStorageTank(tentity, null, true, 2, 101, 52));
|
||||
addSlotToContainer(new SlotDischarge(tentity, 3, 143, 35));
|
||||
int slotX;
|
||||
|
||||
|
@ -73,7 +74,7 @@ public class ContainerElectrolyticSeparator extends Container
|
|||
|
||||
if(slotID != 0 && slotID != 1 && slotID != 2 && slotID != 3)
|
||||
{
|
||||
if(isWater(slotStack))
|
||||
if(isCorrectFluid(slotStack))
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 0, 1, false))
|
||||
{
|
||||
|
@ -166,18 +167,8 @@ public class ContainerElectrolyticSeparator extends Container
|
|||
return stack;
|
||||
}
|
||||
|
||||
public boolean isWater(ItemStack itemStack)
|
||||
public boolean isCorrectFluid(ItemStack itemStack)
|
||||
{
|
||||
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(itemStack);
|
||||
|
||||
if(fluid != null)
|
||||
{
|
||||
if(fluid.getFluid() == FluidRegistry.WATER)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return RecipeHandler.Recipe.ELECTROLYTIC_SEPARATOR.containsRecipe(itemStack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,13 +72,12 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
{
|
||||
ChargeUtils.discharge(3, this);
|
||||
|
||||
/*if(inventory[0] != null)
|
||||
if(inventory[0] != null)
|
||||
{
|
||||
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(inventory[0]);
|
||||
|
||||
if(fluid != null && fluid.getFluid() == FluidRegistry.WATER)
|
||||
if(RecipeHandler.Recipe.ELECTROLYTIC_SEPARATOR.containsRecipe(inventory[0]))
|
||||
{
|
||||
if(fluidTank.getFluid() == null || fluidTank.getFluid().amount+fluid.amount <= fluidTank.getCapacity())
|
||||
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(inventory[0]);
|
||||
if(fluidTank.getFluid() == null || fluid.isFluidEqual(fluidTank.getFluid()) && fluidTank.getFluid().amount+fluid.amount <= fluidTank.getCapacity())
|
||||
{
|
||||
fluidTank.fill(fluid, true);
|
||||
|
||||
|
@ -96,7 +95,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
|
@ -256,7 +255,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
{
|
||||
if(slotID == 0)
|
||||
{
|
||||
return FluidContainerRegistry.getFluidForFilledItem(itemstack) != null && FluidContainerRegistry.getFluidForFilledItem(itemstack).getFluid() == FluidRegistry.WATER;
|
||||
return RecipeHandler.Recipe.ELECTROLYTIC_SEPARATOR.containsRecipe(itemstack);
|
||||
}
|
||||
else if(slotID == 1)
|
||||
{
|
||||
|
@ -338,11 +337,11 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
|
||||
if(type == 0)
|
||||
{
|
||||
dumpLeft = dataStream.readBoolean();
|
||||
dumpLeft ^= true;
|
||||
}
|
||||
else if(type == 1)
|
||||
{
|
||||
dumpRight = dataStream.readBoolean();
|
||||
dumpRight ^= true;
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -559,7 +558,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return fluid == FluidRegistry.WATER;
|
||||
return RecipeHandler.Recipe.ELECTROLYTIC_SEPARATOR.containsRecipe(fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -571,7 +570,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
if(resource.getFluid() == FluidRegistry.WATER)
|
||||
if(RecipeHandler.Recipe.ELECTROLYTIC_SEPARATOR.containsRecipe(resource.getFluid()))
|
||||
{
|
||||
return fluidTank.fill(resource, doFill);
|
||||
}
|
||||
|
@ -598,6 +597,14 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
|
||||
@Override
|
||||
public GasStack drawGas(ForgeDirection side, int amount) {
|
||||
if(side == MekanismUtils.getLeft(facing))
|
||||
{
|
||||
return leftTank.draw(amount, true);
|
||||
}
|
||||
else if(side == MekanismUtils.getRight(facing))
|
||||
{
|
||||
return rightTank.draw(amount, true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -608,6 +615,16 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
|
||||
@Override
|
||||
public boolean canDrawGas(ForgeDirection side, Gas type) {
|
||||
if(side == MekanismUtils.getLeft(facing))
|
||||
{
|
||||
return leftTank.getGas() != null && leftTank.getGas().getGas() == type;
|
||||
}
|
||||
|
||||
if(side == MekanismUtils.getRight(facing))
|
||||
{
|
||||
return rightTank.getGas() != null && rightTank.getGas().getGas() == type;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
@ -153,6 +153,7 @@ item.tinIngot.name=Tin Ingot
|
|||
gas.hydrogen=Hydrogen
|
||||
gas.oxygen=Oxygen
|
||||
gas.water=Water Vapor
|
||||
gas.chlorine=Chlorine
|
||||
gas.sulfurDioxideGas=Sulfur Dioxide
|
||||
gas.sulfurTrioxideGas=Sulfur Trioxide
|
||||
gas.sulfuricAcid=Sulfuric Acid
|
||||
|
@ -160,6 +161,7 @@ gas.sulfuricAcid=Sulfuric Acid
|
|||
//Fluids
|
||||
fluid.hydrogen=Liquid Hydrogen
|
||||
fluid.oxygen=Liquid Oxygen
|
||||
fluid.chlorine=Liquid Chlorine
|
||||
fluid.sulfurDioxideGas=Liquid Sulfur Dioxide
|
||||
fluid.sulfurTrioxideGas=Liquid Sulfur Trioxide
|
||||
fluid.sulfuricAcid=Liquid Sulfuric Acid
|
||||
|
|
BIN
resources/assets/mekanism/textures/blocks/Chlorine.png
Normal file
BIN
resources/assets/mekanism/textures/blocks/Chlorine.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"animation": {
|
||||
"frametime": 2
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue