diff --git a/common/mekanism/api/gas/Gas.java b/common/mekanism/api/gas/Gas.java index 0d1edca12..e1aafbfeb 100644 --- a/common/mekanism/api/gas/Gas.java +++ b/common/mekanism/api/gas/Gas.java @@ -21,6 +21,8 @@ public class Gas private Icon icon; + private boolean visible = true; + /** * Creates a new Gas object with a defined name or key value. * @param s - name or key to associate this Gas with @@ -39,6 +41,27 @@ public class Gas return name; } + /** + * Whether or not this is a visible gas. + * @return if this gas is visible + */ + public boolean isVisible() + { + return visible; + } + + /** + * Sets this gas's "visible" state to a new value. Setting it to 'false' will treat this gas as an internal gas, and it will not be displayed or accessed by other mods. + * @param v - new visible state + * @return this Gas object + */ + public Gas setVisible(boolean v) + { + visible = v; + + return this; + } + /** * Gets the unlocalized name of this Gas. * @return this Gas's unlocalized name diff --git a/common/mekanism/client/render/MekanismRenderer.java b/common/mekanism/client/render/MekanismRenderer.java index 37dcb2c54..ed9b1662b 100644 --- a/common/mekanism/client/render/MekanismRenderer.java +++ b/common/mekanism/client/render/MekanismRenderer.java @@ -74,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")); + GasRegistry.getGas("liquidOsmium").setIcon(event.map.registerIcon("mekanism:LiquidOsmium")); + GasRegistry.getGas("liquidStone").setIcon(event.map.registerIcon("mekanism:LiquidStone")); FluidRegistry.getFluid("brine").setIcons(event.map.registerIcon("mekanism:LiquidBrine")); } diff --git a/common/mekanism/common/IFactory.java b/common/mekanism/common/IFactory.java index d5bfd6824..444a4e08d 100644 --- a/common/mekanism/common/IFactory.java +++ b/common/mekanism/common/IFactory.java @@ -121,14 +121,6 @@ public interface IFactory public int getMaxSecondaryEnergy() { - if(usesFuel) - { - MachineType type = MachineType.get(getStack().itemID, getStack().getItemDamage()); - TileEntityAdvancedElectricMachine machine = (TileEntityAdvancedElectricMachine)type.create(); - - return machine.MAX_SECONDARY_ENERGY; - } - return 200; } diff --git a/common/mekanism/common/Mekanism.java b/common/mekanism/common/Mekanism.java index 9bb011f51..5e7fe17e1 100644 --- a/common/mekanism/common/Mekanism.java +++ b/common/mekanism/common/Mekanism.java @@ -116,7 +116,6 @@ import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.common.voice.VoiceServerManager; import net.minecraft.block.Block; import net.minecraft.item.Item; -import net.minecraft.item.ItemBucket; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.FurnaceRecipes; @@ -1067,6 +1066,8 @@ public class Mekanism GasRegistry.register(new Gas("sulfurTrioxideGas")).registerFluid(); GasRegistry.register(new Gas("sulfuricAcid")).registerFluid(); GasRegistry.register(new Gas("hydrogenChloride")).registerFluid(); + GasRegistry.register(new Gas("liquidOsmium").setVisible(false)); + GasRegistry.register(new Gas("liquidStone").setVisible(false)); FluidRegistry.registerFluid(new Fluid("brine")); diff --git a/common/mekanism/common/item/ItemBlockGasTank.java b/common/mekanism/common/item/ItemBlockGasTank.java index 95ad1fdc0..24dfe9169 100644 --- a/common/mekanism/common/item/ItemBlockGasTank.java +++ b/common/mekanism/common/item/ItemBlockGasTank.java @@ -166,9 +166,12 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI for(Gas type : GasRegistry.getRegisteredGasses()) { - ItemStack filled = new ItemStack(this); - setGas(filled, new GasStack(type, ((IGasItem)filled.getItem()).getMaxGas(filled))); - list.add(filled); + if(type.isVisible()) + { + ItemStack filled = new ItemStack(this); + setGas(filled, new GasStack(type, ((IGasItem)filled.getItem()).getMaxGas(filled))); + list.add(filled); + } } } diff --git a/common/mekanism/common/tile/TileEntityAdvancedElectricMachine.java b/common/mekanism/common/tile/TileEntityAdvancedElectricMachine.java index ce1f34bae..3be8891ba 100644 --- a/common/mekanism/common/tile/TileEntityAdvancedElectricMachine.java +++ b/common/mekanism/common/tile/TileEntityAdvancedElectricMachine.java @@ -3,6 +3,8 @@ package mekanism.common.tile; import java.util.ArrayList; import mekanism.api.EnumColor; +import mekanism.api.gas.GasStack; +import mekanism.api.gas.GasTank; import mekanism.common.Mekanism; import mekanism.common.SideData; import mekanism.common.recipe.RecipeHandler; @@ -31,6 +33,8 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM /** How much secondary energy (fuel) is stored in this machine. */ public int secondaryEnergyStored = 0; + public GasTank gasTank; + /** * Advanced Electric Machine -- a machine like this has a total of 4 slots. Input slot (0), fuel slot (1), output slot (2), * energy slot (3), and the upgrade slot (4). The machine will not run if it does not have enough electricity, or if it doesn't have enough @@ -58,6 +62,8 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM sideConfig = new byte[] {2, 1, 0, 4, 5, 3}; + gasTank = new GasTank(maxSecondaryEnergy); + inventory = new ItemStack[5]; SECONDARY_ENERGY_PER_TICK = secondaryPerTick; @@ -94,7 +100,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM secondaryEnergyStored -= SECONDARY_ENERGY_PER_TICK; electricityStored -= MekanismUtils.getEnergyPerTick(getSpeedMultiplier(), getEnergyMultiplier(), ENERGY_PER_TICK); - if((operatingTicks) >= MekanismUtils.getTicks(getSpeedMultiplier(), TICKS_REQUIRED)) + if(operatingTicks >= MekanismUtils.getTicks(getSpeedMultiplier(), TICKS_REQUIRED)) { operate(); @@ -228,13 +234,33 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM { super.handlePacketData(dataStream); secondaryEnergyStored = dataStream.readInt(); + + if(dataStream.readBoolean()) + { + gasTank.setGas(new GasStack(dataStream.readInt(), dataStream.readInt())); + } + else { + gasTank.setGas(null); + } } @Override public ArrayList getNetworkedData(ArrayList data) { super.getNetworkedData(data); + data.add(secondaryEnergyStored); + + if(gasTank.getGas() != null) + { + data.add(true); + data.add(gasTank.getGas().getGas().getID()); + data.add(gasTank.getStored()); + } + else { + data.add(false); + } + return data; } @@ -244,6 +270,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM super.readFromNBT(nbtTags); secondaryEnergyStored = nbtTags.getInteger("secondaryEnergyStored"); + gasTank.read(nbtTags.getCompoundTag("gasTank")); } @Override @@ -252,6 +279,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM super.writeToNBT(nbtTags); nbtTags.setInteger("secondaryEnergyStored", secondaryEnergyStored); + nbtTags.setCompoundTag("gasTank", gasTank.write(new NBTTagCompound())); } /** diff --git a/common/mekanism/common/tile/TileEntityFactory.java b/common/mekanism/common/tile/TileEntityFactory.java index 70500f51c..aa934eebb 100644 --- a/common/mekanism/common/tile/TileEntityFactory.java +++ b/common/mekanism/common/tile/TileEntityFactory.java @@ -3,11 +3,12 @@ package mekanism.common.tile; import java.util.ArrayList; import java.util.List; -import mekanism.api.EnumColor; import mekanism.api.Coord4D; +import mekanism.api.EnumColor; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; +import mekanism.api.gas.GasTank; import mekanism.api.gas.GasTransmission; import mekanism.api.gas.IGasHandler; import mekanism.api.gas.IGasItem; @@ -83,6 +84,8 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip /** This machine's previous amount of energy. */ public double prevEnergy; + public GasTank gasTank; + public boolean sorting; public int secondaryEnergyStored; @@ -115,6 +118,8 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip inventory = new ItemStack[5+type.processes*2]; progress = new int[type.processes]; isActive = false; + + gasTank = new GasTank(getMaxSecondaryEnergy()); } @Override @@ -591,6 +596,14 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip sideConfig[i] = dataStream.readByte(); } + if(dataStream.readBoolean()) + { + gasTank.setGas(new GasStack(dataStream.readInt(), dataStream.readInt())); + } + else { + gasTank.setGas(null); + } + if(updateDelay == 0 && clientActive != isActive) { updateDelay = Mekanism.UPDATE_DELAY; @@ -623,6 +636,8 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip sideConfig[i] = nbtTags.getByte("config"+i); } } + + gasTank.read(nbtTags.getCompoundTag("gasTank")); } @Override @@ -648,6 +663,8 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip { nbtTags.setByte("config"+i, sideConfig[i]); } + + nbtTags.setCompoundTag("gasTank", gasTank.write(new NBTTagCompound())); } @Override @@ -664,6 +681,16 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip data.add(progress); data.add(sideConfig); + if(gasTank.getGas() != null) + { + data.add(true); + data.add(gasTank.getGas().getGas().getID()); + data.add(gasTank.getStored()); + } + else { + data.add(false); + } + return data; } diff --git a/resources/assets/mekanism/lang/en_US.lang b/resources/assets/mekanism/lang/en_US.lang index 690762e5e..897cf1fd1 100644 --- a/resources/assets/mekanism/lang/en_US.lang +++ b/resources/assets/mekanism/lang/en_US.lang @@ -175,6 +175,8 @@ fluid.sulfurTrioxideGas=Liquid Sulfur Trioxide fluid.sulfuricAcid=Liquid Sulfuric Acid fluid.hydrogenChloride=Liquid Hydrogen Chloride fluid.brine=Brine +fluid.liquidOsmium=Liquid Osmium +fluid.liquidStone=Liquid Stone //Gui text gui.removeSpeedUpgrade=Remove speed upgrade diff --git a/resources/assets/mekanism/textures/blocks/LiquidOsmium.png b/resources/assets/mekanism/textures/blocks/LiquidOsmium.png new file mode 100644 index 000000000..1cbb3b297 Binary files /dev/null and b/resources/assets/mekanism/textures/blocks/LiquidOsmium.png differ diff --git a/resources/assets/mekanism/textures/blocks/LiquidOsmium.png.mcmeta b/resources/assets/mekanism/textures/blocks/LiquidOsmium.png.mcmeta new file mode 100644 index 000000000..4b721e09a --- /dev/null +++ b/resources/assets/mekanism/textures/blocks/LiquidOsmium.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 2 + } +} diff --git a/resources/assets/mekanism/textures/blocks/LiquidStone.png b/resources/assets/mekanism/textures/blocks/LiquidStone.png new file mode 100644 index 000000000..5232608d6 Binary files /dev/null and b/resources/assets/mekanism/textures/blocks/LiquidStone.png differ diff --git a/resources/assets/mekanism/textures/blocks/LiquidStone.png.mcmeta b/resources/assets/mekanism/textures/blocks/LiquidStone.png.mcmeta new file mode 100644 index 000000000..4b721e09a --- /dev/null +++ b/resources/assets/mekanism/textures/blocks/LiquidStone.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 2 + } +}