Merge branch 'development' of https://github.com/aidancbrady/Mekanism into development
This commit is contained in:
commit
d3f4934daa
21 changed files with 611 additions and 22 deletions
|
@ -33,6 +33,7 @@ import mekanism.client.gui.GuiRobitMain;
|
|||
import mekanism.client.gui.GuiRobitRepair;
|
||||
import mekanism.client.gui.GuiRobitSmelting;
|
||||
import mekanism.client.gui.GuiRotaryCondensentrator;
|
||||
import mekanism.client.gui.GuiSalinationController;
|
||||
import mekanism.client.gui.GuiTeleporter;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.render.RenderPartTransmitter;
|
||||
|
@ -66,6 +67,7 @@ import mekanism.common.CommonProxy;
|
|||
import mekanism.common.IElectricChest;
|
||||
import mekanism.common.IInvConfiguration;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.EnergyDisplay.EnergyType;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.entity.EntityBalloon;
|
||||
import mekanism.common.entity.EntityObsidianTNT;
|
||||
|
@ -100,6 +102,8 @@ import mekanism.common.tile.TileEntityObsidianTNT;
|
|||
import mekanism.common.tile.TileEntityOsmiumCompressor;
|
||||
import mekanism.common.tile.TileEntityPurificationChamber;
|
||||
import mekanism.common.tile.TileEntityRotaryCondensentrator;
|
||||
import mekanism.common.tile.TileEntitySalinationController;
|
||||
import mekanism.common.tile.TileEntitySalinationValve;
|
||||
import mekanism.common.tile.TileEntityTeleporter;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
@ -141,6 +145,29 @@ public class ClientProxy extends CommonProxy
|
|||
MekanismClient.fancyUniversalCableRender = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "FancyUniversalCableRender", true).getBoolean(true);
|
||||
MekanismClient.holidays = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Holidays", true).getBoolean(true);
|
||||
MekanismClient.baseSoundVolume = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "SoundVolume", 1D).getDouble(1D);
|
||||
|
||||
String s = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnergyType", "J").getString();
|
||||
|
||||
if(s != null)
|
||||
{
|
||||
if(s.trim().equalsIgnoreCase("j") || s.trim().equalsIgnoreCase("joules"))
|
||||
{
|
||||
Mekanism.activeType = EnergyType.J;
|
||||
}
|
||||
else if(s.trim().equalsIgnoreCase("rf") || s.trim().equalsIgnoreCase("te") || s.trim().equalsIgnoreCase("thermal expansion"))
|
||||
{
|
||||
Mekanism.activeType = EnergyType.RF;
|
||||
}
|
||||
else if(s.trim().equalsIgnoreCase("eu") || s.trim().equalsIgnoreCase("ic2"))
|
||||
{
|
||||
Mekanism.activeType = EnergyType.EU;
|
||||
}
|
||||
else if(s.trim().equalsIgnoreCase("mj") || s.trim().equalsIgnoreCase("bc") || s.trim().equalsIgnoreCase("buildcraft"))
|
||||
{
|
||||
Mekanism.activeType = EnergyType.MJ;
|
||||
}
|
||||
}
|
||||
|
||||
Mekanism.configuration.save();
|
||||
}
|
||||
|
||||
|
@ -263,6 +290,8 @@ public class ClientProxy extends CommonProxy
|
|||
ClientRegistry.registerTileEntity(TileEntityChemicalInfuser.class, "ChemicalInfuser", new RenderChemicalInfuser());
|
||||
ClientRegistry.registerTileEntity(TileEntityChemicalInjectionChamber.class, "ChemicalInjectionChamber", new RenderConfigurableMachine());
|
||||
ClientRegistry.registerTileEntity(TileEntityElectrolyticSeparator.class, "ElectrolyticSeparator", new RenderElectrolyticSeparator());
|
||||
GameRegistry.registerTileEntity(TileEntitySalinationController.class, "SalinationController");
|
||||
GameRegistry.registerTileEntity(TileEntitySalinationValve.class, "SalinationValve");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -386,6 +415,8 @@ public class ClientProxy extends CommonProxy
|
|||
return new GuiChemicalInjectionChamber(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
|
||||
case 32:
|
||||
return new GuiElectrolyticSeparator(player.inventory, (TileEntityElectrolyticSeparator)tileEntity);
|
||||
case 33:
|
||||
return new GuiSalinationController(player.inventory, (TileEntitySalinationController)tileEntity);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public class GuiEnergyCube extends GuiMekanism
|
|||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
String capacityInfo = MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()) + "/" + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy());
|
||||
String capacityInfo = MekanismUtils.getEnergyDisplay(tileEntity.getEnergy());
|
||||
String outputInfo = MekanismUtils.localize("gui.out") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t";
|
||||
|
||||
fontRenderer.drawString(tileEntity.getInvName(), 43, 6, 0x404040);
|
||||
|
|
38
common/mekanism/client/gui/GuiSalinationController.java
Normal file
38
common/mekanism/client/gui/GuiSalinationController.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.ListUtils;
|
||||
import mekanism.client.gui.GuiEnergyInfo.IInfoHandler;
|
||||
import mekanism.common.inventory.container.ContainerSalinationController;
|
||||
import mekanism.common.tile.TileEntitySalinationController;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiSalinationController extends GuiMekanism
|
||||
{
|
||||
TileEntitySalinationController tileEntity;
|
||||
|
||||
public GuiSalinationController(InventoryPlayer inventory, TileEntitySalinationController tentity)
|
||||
{
|
||||
super(tentity, new ContainerSalinationController(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiSalinationController.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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -28,6 +28,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
@ -73,6 +74,8 @@ public class MekanismRenderer
|
|||
GasRegistry.getGas("sulfurTrioxideGas").setIcon(event.map.registerIcon("mekanism:LiquidSulfurTrioxide"));
|
||||
GasRegistry.getGas("sulfuricAcid").setIcon(event.map.registerIcon("mekanism:LiquidSulfuricAcid"));
|
||||
GasRegistry.getGas("hydrogenChloride").setIcon(event.map.registerIcon("mekanism:LiquidHydrogenChloride"));
|
||||
|
||||
FluidRegistry.getFluid("brine").setIcons(event.map.registerIcon("mekanism:LiquidBrine"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import mekanism.common.inventory.container.ContainerRobitMain;
|
|||
import mekanism.common.inventory.container.ContainerRobitRepair;
|
||||
import mekanism.common.inventory.container.ContainerRobitSmelting;
|
||||
import mekanism.common.inventory.container.ContainerRotaryCondensentrator;
|
||||
import mekanism.common.inventory.container.ContainerSalinationController;
|
||||
import mekanism.common.inventory.container.ContainerTeleporter;
|
||||
import mekanism.common.tile.TileEntityAdvancedElectricMachine;
|
||||
import mekanism.common.tile.TileEntityAdvancedFactory;
|
||||
|
@ -54,6 +55,8 @@ import mekanism.common.tile.TileEntityObsidianTNT;
|
|||
import mekanism.common.tile.TileEntityOsmiumCompressor;
|
||||
import mekanism.common.tile.TileEntityPurificationChamber;
|
||||
import mekanism.common.tile.TileEntityRotaryCondensentrator;
|
||||
import mekanism.common.tile.TileEntitySalinationController;
|
||||
import mekanism.common.tile.TileEntitySalinationValve;
|
||||
import mekanism.common.tile.TileEntityTeleporter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
@ -104,6 +107,8 @@ public class CommonProxy
|
|||
GameRegistry.registerTileEntity(TileEntityChemicalInfuser.class, "ChemicalInfuser");
|
||||
GameRegistry.registerTileEntity(TileEntityChemicalInjectionChamber.class, "ChemicalInjectionChamber");
|
||||
GameRegistry.registerTileEntity(TileEntityElectrolyticSeparator.class, "ElectrolyticSeparator");
|
||||
GameRegistry.registerTileEntity(TileEntitySalinationController.class, "SalinationController");
|
||||
GameRegistry.registerTileEntity(TileEntitySalinationValve.class, "SalinationValve");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -347,6 +352,8 @@ public class CommonProxy
|
|||
return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
|
||||
case 32:
|
||||
return new ContainerElectrolyticSeparator(player.inventory, (TileEntityElectrolyticSeparator)tileEntity);
|
||||
case 33:
|
||||
return new ContainerSalinationController(player.inventory, (TileEntitySalinationController)tileEntity);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -190,4 +190,12 @@ public class EnergyDisplay
|
|||
{
|
||||
return roundDecimals(d, 2);
|
||||
}
|
||||
|
||||
public static enum EnergyType
|
||||
{
|
||||
J,
|
||||
RF,
|
||||
EU,
|
||||
MJ
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import mekanism.api.transmitters.DynamicNetwork.ClientTickUpdate;
|
|||
import mekanism.api.transmitters.DynamicNetwork.NetworkClientRequest;
|
||||
import mekanism.api.transmitters.TransmitterNetworkRegistry;
|
||||
import mekanism.client.ClientTickHandler;
|
||||
import mekanism.common.EnergyDisplay.EnergyType;
|
||||
import mekanism.common.EnergyNetwork.EnergyTransferEvent;
|
||||
import mekanism.common.FluidNetwork.FluidTransferEvent;
|
||||
import mekanism.common.IFactory.RecipeType;
|
||||
|
@ -117,6 +118,7 @@ import net.minecraftforge.common.Configuration;
|
|||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.world.ChunkEvent;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
@ -275,6 +277,7 @@ public class Mekanism
|
|||
public static int VOICE_PORT = 36123;
|
||||
public static int maxUpgradeMultiplier = 10;
|
||||
public static double ENERGY_PER_REDSTONE = 10000;
|
||||
public static EnergyType activeType = EnergyType.J;
|
||||
|
||||
public static double TO_IC2;
|
||||
public static double TO_BC;
|
||||
|
@ -651,7 +654,7 @@ public class Mekanism
|
|||
|
||||
//Electrolytic Separator Recipes
|
||||
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("water", 2), new ChemicalPair(new GasStack(GasRegistry.getGas("hydrogen"), 2), new GasStack(GasRegistry.getGas("oxygen"), 1)));
|
||||
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("lava", 10), new ChemicalPair(new GasStack(GasRegistry.getGas("hydrogen"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1)));
|
||||
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("brine", 10), new ChemicalPair(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));
|
||||
|
@ -1003,6 +1006,8 @@ public class Mekanism
|
|||
GasRegistry.register(new Gas("sulfurTrioxideGas")).registerFluid();
|
||||
GasRegistry.register(new Gas("sulfuricAcid")).registerFluid();
|
||||
GasRegistry.register(new Gas("hydrogenChloride")).registerFluid();
|
||||
|
||||
FluidRegistry.registerFluid(new Fluid("brine"));
|
||||
|
||||
Mekanism.proxy.preInit();
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ import mekanism.common.tile.TileEntityBasicBlock;
|
|||
import mekanism.common.tile.TileEntityBin;
|
||||
import mekanism.common.tile.TileEntityDynamicTank;
|
||||
import mekanism.common.tile.TileEntityDynamicValve;
|
||||
import mekanism.common.tile.TileEntitySalinationController;
|
||||
import mekanism.common.tile.TileEntitySalinationValve;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -33,6 +35,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
@ -60,6 +63,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
* 11: Dynamic Valve
|
||||
* 12: Copper Block
|
||||
* 13: Tin Block
|
||||
* 14: Salination Controller
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
|
@ -118,6 +122,9 @@ public class BlockBasic extends Block
|
|||
icons[11][0] = register.registerIcon("mekanism:DynamicValve");
|
||||
icons[12][0] = register.registerIcon("mekanism:CopperBlock");
|
||||
icons[13][0] = register.registerIcon("mekanism:TinBlock");
|
||||
icons[14][0] = register.registerIcon("mekanism:SalinationController");
|
||||
icons[14][1] = register.registerIcon("mekanism:CopperBlock");
|
||||
icons[15][0] = register.registerIcon("mekanism:SalinationValve");
|
||||
|
||||
glassRenderer.registerIcons(register);
|
||||
}
|
||||
|
@ -127,12 +134,12 @@ public class BlockBasic extends Block
|
|||
public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(metadata == 6)
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(side == 0 || side == 1)
|
||||
|
||||
if(metadata == 6)
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(side == 0 || side == 1)
|
||||
{
|
||||
return MekanismUtils.isActive(world, x, y, z) ? icons[6][3] : icons[6][1];
|
||||
}
|
||||
|
@ -143,7 +150,19 @@ public class BlockBasic extends Block
|
|||
else {
|
||||
return icons[6][0];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(metadata == 14)
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return icons[14][0];
|
||||
}
|
||||
else {
|
||||
return icons[14][1];
|
||||
}
|
||||
}
|
||||
else if(metadata == 10)
|
||||
{
|
||||
return glassRenderer.getIcon(world, x, y, z, side);
|
||||
|
@ -200,6 +219,8 @@ public class BlockBasic extends Block
|
|||
list.add(new ItemStack(i, 1, 11));
|
||||
list.add(new ItemStack(i, 1, 12));
|
||||
list.add(new ItemStack(i, 1, 13));
|
||||
list.add(new ItemStack(i, 1, 14));
|
||||
list.add(new ItemStack(i, 1, 15));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -279,7 +300,17 @@ public class BlockBasic extends Block
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(metadata == 14)
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, 33, world, x, y, z);
|
||||
TileEntitySalinationController controller = (TileEntitySalinationController)new Coord4D(x, y, z).getTileEntity(world);
|
||||
//entityplayer.sendChatToPlayer(ChatMessageComponent.createFromText("Water Level: " + controller.waterTank.getFluidAmount()));
|
||||
//entityplayer.sendChatToPlayer(ChatMessageComponent.createFromText("Brine Level: " + controller.brineTank.getFluidAmount()));
|
||||
//entityplayer.sendChatToPlayer(ChatMessageComponent.createFromText("Can operate: " + controller.canOperate()));
|
||||
return true;
|
||||
}
|
||||
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
|
@ -532,7 +563,7 @@ public class BlockBasic extends Block
|
|||
@Override
|
||||
public boolean hasTileEntity(int metadata)
|
||||
{
|
||||
return metadata == 6 || metadata == 9 || metadata == 10 || metadata == 11;
|
||||
return metadata == 6 || metadata == 9 || metadata == 10 || metadata == 11 || metadata == 14 || metadata == 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -548,6 +579,10 @@ public class BlockBasic extends Block
|
|||
return new TileEntityDynamicTank();
|
||||
case 11:
|
||||
return new TileEntityDynamicValve();
|
||||
case 14:
|
||||
return new TileEntitySalinationController();
|
||||
case 15:
|
||||
return new TileEntitySalinationValve();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package mekanism.common.inventory.container;
|
||||
|
||||
import mekanism.common.tile.TileEntitySalinationController;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
|
||||
public class ContainerSalinationController extends Container
|
||||
{
|
||||
private TileEntitySalinationController tileEntity;
|
||||
|
||||
public ContainerSalinationController(InventoryPlayer inventory, TileEntitySalinationController tile)
|
||||
{
|
||||
tileEntity = tile;
|
||||
|
||||
int slotX;
|
||||
|
||||
for(slotX = 0; slotX < 3; slotX++)
|
||||
{
|
||||
for(int slotY = 0; slotY < 9; slotY++)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(slotX = 0; slotX < 9; ++slotX)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
|
||||
}
|
||||
|
||||
tileEntity.open(inventory.player);
|
||||
tileEntity.openChest();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||
{
|
||||
return tileEntity.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
|
@ -199,6 +199,12 @@ public class ItemBlockBasic extends ItemBlock
|
|||
case 13:
|
||||
name = "TinBlock";
|
||||
break;
|
||||
case 14:
|
||||
name = "SalinationController";
|
||||
break;
|
||||
case 15:
|
||||
name = "SalinationValve";
|
||||
break;
|
||||
default:
|
||||
name = "Unknown";
|
||||
break;
|
||||
|
|
293
common/mekanism/common/tile/TileEntitySalinationController.java
Normal file
293
common/mekanism/common/tile/TileEntitySalinationController.java
Normal file
|
@ -0,0 +1,293 @@
|
|||
package mekanism.common.tile;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.common.IConfigurable;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.generators.common.tile.TileEntityAdvancedSolarGenerator;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
public class TileEntitySalinationController extends TileEntitySalinationTank implements IConfigurable
|
||||
{
|
||||
public static int MAX_WATER = 100000;
|
||||
public static int MAX_BRINE = 1000;
|
||||
|
||||
public FluidTank waterTank = new FluidTank(MAX_WATER);
|
||||
public FluidTank brineTank = new FluidTank(MAX_BRINE);
|
||||
|
||||
public Set<TileEntitySalinationTank> tankParts = new HashSet<TileEntitySalinationTank>();
|
||||
public TileEntityAdvancedSolarGenerator[] solars = new TileEntityAdvancedSolarGenerator[4];
|
||||
|
||||
public boolean temperatureSet = false;
|
||||
public double partialWater = 0;
|
||||
public double partialBrine = 0;
|
||||
public float temperature = 0;
|
||||
public int height = 0;
|
||||
public boolean structured = false;
|
||||
|
||||
public boolean isLeftOnFace;
|
||||
|
||||
public TileEntitySalinationController()
|
||||
{
|
||||
super("SalinationController");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
setTemperature();
|
||||
|
||||
if(canOperate())
|
||||
{
|
||||
partialWater += temperature * (height + 7)/8;
|
||||
if(partialWater >= 1)
|
||||
{
|
||||
int waterInt = (int)Math.floor(partialWater);
|
||||
waterTank.drain(waterInt, true);
|
||||
partialWater %= 1;
|
||||
partialBrine += ((double)waterInt)/100D;
|
||||
}
|
||||
if(partialBrine >= 1)
|
||||
{
|
||||
int brineInt = (int)Math.floor(partialBrine);
|
||||
brineTank.fill(FluidRegistry.getFluidStack("brine", brineInt), true);
|
||||
partialBrine %= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canOperate()
|
||||
{
|
||||
if(!structured || height < 1 || waterTank.getFluid() == null || !waterTank.getFluid().containsFluid(FluidRegistry.getFluidStack("water", 100)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean solarsActive = true;
|
||||
|
||||
for(TileEntityAdvancedSolarGenerator solarPanel : solars)
|
||||
{
|
||||
if(solarPanel == null || solarPanel.isInvalid())
|
||||
{
|
||||
clearStructure();
|
||||
return false;
|
||||
}
|
||||
solarsActive &= solarPanel.seesSun;
|
||||
}
|
||||
return solarsActive;
|
||||
}
|
||||
|
||||
public void setTemperature()
|
||||
{
|
||||
if(!temperatureSet)
|
||||
{
|
||||
temperature = worldObj.getBiomeGenForCoordsBody(xCoord, zCoord).getFloatTemperature();
|
||||
temperatureSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean buildStructure()
|
||||
{
|
||||
ForgeDirection right = MekanismUtils.getRight(facing);
|
||||
|
||||
height = 0;
|
||||
if(!findBottomLayer()) { return false; }
|
||||
Coord4D startPoint = Coord4D.get(this).getFromSide(right);
|
||||
startPoint = isLeftOnFace ? startPoint : startPoint.getFromSide(right);
|
||||
|
||||
while(findMiddleLayer(startPoint))
|
||||
{
|
||||
startPoint = startPoint.getFromSide(ForgeDirection.UP);
|
||||
height++;
|
||||
}
|
||||
|
||||
structured = findTopLayer(startPoint);
|
||||
height = structured ? height + 1 : 0;
|
||||
return structured;
|
||||
}
|
||||
|
||||
public boolean findTopLayer(Coord4D current)
|
||||
{
|
||||
ForgeDirection left = MekanismUtils.getLeft(facing);
|
||||
ForgeDirection right = MekanismUtils.getRight(facing);
|
||||
ForgeDirection back = MekanismUtils.getBack(facing);
|
||||
ForgeDirection front = ForgeDirection.getOrientation(facing);
|
||||
|
||||
for(int i = 1; i <= 2; i++)
|
||||
{
|
||||
current = current.getFromSide(back);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
}
|
||||
|
||||
current = current.getFromSide(back);
|
||||
TileEntity solar = current.getTileEntity(worldObj);
|
||||
if(!addSolarPanel(solar, 0)) { return false; }
|
||||
|
||||
for(int i = 1; i <= 2; i++)
|
||||
{
|
||||
current = current.getFromSide(left);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
}
|
||||
|
||||
current = current.getFromSide(left);
|
||||
solar = current.getTileEntity(worldObj);
|
||||
if(!addSolarPanel(solar, 1)) { return false; }
|
||||
|
||||
for(int i = 1; i <= 2; i++)
|
||||
{
|
||||
current = current.getFromSide(front);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
}
|
||||
|
||||
current = current.getFromSide(front);
|
||||
solar = current.getTileEntity(worldObj);
|
||||
if(!addSolarPanel(solar, 2)) { return false; }
|
||||
|
||||
for(int i = 1; i <= 2; i++)
|
||||
{
|
||||
current = current.getFromSide(right);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
}
|
||||
|
||||
current = current.getFromSide(right);
|
||||
solar = current.getTileEntity(worldObj);
|
||||
if(!addSolarPanel(solar, 3)) { return false; }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean findMiddleLayer(Coord4D current)
|
||||
{
|
||||
ForgeDirection left = MekanismUtils.getLeft(facing);
|
||||
ForgeDirection right = MekanismUtils.getRight(facing);
|
||||
ForgeDirection back = MekanismUtils.getBack(facing);
|
||||
ForgeDirection front = ForgeDirection.getOrientation(facing);
|
||||
|
||||
for(int i = 1; i <= 3; i++)
|
||||
{
|
||||
current = current.getFromSide(back);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
}
|
||||
|
||||
for(int i = 1; i <= 3; i++)
|
||||
{
|
||||
current = current.getFromSide(left);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
}
|
||||
|
||||
for(int i = 1; i <= 3; i++)
|
||||
{
|
||||
current = current.getFromSide(front);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
}
|
||||
|
||||
for(int i = 1; i <= 3; i++)
|
||||
{
|
||||
current = current.getFromSide(right);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean findBottomLayer()
|
||||
{
|
||||
Coord4D baseBlock = Coord4D.get(this).getFromSide(ForgeDirection.DOWN);
|
||||
|
||||
ForgeDirection left = MekanismUtils.getLeft(facing);
|
||||
ForgeDirection right = MekanismUtils.getRight(facing);
|
||||
|
||||
if(!findBottomRow(baseBlock)) { return false; };
|
||||
if(!findBottomRow(baseBlock.getFromSide(left))) { return false; };
|
||||
if(!findBottomRow(baseBlock.getFromSide(right))) { return false; };
|
||||
|
||||
boolean twoLeft = findBottomRow(baseBlock.getFromSide(left).getFromSide(left));
|
||||
boolean twoRight = findBottomRow(baseBlock.getFromSide(right).getFromSide(right));
|
||||
|
||||
if(twoLeft == twoRight) { return false; }
|
||||
|
||||
isLeftOnFace = twoLeft;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean findBottomRow(Coord4D start)
|
||||
{
|
||||
ForgeDirection back = MekanismUtils.getBack(facing);
|
||||
Coord4D current = start;
|
||||
|
||||
for(int i = 1; i <= 4; i++)
|
||||
{
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
current = current.getFromSide(back);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean addTankPart(TileEntity tile)
|
||||
{
|
||||
if(tile instanceof TileEntitySalinationTank)
|
||||
{
|
||||
((TileEntitySalinationTank)tile).addToStructure(this);
|
||||
tankParts.add((TileEntitySalinationTank)tile);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean addSolarPanel(TileEntity tile, int i)
|
||||
{
|
||||
if(tile instanceof TileEntityAdvancedSolarGenerator)
|
||||
{
|
||||
solars[i] = (TileEntityAdvancedSolarGenerator)tile;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSneakRightClick(EntityPlayer player, int side)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onRightClick(EntityPlayer player, int side)
|
||||
{
|
||||
structured = buildStructure();
|
||||
player.sendChatToPlayer(ChatMessageComponent.createFromText("Height: " + height + ", Structured: " + structured));
|
||||
System.out.println(solars[0] + " " + solars[1] + " " + solars[2] + " " + solars[3]);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void clearStructure()
|
||||
{
|
||||
for(TileEntitySalinationTank tankPart : tankParts)
|
||||
{
|
||||
tankPart.controllerGone();
|
||||
}
|
||||
tankParts.clear();
|
||||
solars = new TileEntityAdvancedSolarGenerator[]{null, null, null, null};
|
||||
}
|
||||
}
|
34
common/mekanism/common/tile/TileEntitySalinationTank.java
Normal file
34
common/mekanism/common/tile/TileEntitySalinationTank.java
Normal file
|
@ -0,0 +1,34 @@
|
|||
package mekanism.common.tile;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntitySalinationTank extends TileEntityContainerBlock
|
||||
{
|
||||
TileEntitySalinationController master;
|
||||
|
||||
public TileEntitySalinationTank()
|
||||
{
|
||||
super("SalinationTank");
|
||||
inventory = new ItemStack[0];
|
||||
|
||||
}
|
||||
|
||||
public TileEntitySalinationTank(String fullName)
|
||||
{
|
||||
super(fullName);
|
||||
inventory = new ItemStack[0];
|
||||
}
|
||||
|
||||
public void onUpdate() {};
|
||||
|
||||
public void addToStructure(TileEntitySalinationController controller)
|
||||
{
|
||||
master = controller;
|
||||
}
|
||||
|
||||
public void controllerGone()
|
||||
{
|
||||
master = null;
|
||||
}
|
||||
}
|
57
common/mekanism/common/tile/TileEntitySalinationValve.java
Normal file
57
common/mekanism/common/tile/TileEntitySalinationValve.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
package mekanism.common.tile;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class TileEntitySalinationValve extends TileEntitySalinationTank implements IFluidHandler
|
||||
{
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
return master == null ? 0 : master.waterTank.fill(resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
if(master != null && resource.getFluid() == FluidRegistry.getFluid("brine"))
|
||||
return master.brineTank.drain(resource.amount, doDrain);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
if(master != null)
|
||||
return master.brineTank.drain(maxDrain, doDrain);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return master != null && fluid == FluidRegistry.getFluid("water");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return master != null && fluid == FluidRegistry.getFluid("brine");
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from)
|
||||
{
|
||||
if(master == null)
|
||||
{
|
||||
return new FluidTankInfo[0];
|
||||
}
|
||||
return new FluidTankInfo[] {new FluidTankInfo(master.waterTank), new FluidTankInfo(master.brineTank)};
|
||||
}
|
||||
}
|
|
@ -444,6 +444,16 @@ public final class MekanismUtils
|
|||
{
|
||||
return getLeft(orientation).getOpposite();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the opposite side of a certain orientation.
|
||||
* @param orientation
|
||||
* @return opposite side
|
||||
*/
|
||||
public static ForgeDirection getBack(int orientation)
|
||||
{
|
||||
return ForgeDirection.getOrientation(orientation).getOpposite();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if a specified ItemStack is stored in the Ore Dictionary with the specified name.
|
||||
|
@ -1129,7 +1139,19 @@ public final class MekanismUtils
|
|||
*/
|
||||
public static String getEnergyDisplay(double energy)
|
||||
{
|
||||
return EnergyDisplay.getDisplayShort(energy, ElectricUnit.JOULES);
|
||||
switch(Mekanism.activeType)
|
||||
{
|
||||
case J:
|
||||
return EnergyDisplay.getDisplayShort(energy, ElectricUnit.JOULES);
|
||||
case RF:
|
||||
return Math.round(energy*Mekanism.TO_TE) + " RF";
|
||||
case EU:
|
||||
return Math.round(energy*Mekanism.TO_IC2) + " EU";
|
||||
case MJ:
|
||||
return (Math.round((energy*Mekanism.TO_BC)*100)/100) + " MJ";
|
||||
}
|
||||
|
||||
return "error";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 3.6 KiB |
BIN
resources/assets/mekanism/gui/GuiSalinationController.png
Normal file
BIN
resources/assets/mekanism/gui/GuiSalinationController.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
|
@ -26,7 +26,8 @@ item.Jetpack.name=Jetpack
|
|||
item.ScubaTank.name=Taucherflasche
|
||||
item.GasMask.name=Gasmaske
|
||||
item.Dictionary.name=Lexikon
|
||||
item.ElectrolyticCore.name=Elektrolytischer Kern
|
||||
item.ElectrolyticCore.name=Elektrolysekern
|
||||
item.CompressedRedstone.name=Komprimiertes Redstone
|
||||
|
||||
//Gas Tank
|
||||
tile.GasTank.GasTank.name=Gastank
|
||||
|
@ -78,16 +79,11 @@ tile.OreBlock.OsmiumOre.name=Osmiumerz
|
|||
tile.OreBlock.CopperOre.name=Kupfererz
|
||||
tile.OreBlock.TinOre.name=Zinnerz
|
||||
|
||||
//Transmitters
|
||||
tile.Transmitter.PressurizedTube.name=Druckröhre
|
||||
tile.Transmitter.UniversalCable.name=Universelles Kabel
|
||||
tile.Transmitter.MechanicalPipe.name=Mechanisches Rohr
|
||||
tile.Transmitter.LogisticalTransporter.name=Logistischer Transporter
|
||||
tile.Transmitter.RestrictiveTransporter.name=Restriktiver Transporter
|
||||
tile.Transmitter.DiversionTransporter.name=Diversionstransporter
|
||||
|
||||
item.MultipartTransmitter.PressurizedTube.name=Druckröhre
|
||||
item.MultipartTransmitter.UniversalCable.name=Universelles Kabel
|
||||
item.MultipartTransmitter.BasicUniversalCable.name=Universelles Basiskabel
|
||||
item.MultipartTransmitter.AdvancedUniversalCable.name=Fortgeschrittenes Universelles Kabel
|
||||
item.MultipartTransmitter.EliteUniversalCable.name=Universelles Elitekabel
|
||||
item.MultipartTransmitter.UltimateUniversalCable.name=Ultimatives Universelles Kabel
|
||||
item.MultipartTransmitter.MechanicalPipe.name=Mechanisches Rohr
|
||||
item.MultipartTransmitter.LogisticalTransporter.name=Logistischer Transporter
|
||||
item.MultipartTransmitter.RestrictiveTransporter.name=Restriktiver Transporter
|
||||
|
@ -155,16 +151,20 @@ item.tinIngot.name=Zinnbarren
|
|||
gas.hydrogen=Wasserstoff
|
||||
gas.oxygen=Sauerstoff
|
||||
gas.water=Wasserdampf
|
||||
gas.chlorine=Chlor
|
||||
gas.sulfurDioxideGas=Schwefeldioxid
|
||||
gas.sulfurTrioxideGas=Schwefeltrioxid
|
||||
gas.sulfuricAcid=Schwefelsäure
|
||||
gas.hydrogenChloride=Chlorwasserstoff
|
||||
|
||||
//Fluids
|
||||
fluid.hydrogen=Flüssiger Wasserstoff
|
||||
fluid.oxygen=Flüssiger Sauerstoff
|
||||
fluid.chlorine=Flüssiges Chlor
|
||||
fluid.sulfurDioxideGas=Flüssiges Schwefeldioxid
|
||||
fluid.sulfurTrioxideGas=Flüssiges Schwefeltrioxid
|
||||
fluid.sulfuricAcid=Flüssige Schwefelsäure
|
||||
gas.hydrogenChloride=Flüssiger Chlorwasserstoff
|
||||
|
||||
//Gui text
|
||||
gui.removeSpeedUpgrade=Entferne Geschwindigkeitsupgrade
|
||||
|
@ -275,6 +275,7 @@ gui.digitalMiner.silk=Behutsam
|
|||
gui.digitalMiner.toMine=Zum Abbauen
|
||||
gui.digitalMiner.running=Arbeitend
|
||||
gui.digitalMiner.idle=Bereit
|
||||
gui.digitalMiner.inverse=Inversionsmodus
|
||||
|
||||
//Item and block tooltip text
|
||||
tooltip.configurator.modify=Verändern
|
||||
|
|
BIN
resources/assets/mekanism/textures/blocks/LiquidBrine.png
Normal file
BIN
resources/assets/mekanism/textures/blocks/LiquidBrine.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"animation": {
|
||||
"frametime": 2
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
BIN
resources/assets/mekanism/textures/blocks/SalinationValve.png
Normal file
BIN
resources/assets/mekanism/textures/blocks/SalinationValve.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Loading…
Reference in a new issue