diff --git a/common/mekanism/api/RecipeHelper.java b/common/mekanism/api/RecipeHelper.java index d7301e24f..075c9b75d 100644 --- a/common/mekanism/api/RecipeHelper.java +++ b/common/mekanism/api/RecipeHelper.java @@ -159,9 +159,9 @@ public final class RecipeHelper } /** - * Add a Electrolytic Separator recipe. - * @param input - input ItemStack - * @param output - output ItemStack + * Add an Electrolytic Separator recipe. + * @param input - input FluidStack + * @param output - output ChemicalPair */ public static void addElectrolyticSeparatorRecipe(FluidStack input, ChemicalPair output) { @@ -174,6 +174,54 @@ public final class RecipeHelper } } + /** + * Add a Chemical Dissolution Chamber recipe. + * @param input - input ItemStack + * @param output - output GasStack + */ + public static void addChemicalDissolutionChamberRecipe(ItemStack input, GasStack output) + { + try { + Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); + Method m = recipeClass.getMethod("addChemicalDissolutionChamberRecipe", ItemStack.class, GasStack.class); + m.invoke(null, input, output); + } catch(Exception e) { + System.err.println("[Mekanism] Error while adding recipe: " + e.getMessage()); + } + } + + /** + * Add a Chemical Washer recipe. + * @param input - input GasStack + * @param output - output GasStack + */ + public static void addChemicalWasherRecipe(GasStack input, GasStack output) + { + try { + Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); + Method m = recipeClass.getMethod("addChemicalWasherRecipe", GasStack.class, GasStack.class); + m.invoke(null, input, output); + } catch(Exception e) { + System.err.println("[Mekanism] Error while adding recipe: " + e.getMessage()); + } + } + + /** + * Add a Electrolytic Separator recipe. + * @param input - input GasStack + * @param output - output ItemStack + */ + public static void addChemicalCrystalizerRecipe(GasStack input, ItemStack output) + { + try { + Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); + Method m = recipeClass.getMethod("addChemicalCrystalizerRecipe", GasStack.class, ItemStack.class); + m.invoke(null, input, output); + } catch(Exception e) { + System.err.println("[Mekanism] Error while adding recipe: " + e.getMessage()); + } + } + /** * Add a Metallurgic Infuser recipe. * @param input - input Infusion diff --git a/common/mekanism/api/gas/OreGas.java b/common/mekanism/api/gas/OreGas.java index 86dd31f2b..b8e02b6e2 100644 --- a/common/mekanism/api/gas/OreGas.java +++ b/common/mekanism/api/gas/OreGas.java @@ -5,6 +5,7 @@ import net.minecraft.util.StatCollector; public class OreGas extends Gas { private String oreName; + private OreGas cleanGas; public OreGas(String s, String name) { @@ -13,6 +14,23 @@ public class OreGas extends Gas oreName = name; } + public boolean isClean() + { + return getCleanGas() == null; + } + + public OreGas getCleanGas() + { + return cleanGas; + } + + public OreGas setCleanGas(OreGas gas) + { + cleanGas = gas; + + return this; + } + public String getOreName() { return StatCollector.translateToLocal(oreName); diff --git a/common/mekanism/client/ClientProxy.java b/common/mekanism/client/ClientProxy.java index d0e368dcd..db0ee9733 100644 --- a/common/mekanism/client/ClientProxy.java +++ b/common/mekanism/client/ClientProxy.java @@ -47,8 +47,11 @@ import mekanism.client.render.entity.RenderRobit; import mekanism.client.render.item.ItemRenderingHandler; import mekanism.client.render.tileentity.RenderBin; import mekanism.client.render.tileentity.RenderChargepad; +import mekanism.client.render.tileentity.RenderChemicalCrystalizer; +import mekanism.client.render.tileentity.RenderChemicalDissolutionChamber; import mekanism.client.render.tileentity.RenderChemicalInfuser; import mekanism.client.render.tileentity.RenderChemicalOxidizer; +import mekanism.client.render.tileentity.RenderChemicalWasher; import mekanism.client.render.tileentity.RenderConfigurableMachine; import mekanism.client.render.tileentity.RenderDigitalMiner; import mekanism.client.render.tileentity.RenderDynamicTank; @@ -80,9 +83,12 @@ import mekanism.common.tile.TileEntityAdvancedElectricMachine; import mekanism.common.tile.TileEntityAdvancedFactory; import mekanism.common.tile.TileEntityBin; import mekanism.common.tile.TileEntityChargepad; +import mekanism.common.tile.TileEntityChemicalCrystalizer; +import mekanism.common.tile.TileEntityChemicalDissolutionChamber; import mekanism.common.tile.TileEntityChemicalInfuser; import mekanism.common.tile.TileEntityChemicalInjectionChamber; import mekanism.common.tile.TileEntityChemicalOxidizer; +import mekanism.common.tile.TileEntityChemicalWasher; import mekanism.common.tile.TileEntityCombiner; import mekanism.common.tile.TileEntityCrusher; import mekanism.common.tile.TileEntityDigitalMiner; @@ -298,6 +304,9 @@ public class ClientProxy extends CommonProxy GameRegistry.registerTileEntity(TileEntitySalinationValve.class, "SalinationValve"); GameRegistry.registerTileEntity(TileEntitySalinationTank.class, "SalinationTank"); ClientRegistry.registerTileEntity(TileEntityPrecisionSawmill.class, "PrecisionSawmill", new RenderConfigurableMachine()); + ClientRegistry.registerTileEntity(TileEntityChemicalDissolutionChamber.class, "ChemicalDissolutionChamber", new RenderChemicalDissolutionChamber()); + ClientRegistry.registerTileEntity(TileEntityChemicalWasher.class, "ChemicalWasher", new RenderChemicalWasher()); + ClientRegistry.registerTileEntity(TileEntityChemicalCrystalizer.class, "ChemicalCrystalizer", new RenderChemicalCrystalizer()); } @Override diff --git a/common/mekanism/client/gui/GuiChemicalCrystalizer.java b/common/mekanism/client/gui/GuiChemicalCrystalizer.java new file mode 100644 index 000000000..b9e00b90b --- /dev/null +++ b/common/mekanism/client/gui/GuiChemicalCrystalizer.java @@ -0,0 +1,6 @@ +package mekanism.client.gui; + +public class GuiChemicalCrystalizer +{ + +} diff --git a/common/mekanism/client/gui/GuiChemicalDissolutionChamber.java b/common/mekanism/client/gui/GuiChemicalDissolutionChamber.java new file mode 100644 index 000000000..679c36e6f --- /dev/null +++ b/common/mekanism/client/gui/GuiChemicalDissolutionChamber.java @@ -0,0 +1,6 @@ +package mekanism.client.gui; + +public class GuiChemicalDissolutionChamber +{ + +} diff --git a/common/mekanism/client/gui/GuiChemicalWasher.java b/common/mekanism/client/gui/GuiChemicalWasher.java new file mode 100644 index 000000000..e609f2094 --- /dev/null +++ b/common/mekanism/client/gui/GuiChemicalWasher.java @@ -0,0 +1,6 @@ +package mekanism.client.gui; + +public class GuiChemicalWasher +{ + +} diff --git a/common/mekanism/client/model/ModelChemicalCrystalizer.java b/common/mekanism/client/model/ModelChemicalCrystalizer.java new file mode 100644 index 000000000..d897270a6 --- /dev/null +++ b/common/mekanism/client/model/ModelChemicalCrystalizer.java @@ -0,0 +1,314 @@ +package mekanism.client.model; + +import mekanism.client.render.MekanismRenderer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class ModelChemicalCrystalizer extends ModelBase +{ + ModelRenderer Base; + ModelRenderer IO1; + ModelRenderer IO2; + ModelRenderer Base3; + ModelRenderer Base2; + ModelRenderer Can1B; + ModelRenderer Can1T; + ModelRenderer Can1Side3; + ModelRenderer Can1Side1; + ModelRenderer Can1Side2; + ModelRenderer Can1Side4; + ModelRenderer Can2Side4; + ModelRenderer Can3Side3; + ModelRenderer Can2Side2; + ModelRenderer Can2Side3; + ModelRenderer Can2Side1; + ModelRenderer Can4Side3; + ModelRenderer Can4Side1; + ModelRenderer Can4Sjde4; + ModelRenderer Can4Side2; + ModelRenderer Can3Side4; + ModelRenderer Can4B; + ModelRenderer Can3Side2; + ModelRenderer Can3Side1; + ModelRenderer Can2B; + ModelRenderer Can4T; + ModelRenderer Can2T; + ModelRenderer Can3T; + ModelRenderer Can3B; + ModelRenderer Spire; + ModelRenderer Spin; + ModelRenderer Vial1; + ModelRenderer Vial2; + ModelRenderer Vial3; + ModelRenderer Vial4; + + public ModelChemicalCrystalizer() + { + textureWidth = 128; + textureHeight = 64; + + Base = new ModelRenderer(this, 16, 0); + Base.addBox(0F, 0F, 0F, 14, 1, 14); + Base.setRotationPoint(-7F, 23F, -7F); + Base.setTextureSize(128, 64); + Base.mirror = true; + setRotation(Base, 0F, 0F, 0F); + IO1 = new ModelRenderer(this, 9, 17); + IO1.addBox(0F, 0F, 0F, 1, 8, 8); + IO1.setRotationPoint(-8F, 12F, -4F); + IO1.setTextureSize(128, 64); + IO1.mirror = true; + setRotation(IO1, 0F, 0F, 0F); + IO2 = new ModelRenderer(this, 9, 17); + IO2.addBox(0F, 0F, 0F, 1, 8, 8); + IO2.setRotationPoint(7F, 12F, -4F); + IO2.setTextureSize(128, 64); + IO2.mirror = true; + setRotation(IO2, 0F, 0F, 0F); + Base3 = new ModelRenderer(this, 16, 0); + Base3.addBox(0F, 0F, 0F, 14, 1, 14); + Base3.setRotationPoint(-7F, 9F, -7F); + Base3.setTextureSize(128, 64); + Base3.mirror = true; + setRotation(Base3, 0F, 0F, 0F); + Base2 = new ModelRenderer(this, 16, 0); + Base2.addBox(0F, 0F, 0F, 14, 1, 14); + Base2.setRotationPoint(-7F, 14F, -7F); + Base2.setTextureSize(128, 64); + Base2.mirror = true; + setRotation(Base2, 0F, 0F, 0F); + Can1B = new ModelRenderer(this, 0, 0); + Can1B.addBox(0F, 0F, 0F, 4, 1, 4); + Can1B.setRotationPoint(2F, 13F, 2F); + Can1B.setTextureSize(128, 64); + Can1B.mirror = true; + setRotation(Can1B, 0F, 0F, 0F); + Can1T = new ModelRenderer(this, 0, 0); + Can1T.addBox(0F, 0F, 0F, 4, 1, 4); + Can1T.setRotationPoint(2F, 10F, 2F); + Can1T.setTextureSize(128, 64); + Can1T.mirror = true; + setRotation(Can1T, 0F, 0F, 0F); + Can1Side3 = new ModelRenderer(this, 0, 0); + Can1Side3.addBox(0F, 0F, 0F, 1, 2, 2); + Can1Side3.setRotationPoint(5F, 11F, 3F); + Can1Side3.setTextureSize(128, 64); + Can1Side3.mirror = true; + setRotation(Can1Side3, 0F, 0F, 0F); + Can1Side1 = new ModelRenderer(this, 0, 0); + Can1Side1.addBox(0F, 0F, 0F, 4, 2, 1); + Can1Side1.setRotationPoint(2F, 11F, 5F); + Can1Side1.setTextureSize(128, 64); + Can1Side1.mirror = true; + setRotation(Can1Side1, 0F, 0F, 0F); + Can1Side2 = new ModelRenderer(this, 0, 0); + Can1Side2.addBox(0F, 0F, 0F, 4, 2, 1); + Can1Side2.setRotationPoint(2F, 11F, 2F); + Can1Side2.setTextureSize(128, 64); + Can1Side2.mirror = true; + setRotation(Can1Side2, 0F, 0F, 0F); + Can1Side4 = new ModelRenderer(this, 0, 0); + Can1Side4.addBox(0F, 0F, 0F, 1, 2, 2); + Can1Side4.setRotationPoint(2F, 11F, 3F); + Can1Side4.setTextureSize(128, 64); + Can1Side4.mirror = true; + setRotation(Can1Side4, 0F, 0F, 0F); + Can2Side4 = new ModelRenderer(this, 0, 0); + Can2Side4.addBox(0F, 0F, 0F, 1, 2, 2); + Can2Side4.setRotationPoint(-6F, 11F, 3F); + Can2Side4.setTextureSize(128, 64); + Can2Side4.mirror = true; + setRotation(Can2Side4, 0F, 0F, 0F); + Can3Side3 = new ModelRenderer(this, 0, 0); + Can3Side3.addBox(0F, 0F, 0F, 1, 2, 2); + Can3Side3.setRotationPoint(5F, 11F, -5F); + Can3Side3.setTextureSize(128, 64); + Can3Side3.mirror = true; + setRotation(Can3Side3, 0F, 0F, 0F); + Can2Side2 = new ModelRenderer(this, 0, 0); + Can2Side2.addBox(0F, 0F, 0F, 4, 2, 1); + Can2Side2.setRotationPoint(-6F, 11F, 2F); + Can2Side2.setTextureSize(128, 64); + Can2Side2.mirror = true; + setRotation(Can2Side2, 0F, 0F, 0F); + Can2Side3 = new ModelRenderer(this, 0, 0); + Can2Side3.addBox(0F, 0F, 0F, 1, 2, 2); + Can2Side3.setRotationPoint(-3F, 11F, 3F); + Can2Side3.setTextureSize(128, 64); + Can2Side3.mirror = true; + setRotation(Can2Side3, 0F, 0F, 0F); + Can2Side1 = new ModelRenderer(this, 0, 0); + Can2Side1.addBox(0F, 0F, 0F, 4, 2, 1); + Can2Side1.setRotationPoint(-6F, 11F, 5F); + Can2Side1.setTextureSize(128, 64); + Can2Side1.mirror = true; + setRotation(Can2Side1, 0F, 0F, 0F); + Can4Side3 = new ModelRenderer(this, 0, 0); + Can4Side3.addBox(0F, 0F, 0F, 1, 2, 2); + Can4Side3.setRotationPoint(-3F, 11F, -5F); + Can4Side3.setTextureSize(128, 64); + Can4Side3.mirror = true; + setRotation(Can4Side3, 0F, 0F, 0F); + Can4Side1 = new ModelRenderer(this, 0, 0); + Can4Side1.addBox(0F, 0F, 0F, 4, 2, 1); + Can4Side1.setRotationPoint(-6F, 11F, -3F); + Can4Side1.setTextureSize(128, 64); + Can4Side1.mirror = true; + setRotation(Can4Side1, 0F, 0F, 0F); + Can4Sjde4 = new ModelRenderer(this, 0, 0); + Can4Sjde4.addBox(0F, 0F, 0F, 1, 2, 2); + Can4Sjde4.setRotationPoint(-6F, 11F, -5F); + Can4Sjde4.setTextureSize(128, 64); + Can4Sjde4.mirror = true; + setRotation(Can4Sjde4, 0F, 0F, 0F); + Can4Side2 = new ModelRenderer(this, 0, 0); + Can4Side2.addBox(0F, 0F, 0F, 4, 2, 1); + Can4Side2.setRotationPoint(-6F, 11F, -6F); + Can4Side2.setTextureSize(128, 64); + Can4Side2.mirror = true; + setRotation(Can4Side2, 0F, 0F, 0F); + Can3Side4 = new ModelRenderer(this, 0, 0); + Can3Side4.addBox(0F, 0F, 0F, 1, 2, 2); + Can3Side4.setRotationPoint(2F, 11F, -5F); + Can3Side4.setTextureSize(128, 64); + Can3Side4.mirror = true; + setRotation(Can3Side4, 0F, 0F, 0F); + Can4B = new ModelRenderer(this, 0, 0); + Can4B.addBox(0F, 0F, 0F, 4, 1, 4); + Can4B.setRotationPoint(-6F, 13F, -6F); + Can4B.setTextureSize(128, 64); + Can4B.mirror = true; + setRotation(Can4B, 0F, 0F, 0F); + Can3Side2 = new ModelRenderer(this, 0, 0); + Can3Side2.addBox(0F, 0F, 0F, 4, 2, 1); + Can3Side2.setRotationPoint(2F, 11F, -6F); + Can3Side2.setTextureSize(128, 64); + Can3Side2.mirror = true; + setRotation(Can3Side2, 0F, 0F, 0F); + Can3Side1 = new ModelRenderer(this, 0, 0); + Can3Side1.addBox(0F, 0F, 0F, 4, 2, 1); + Can3Side1.setRotationPoint(2F, 11F, -3F); + Can3Side1.setTextureSize(128, 64); + Can3Side1.mirror = true; + setRotation(Can3Side1, 0F, 0F, 0F); + Can2B = new ModelRenderer(this, 0, 0); + Can2B.addBox(0F, 0F, 0F, 4, 1, 4); + Can2B.setRotationPoint(-6F, 13F, 2F); + Can2B.setTextureSize(128, 64); + Can2B.mirror = true; + setRotation(Can2B, 0F, 0F, 0F); + Can4T = new ModelRenderer(this, 0, 0); + Can4T.addBox(0F, 0F, 0F, 4, 1, 4); + Can4T.setRotationPoint(-6F, 10F, -6F); + Can4T.setTextureSize(128, 64); + Can4T.mirror = true; + setRotation(Can4T, 0F, 0F, 0F); + Can2T = new ModelRenderer(this, 0, 0); + Can2T.addBox(0F, 0F, 0F, 4, 1, 4); + Can2T.setRotationPoint(-6F, 10F, 2F); + Can2T.setTextureSize(128, 64); + Can2T.mirror = true; + setRotation(Can2T, 0F, 0F, 0F); + Can3T = new ModelRenderer(this, 0, 0); + Can3T.addBox(0F, 0F, 0F, 4, 1, 4); + Can3T.setRotationPoint(2F, 10F, -6F); + Can3T.setTextureSize(128, 64); + Can3T.mirror = true; + setRotation(Can3T, 0F, 0F, 0F); + Can3B = new ModelRenderer(this, 0, 0); + Can3B.addBox(0F, 0F, 0F, 4, 1, 4); + Can3B.setRotationPoint(2F, 13F, -6F); + Can3B.setTextureSize(128, 64); + Can3B.mirror = true; + setRotation(Can3B, 0F, 0F, 0F); + Spire = new ModelRenderer(this, 0, 6); + Spire.addBox(0F, 0F, 0F, 2, 8, 2); + Spire.setRotationPoint(-1F, 15F, -1F); + Spire.setTextureSize(128, 64); + Spire.mirror = true; + setRotation(Spire, 0F, 0F, 0F); + Spin = new ModelRenderer(this, 28, 24); + Spin.addBox(-4F, 0F, -4F, 8, 1, 8); + Spin.setRotationPoint(0F, 16F, 0F); + Spin.setTextureSize(128, 64); + Spin.mirror = true; + setRotation(Spin, 0F, 0F, 0F); + Vial1 = new ModelRenderer(this, 8, 6); + Vial1.addBox(-3F, 0.5F, 3F, 2, 3, 2); + Vial1.setRotationPoint(0F, 16F, 0F); + Vial1.setTextureSize(128, 64); + Vial1.mirror = true; + setRotation(Vial1, 0F, 0F, 0F); + Vial2 = new ModelRenderer(this, 8, 6); + Vial2.addBox(1F, 0.5F, 3F, 2, 3, 2); + Vial2.setRotationPoint(0F, 16F, 0F); + Vial2.setTextureSize(128, 64); + Vial2.mirror = true; + setRotation(Vial2, 0F, 0F, 0F); + Vial3 = new ModelRenderer(this, 8, 6); + Vial3.addBox(-3F, 0.5F, -5F, 2, 3, 2); + Vial3.setRotationPoint(0F, 16F, 0F); + Vial3.setTextureSize(128, 64); + Vial3.mirror = true; + setRotation(Vial3, 0F, 0F, 0F); + Vial4 = new ModelRenderer(this, 8, 6); + Vial4.addBox(1F, 0.5F, -5F, 2, 3, 2); + Vial4.setRotationPoint(0F, 16F, 0F); + Vial4.setTextureSize(128, 64); + Vial4.mirror = true; + setRotation(Vial4, 0F, 0F, 0F); + } + + public void render(float size) + { + MekanismRenderer.blendOn(); + + Base.render(size); + IO1.render(size); + IO2.render(size); + Base3.render(size); + Base2.render(size); + Can1B.render(size); + Can1T.render(size); + Can1Side3.render(size); + Can1Side1.render(size); + Can1Side2.render(size); + Can1Side4.render(size); + Can2Side4.render(size); + Can3Side3.render(size); + Can2Side2.render(size); + Can2Side3.render(size); + Can2Side1.render(size); + Can4Side3.render(size); + Can4Side1.render(size); + Can4Sjde4.render(size); + Can4Side2.render(size); + Can3Side4.render(size); + Can4B.render(size); + Can3Side2.render(size); + Can3Side1.render(size); + Can2B.render(size); + Can4T.render(size); + Can2T.render(size); + Can3T.render(size); + Can3B.render(size); + Spire.render(size); + Spin.render(size); + Vial1.render(size); + Vial2.render(size); + Vial3.render(size); + Vial4.render(size); + + MekanismRenderer.blendOff(); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/common/mekanism/client/model/ModelChemicalDissolutionChamber.java b/common/mekanism/client/model/ModelChemicalDissolutionChamber.java new file mode 100644 index 000000000..4972bd6d3 --- /dev/null +++ b/common/mekanism/client/model/ModelChemicalDissolutionChamber.java @@ -0,0 +1,314 @@ +package mekanism.client.model; + +import mekanism.client.render.MekanismRenderer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class ModelChemicalDissolutionChamber extends ModelBase +{ + ModelRenderer Centre; + ModelRenderer Base; + ModelRenderer Base2; + ModelRenderer Can1B; + ModelRenderer Can1T; + ModelRenderer Can1Side3; + ModelRenderer Can1Side1; + ModelRenderer Can1Side2; + ModelRenderer Can1Side4; + ModelRenderer Can2Side4; + ModelRenderer Can3Side3; + ModelRenderer Can2Side2; + ModelRenderer Can2Side3; + ModelRenderer Can2Side1; + ModelRenderer Can4Side3; + ModelRenderer Can4Side1; + ModelRenderer Can4Sjde4; + ModelRenderer Can4Side2; + ModelRenderer Can3Side4; + ModelRenderer Can4B; + ModelRenderer Can3Side2; + ModelRenderer Can3Side1; + ModelRenderer Can2B; + ModelRenderer Can4T; + ModelRenderer Can2T; + ModelRenderer Can3T; + ModelRenderer Can3B; + ModelRenderer IO1; + ModelRenderer IO2Port; + ModelRenderer IO2; + ModelRenderer IO2Port2; + ModelRenderer Coil1; + ModelRenderer Coil2; + ModelRenderer Coil3; + ModelRenderer Coil4; + + public ModelChemicalDissolutionChamber() + { + textureWidth = 128; + textureHeight = 64; + + Centre = new ModelRenderer(this, 0, 17); + Centre.addBox(0F, 0F, 0F, 2, 13, 2); + Centre.setRotationPoint(-1F, 9F, -1F); + Centre.setTextureSize(128, 64); + Centre.mirror = true; + setRotation(Centre, 0F, 0F, 0F); + Base = new ModelRenderer(this, 16, 0); + Base.addBox(0F, 0F, 0F, 14, 2, 14); + Base.setRotationPoint(-7F, 22F, -7F); + Base.setTextureSize(128, 64); + Base.mirror = true; + setRotation(Base, 0F, 0F, 0F); + Base2 = new ModelRenderer(this, 16, 0); + Base2.addBox(0F, 0F, 0F, 14, 1, 14); + Base2.setRotationPoint(-7F, 16F, -7F); + Base2.setTextureSize(128, 64); + Base2.mirror = true; + setRotation(Base2, 0F, 0F, 0F); + Can1B = new ModelRenderer(this, 0, 0); + Can1B.addBox(0F, 0F, 0F, 4, 1, 4); + Can1B.setRotationPoint(2F, 21F, 2F); + Can1B.setTextureSize(128, 64); + Can1B.mirror = true; + setRotation(Can1B, 0F, 0F, 0F); + Can1T = new ModelRenderer(this, 0, 0); + Can1T.addBox(0F, 0F, 0F, 4, 1, 4); + Can1T.setRotationPoint(2F, 17F, 2F); + Can1T.setTextureSize(128, 64); + Can1T.mirror = true; + setRotation(Can1T, 0F, 0F, 0F); + Can1Side3 = new ModelRenderer(this, 0, 0); + Can1Side3.addBox(0F, 0F, 0F, 1, 3, 2); + Can1Side3.setRotationPoint(5F, 18F, 3F); + Can1Side3.setTextureSize(128, 64); + Can1Side3.mirror = true; + setRotation(Can1Side3, 0F, 0F, 0F); + Can1Side1 = new ModelRenderer(this, 0, 0); + Can1Side1.addBox(0F, 0F, 0F, 4, 3, 1); + Can1Side1.setRotationPoint(2F, 18F, 5F); + Can1Side1.setTextureSize(128, 64); + Can1Side1.mirror = true; + setRotation(Can1Side1, 0F, 0F, 0F); + Can1Side2 = new ModelRenderer(this, 0, 0); + Can1Side2.addBox(0F, 0F, 0F, 4, 3, 1); + Can1Side2.setRotationPoint(2F, 18F, 2F); + Can1Side2.setTextureSize(128, 64); + Can1Side2.mirror = true; + setRotation(Can1Side2, 0F, 0F, 0F); + Can1Side4 = new ModelRenderer(this, 0, 0); + Can1Side4.addBox(0F, 0F, 0F, 1, 3, 2); + Can1Side4.setRotationPoint(2F, 18F, 3F); + Can1Side4.setTextureSize(128, 64); + Can1Side4.mirror = true; + setRotation(Can1Side4, 0F, 0F, 0F); + Can2Side4 = new ModelRenderer(this, 0, 0); + Can2Side4.addBox(0F, 0F, 0F, 1, 3, 2); + Can2Side4.setRotationPoint(-6F, 18F, 3F); + Can2Side4.setTextureSize(128, 64); + Can2Side4.mirror = true; + setRotation(Can2Side4, 0F, 0F, 0F); + Can3Side3 = new ModelRenderer(this, 0, 0); + Can3Side3.addBox(0F, 0F, 0F, 1, 3, 2); + Can3Side3.setRotationPoint(5F, 18F, -5F); + Can3Side3.setTextureSize(128, 64); + Can3Side3.mirror = true; + setRotation(Can3Side3, 0F, 0F, 0F); + Can2Side2 = new ModelRenderer(this, 0, 0); + Can2Side2.addBox(0F, 0F, 0F, 4, 3, 1); + Can2Side2.setRotationPoint(-6F, 18F, 2F); + Can2Side2.setTextureSize(128, 64); + Can2Side2.mirror = true; + setRotation(Can2Side2, 0F, 0F, 0F); + Can2Side3 = new ModelRenderer(this, 0, 0); + Can2Side3.addBox(0F, 0F, 0F, 1, 3, 2); + Can2Side3.setRotationPoint(-3F, 18F, 3F); + Can2Side3.setTextureSize(128, 64); + Can2Side3.mirror = true; + setRotation(Can2Side3, 0F, 0F, 0F); + Can2Side1 = new ModelRenderer(this, 0, 0); + Can2Side1.addBox(0F, 0F, 0F, 4, 3, 1); + Can2Side1.setRotationPoint(-6F, 18F, 5F); + Can2Side1.setTextureSize(128, 64); + Can2Side1.mirror = true; + setRotation(Can2Side1, 0F, 0F, 0F); + Can4Side3 = new ModelRenderer(this, 0, 0); + Can4Side3.addBox(0F, 0F, 0F, 1, 3, 2); + Can4Side3.setRotationPoint(-3F, 18F, -5F); + Can4Side3.setTextureSize(128, 64); + Can4Side3.mirror = true; + setRotation(Can4Side3, 0F, 0F, 0F); + Can4Side1 = new ModelRenderer(this, 0, 0); + Can4Side1.addBox(0F, 0F, 0F, 4, 3, 1); + Can4Side1.setRotationPoint(-6F, 18F, -3F); + Can4Side1.setTextureSize(128, 64); + Can4Side1.mirror = true; + setRotation(Can4Side1, 0F, 0F, 0F); + Can4Sjde4 = new ModelRenderer(this, 0, 0); + Can4Sjde4.addBox(0F, 0F, 0F, 1, 3, 2); + Can4Sjde4.setRotationPoint(-6F, 18F, -5F); + Can4Sjde4.setTextureSize(128, 64); + Can4Sjde4.mirror = true; + setRotation(Can4Sjde4, 0F, 0F, 0F); + Can4Side2 = new ModelRenderer(this, 0, 0); + Can4Side2.addBox(0F, 0F, 0F, 4, 3, 1); + Can4Side2.setRotationPoint(-6F, 18F, -6F); + Can4Side2.setTextureSize(128, 64); + Can4Side2.mirror = true; + setRotation(Can4Side2, 0F, 0F, 0F); + Can3Side4 = new ModelRenderer(this, 0, 0); + Can3Side4.addBox(0F, 0F, 0F, 1, 3, 2); + Can3Side4.setRotationPoint(2F, 18F, -5F); + Can3Side4.setTextureSize(128, 64); + Can3Side4.mirror = true; + setRotation(Can3Side4, 0F, 0F, 0F); + Can4B = new ModelRenderer(this, 0, 0); + Can4B.addBox(0F, 0F, 0F, 4, 1, 4); + Can4B.setRotationPoint(-6F, 21F, -6F); + Can4B.setTextureSize(128, 64); + Can4B.mirror = true; + setRotation(Can4B, 0F, 0F, 0F); + Can3Side2 = new ModelRenderer(this, 0, 0); + Can3Side2.addBox(0F, 0F, 0F, 4, 3, 1); + Can3Side2.setRotationPoint(2F, 18F, -6F); + Can3Side2.setTextureSize(128, 64); + Can3Side2.mirror = true; + setRotation(Can3Side2, 0F, 0F, 0F); + Can3Side1 = new ModelRenderer(this, 0, 0); + Can3Side1.addBox(0F, 0F, 0F, 4, 3, 1); + Can3Side1.setRotationPoint(2F, 18F, -3F); + Can3Side1.setTextureSize(128, 64); + Can3Side1.mirror = true; + setRotation(Can3Side1, 0F, 0F, 0F); + Can2B = new ModelRenderer(this, 0, 0); + Can2B.addBox(0F, 0F, 0F, 4, 1, 4); + Can2B.setRotationPoint(-6F, 21F, 2F); + Can2B.setTextureSize(128, 64); + Can2B.mirror = true; + setRotation(Can2B, 0F, 0F, 0F); + Can4T = new ModelRenderer(this, 0, 0); + Can4T.addBox(0F, 0F, 0F, 4, 1, 4); + Can4T.setRotationPoint(-6F, 17F, -6F); + Can4T.setTextureSize(128, 64); + Can4T.mirror = true; + setRotation(Can4T, 0F, 0F, 0F); + Can2T = new ModelRenderer(this, 0, 0); + Can2T.addBox(0F, 0F, 0F, 4, 1, 4); + Can2T.setRotationPoint(-6F, 17F, 2F); + Can2T.setTextureSize(128, 64); + Can2T.mirror = true; + setRotation(Can2T, 0F, 0F, 0F); + Can3T = new ModelRenderer(this, 0, 0); + Can3T.addBox(0F, 0F, 0F, 4, 1, 4); + Can3T.setRotationPoint(2F, 17F, -6F); + Can3T.setTextureSize(128, 64); + Can3T.mirror = true; + setRotation(Can3T, 0F, 0F, 0F); + Can3B = new ModelRenderer(this, 0, 0); + Can3B.addBox(0F, 0F, 0F, 4, 1, 4); + Can3B.setRotationPoint(2F, 21F, -6F); + Can3B.setTextureSize(128, 64); + Can3B.mirror = true; + setRotation(Can3B, 0F, 0F, 0F); + IO1 = new ModelRenderer(this, 9, 17); + IO1.addBox(0F, 0F, 0F, 1, 8, 8); + IO1.setRotationPoint(-8F, 12F, -4F); + IO1.setTextureSize(128, 64); + IO1.mirror = true; + setRotation(IO1, 0F, 0F, 0F); + IO2Port = new ModelRenderer(this, 28, 17); + IO2Port.addBox(0F, 0F, 0F, 2, 2, 4); + IO2Port.setRotationPoint(-7F, 14F, -2F); + IO2Port.setTextureSize(128, 64); + IO2Port.mirror = true; + setRotation(IO2Port, 0F, 0F, 0F); + IO2 = new ModelRenderer(this, 9, 17); + IO2.addBox(0F, 0F, 0F, 1, 8, 8); + IO2.setRotationPoint(7F, 12F, -4F); + IO2.setTextureSize(128, 64); + IO2.mirror = true; + setRotation(IO2, 0F, 0F, 0F); + IO2Port2 = new ModelRenderer(this, 28, 17); + IO2Port2.addBox(0F, 0F, 0F, 2, 2, 4); + IO2Port2.setRotationPoint(5F, 14F, -2F); + IO2Port2.setTextureSize(128, 64); + IO2Port2.mirror = true; + setRotation(IO2Port2, 0F, 0F, 0F); + Coil1 = new ModelRenderer(this, 0, 34); + Coil1.addBox(0F, 0F, 0F, 8, 1, 8); + Coil1.setRotationPoint(-4F, 14F, -4F); + Coil1.setTextureSize(128, 64); + Coil1.mirror = true; + setRotation(Coil1, 0F, 0F, 0F); + Coil2 = new ModelRenderer(this, 0, 34); + Coil2.addBox(0F, 0F, 0F, 8, 1, 8); + Coil2.setRotationPoint(-4F, 12F, -4F); + Coil2.setTextureSize(128, 64); + Coil2.mirror = true; + setRotation(Coil2, 0F, 0F, 0F); + Coil3 = new ModelRenderer(this, 0, 34); + Coil3.addBox(0F, 0F, 0F, 8, 1, 8); + Coil3.setRotationPoint(-4F, 10F, -4F); + Coil3.setTextureSize(128, 64); + Coil3.mirror = true; + setRotation(Coil3, 0F, 0F, 0F); + Coil4 = new ModelRenderer(this, 0, 34); + Coil4.addBox(0F, 0F, 0F, 8, 1, 8); + Coil4.setRotationPoint(-4F, 8F, -4F); + Coil4.setTextureSize(128, 64); + Coil4.mirror = true; + setRotation(Coil4, 0F, 0F, 0F); + } + + public void render(float size) + { + MekanismRenderer.blendOn(); + + Centre.render(size); + Base.render(size); + Base2.render(size); + Can1B.render(size); + Can1T.render(size); + Can1Side3.render(size); + Can1Side1.render(size); + Can1Side2.render(size); + Can1Side4.render(size); + Can2Side4.render(size); + Can3Side3.render(size); + Can2Side2.render(size); + Can2Side3.render(size); + Can2Side1.render(size); + Can4Side3.render(size); + Can4Side1.render(size); + Can4Sjde4.render(size); + Can4Side2.render(size); + Can3Side4.render(size); + Can4B.render(size); + Can3Side2.render(size); + Can3Side1.render(size); + Can2B.render(size); + Can4T.render(size); + Can2T.render(size); + Can3T.render(size); + Can3B.render(size); + IO1.render(size); + IO2Port.render(size); + IO2.render(size); + IO2Port2.render(size); + Coil1.render(size); + Coil2.render(size); + Coil3.render(size); + Coil4.render(size); + + MekanismRenderer.blendOff(); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/common/mekanism/client/model/ModelChemicalWasher.java b/common/mekanism/client/model/ModelChemicalWasher.java new file mode 100644 index 000000000..a8950cbe9 --- /dev/null +++ b/common/mekanism/client/model/ModelChemicalWasher.java @@ -0,0 +1,300 @@ +package mekanism.client.model; + +import mekanism.client.render.MekanismRenderer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class ModelChemicalWasher extends ModelBase +{ + ModelRenderer Base; + ModelRenderer Base2; + ModelRenderer IO1; + ModelRenderer IO2; + ModelRenderer IO3; + ModelRenderer Base3; + ModelRenderer Base4; + ModelRenderer Base5; + ModelRenderer Base6; + ModelRenderer Can1B; + ModelRenderer Can1T; + ModelRenderer Can1Side3; + ModelRenderer Can1Side1; + ModelRenderer Can1Side2; + ModelRenderer Can1Side4; + ModelRenderer Can2Side4; + ModelRenderer Can3Side3; + ModelRenderer Can2Side2; + ModelRenderer Can2Side3; + ModelRenderer Can2Side1; + ModelRenderer Can4Side3; + ModelRenderer Can4Side1; + ModelRenderer Can4Sjde4; + ModelRenderer Can4Side2; + ModelRenderer Can3Side4; + ModelRenderer Can4B; + ModelRenderer Can3Side2; + ModelRenderer Can3Side1; + ModelRenderer Can2B; + ModelRenderer Can4T; + ModelRenderer Can2T; + ModelRenderer Can3T; + ModelRenderer Can3B; + + public ModelChemicalWasher() + { + textureWidth = 128; + textureHeight = 64; + + Base = new ModelRenderer(this, 16, 0); + Base.addBox(0F, 0F, 0F, 14, 1, 14); + Base.setRotationPoint(-7F, 23F, -7F); + Base.setTextureSize(128, 64); + Base.mirror = true; + setRotation(Base, 0F, 0F, 0F); + Base2 = new ModelRenderer(this, 72, 0); + Base2.addBox(0F, 0F, 0F, 14, 10, 1); + Base2.setRotationPoint(-7F, 8F, 6F); + Base2.setTextureSize(128, 64); + Base2.mirror = true; + setRotation(Base2, 0F, 0F, 0F); + Base2.mirror = false; + IO1 = new ModelRenderer(this, 9, 17); + IO1.addBox(0F, 0F, 0F, 1, 8, 8); + IO1.setRotationPoint(-8F, 12F, -4F); + IO1.setTextureSize(128, 64); + IO1.mirror = true; + setRotation(IO1, 0F, 0F, 0F); + IO2 = new ModelRenderer(this, 9, 17); + IO2.addBox(0F, 0F, 0F, 1, 8, 8); + IO2.setRotationPoint(7F, 12F, -4F); + IO2.setTextureSize(128, 64); + IO2.mirror = true; + setRotation(IO2, 0F, 0F, 0F); + IO3 = new ModelRenderer(this, 0, 42); + IO3.addBox(0F, 0F, 0F, 12, 1, 8); + IO3.setRotationPoint(-6F, 8F, -4F); + IO3.setTextureSize(128, 64); + IO3.mirror = true; + setRotation(IO3, 0F, 0F, 0F); + Base3 = new ModelRenderer(this, 72, 0); + Base3.addBox(0F, 0F, 0F, 14, 10, 1); + Base3.setRotationPoint(-7F, 8F, -7F); + Base3.setTextureSize(128, 64); + Base3.mirror = true; + setRotation(Base3, 0F, 0F, 0F); + Base4 = new ModelRenderer(this, 72, 12); + Base4.addBox(0F, 0F, 0F, 1, 10, 12); + Base4.setRotationPoint(6F, 8F, -6F); + Base4.setTextureSize(128, 64); + Base4.mirror = true; + setRotation(Base4, 0F, 0F, 0F); + Base5 = new ModelRenderer(this, 72, 12); + Base5.addBox(0F, 0F, 0F, 1, 10, 12); + Base5.setRotationPoint(-7F, 8F, -6F); + Base5.setTextureSize(128, 64); + Base5.mirror = true; + setRotation(Base5, 0F, 0F, 0F); + Base6 = new ModelRenderer(this, 16, 0); + Base6.addBox(0F, 0F, 0F, 14, 1, 14); + Base6.setRotationPoint(-7F, 18F, -7F); + Base6.setTextureSize(128, 64); + Base6.mirror = true; + setRotation(Base6, 0F, 0F, 0F); + Can1B = new ModelRenderer(this, 0, 0); + Can1B.addBox(0F, 0F, 0F, 4, 1, 4); + Can1B.setRotationPoint(2F, 22F, 2F); + Can1B.setTextureSize(128, 64); + Can1B.mirror = true; + setRotation(Can1B, 0F, 0F, 0F); + Can1T = new ModelRenderer(this, 0, 0); + Can1T.addBox(0F, 0F, 0F, 4, 1, 4); + Can1T.setRotationPoint(2F, 19F, 2F); + Can1T.setTextureSize(128, 64); + Can1T.mirror = true; + setRotation(Can1T, 0F, 0F, 0F); + Can1Side3 = new ModelRenderer(this, 0, 0); + Can1Side3.addBox(0F, 0F, 0F, 1, 2, 2); + Can1Side3.setRotationPoint(5F, 20F, 3F); + Can1Side3.setTextureSize(128, 64); + Can1Side3.mirror = true; + setRotation(Can1Side3, 0F, 0F, 0F); + Can1Side1 = new ModelRenderer(this, 0, 0); + Can1Side1.addBox(0F, 0F, 0F, 4, 2, 1); + Can1Side1.setRotationPoint(2F, 20F, 5F); + Can1Side1.setTextureSize(128, 64); + Can1Side1.mirror = true; + setRotation(Can1Side1, 0F, 0F, 0F); + Can1Side2 = new ModelRenderer(this, 0, 0); + Can1Side2.addBox(0F, 0F, 0F, 4, 2, 1); + Can1Side2.setRotationPoint(2F, 20F, 2F); + Can1Side2.setTextureSize(128, 64); + Can1Side2.mirror = true; + setRotation(Can1Side2, 0F, 0F, 0F); + Can1Side4 = new ModelRenderer(this, 0, 0); + Can1Side4.addBox(0F, 0F, 0F, 1, 2, 2); + Can1Side4.setRotationPoint(2F, 20F, 3F); + Can1Side4.setTextureSize(128, 64); + Can1Side4.mirror = true; + setRotation(Can1Side4, 0F, 0F, 0F); + Can2Side4 = new ModelRenderer(this, 0, 0); + Can2Side4.addBox(0F, 0F, 0F, 1, 2, 2); + Can2Side4.setRotationPoint(-6F, 20F, 3F); + Can2Side4.setTextureSize(128, 64); + Can2Side4.mirror = true; + setRotation(Can2Side4, 0F, 0F, 0F); + Can3Side3 = new ModelRenderer(this, 0, 0); + Can3Side3.addBox(0F, 0F, 0F, 1, 2, 2); + Can3Side3.setRotationPoint(5F, 20F, -5F); + Can3Side3.setTextureSize(128, 64); + Can3Side3.mirror = true; + setRotation(Can3Side3, 0F, 0F, 0F); + Can2Side2 = new ModelRenderer(this, 0, 0); + Can2Side2.addBox(0F, 0F, 0F, 4, 2, 1); + Can2Side2.setRotationPoint(-6F, 20F, 2F); + Can2Side2.setTextureSize(128, 64); + Can2Side2.mirror = true; + setRotation(Can2Side2, 0F, 0F, 0F); + Can2Side3 = new ModelRenderer(this, 0, 0); + Can2Side3.addBox(0F, 0F, 0F, 1, 2, 2); + Can2Side3.setRotationPoint(-3F, 20F, 3F); + Can2Side3.setTextureSize(128, 64); + Can2Side3.mirror = true; + setRotation(Can2Side3, 0F, 0F, 0F); + Can2Side1 = new ModelRenderer(this, 0, 0); + Can2Side1.addBox(0F, 0F, 0F, 4, 2, 1); + Can2Side1.setRotationPoint(-6F, 20F, 5F); + Can2Side1.setTextureSize(128, 64); + Can2Side1.mirror = true; + setRotation(Can2Side1, 0F, 0F, 0F); + Can4Side3 = new ModelRenderer(this, 0, 0); + Can4Side3.addBox(0F, 0F, 0F, 1, 2, 2); + Can4Side3.setRotationPoint(-3F, 20F, -5F); + Can4Side3.setTextureSize(128, 64); + Can4Side3.mirror = true; + setRotation(Can4Side3, 0F, 0F, 0F); + Can4Side1 = new ModelRenderer(this, 0, 0); + Can4Side1.addBox(0F, 0F, 0F, 4, 2, 1); + Can4Side1.setRotationPoint(-6F, 20F, -3F); + Can4Side1.setTextureSize(128, 64); + Can4Side1.mirror = true; + setRotation(Can4Side1, 0F, 0F, 0F); + Can4Sjde4 = new ModelRenderer(this, 0, 0); + Can4Sjde4.addBox(0F, 0F, 0F, 1, 2, 2); + Can4Sjde4.setRotationPoint(-6F, 20F, -5F); + Can4Sjde4.setTextureSize(128, 64); + Can4Sjde4.mirror = true; + setRotation(Can4Sjde4, 0F, 0F, 0F); + Can4Side2 = new ModelRenderer(this, 0, 0); + Can4Side2.addBox(0F, 0F, 0F, 4, 2, 1); + Can4Side2.setRotationPoint(-6F, 20F, -6F); + Can4Side2.setTextureSize(128, 64); + Can4Side2.mirror = true; + setRotation(Can4Side2, 0F, 0F, 0F); + Can3Side4 = new ModelRenderer(this, 0, 0); + Can3Side4.addBox(0F, 0F, 0F, 1, 2, 2); + Can3Side4.setRotationPoint(2F, 20F, -5F); + Can3Side4.setTextureSize(128, 64); + Can3Side4.mirror = true; + setRotation(Can3Side4, 0F, 0F, 0F); + Can4B = new ModelRenderer(this, 0, 0); + Can4B.addBox(0F, 0F, 0F, 4, 1, 4); + Can4B.setRotationPoint(-6F, 22F, -6F); + Can4B.setTextureSize(128, 64); + Can4B.mirror = true; + setRotation(Can4B, 0F, 0F, 0F); + Can3Side2 = new ModelRenderer(this, 0, 0); + Can3Side2.addBox(0F, 0F, 0F, 4, 2, 1); + Can3Side2.setRotationPoint(2F, 20F, -6F); + Can3Side2.setTextureSize(128, 64); + Can3Side2.mirror = true; + setRotation(Can3Side2, 0F, 0F, 0F); + Can3Side1 = new ModelRenderer(this, 0, 0); + Can3Side1.addBox(0F, 0F, 0F, 4, 2, 1); + Can3Side1.setRotationPoint(2F, 20F, -3F); + Can3Side1.setTextureSize(128, 64); + Can3Side1.mirror = true; + setRotation(Can3Side1, 0F, 0F, 0F); + Can2B = new ModelRenderer(this, 0, 0); + Can2B.addBox(0F, 0F, 0F, 4, 1, 4); + Can2B.setRotationPoint(-6F, 22F, 2F); + Can2B.setTextureSize(128, 64); + Can2B.mirror = true; + setRotation(Can2B, 0F, 0F, 0F); + Can4T = new ModelRenderer(this, 0, 0); + Can4T.addBox(0F, 0F, 0F, 4, 1, 4); + Can4T.setRotationPoint(-6F, 19F, -6F); + Can4T.setTextureSize(128, 64); + Can4T.mirror = true; + setRotation(Can4T, 0F, 0F, 0F); + Can2T = new ModelRenderer(this, 0, 0); + Can2T.addBox(0F, 0F, 0F, 4, 1, 4); + Can2T.setRotationPoint(-6F, 19F, 2F); + Can2T.setTextureSize(128, 64); + Can2T.mirror = true; + setRotation(Can2T, 0F, 0F, 0F); + Can3T = new ModelRenderer(this, 0, 0); + Can3T.addBox(0F, 0F, 0F, 4, 1, 4); + Can3T.setRotationPoint(2F, 19F, -6F); + Can3T.setTextureSize(128, 64); + Can3T.mirror = true; + setRotation(Can3T, 0F, 0F, 0F); + Can3B = new ModelRenderer(this, 0, 0); + Can3B.addBox(0F, 0F, 0F, 4, 1, 4); + Can3B.setRotationPoint(2F, 22F, -6F); + Can3B.setTextureSize(128, 64); + Can3B.mirror = true; + setRotation(Can3B, 0F, 0F, 0F); + } + + public void render(float size) + { + MekanismRenderer.blendOn(); + + Base.render(size); + Base2.render(size); + IO1.render(size); + IO2.render(size); + IO3.render(size); + Base3.render(size); + Base4.render(size); + Base5.render(size); + Base6.render(size); + Can1B.render(size); + Can1T.render(size); + Can1Side3.render(size); + Can1Side1.render(size); + Can1Side2.render(size); + Can1Side4.render(size); + Can2Side4.render(size); + Can3Side3.render(size); + Can2Side2.render(size); + Can2Side3.render(size); + Can2Side1.render(size); + Can4Side3.render(size); + Can4Side1.render(size); + Can4Sjde4.render(size); + Can4Side2.render(size); + Can3Side4.render(size); + Can4B.render(size); + Can3Side2.render(size); + Can3Side1.render(size); + Can2B.render(size); + Can4T.render(size); + Can2T.render(size); + Can3T.render(size); + Can3B.render(size); + + MekanismRenderer.blendOff(); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/common/mekanism/client/nei/ChemicalCrystalizerRecipeHandler.java b/common/mekanism/client/nei/ChemicalCrystalizerRecipeHandler.java new file mode 100644 index 000000000..ddb223791 --- /dev/null +++ b/common/mekanism/client/nei/ChemicalCrystalizerRecipeHandler.java @@ -0,0 +1,6 @@ +package mekanism.client.nei; + +public class ChemicalCrystalizerRecipeHandler +{ + +} diff --git a/common/mekanism/client/nei/ChemicalDissolutionChamberRecipeHandler.java b/common/mekanism/client/nei/ChemicalDissolutionChamberRecipeHandler.java new file mode 100644 index 000000000..e83b14735 --- /dev/null +++ b/common/mekanism/client/nei/ChemicalDissolutionChamberRecipeHandler.java @@ -0,0 +1,6 @@ +package mekanism.client.nei; + +public class ChemicalDissolutionChamberRecipeHandler +{ + +} diff --git a/common/mekanism/client/nei/ChemicalWasherRecipeHandler.java b/common/mekanism/client/nei/ChemicalWasherRecipeHandler.java new file mode 100644 index 000000000..6504262e8 --- /dev/null +++ b/common/mekanism/client/nei/ChemicalWasherRecipeHandler.java @@ -0,0 +1,6 @@ +package mekanism.client.nei; + +public class ChemicalWasherRecipeHandler +{ + +} diff --git a/common/mekanism/client/render/block/MachineRenderingHandler.java b/common/mekanism/client/render/block/MachineRenderingHandler.java index 32edbf6f8..63b81aa3b 100644 --- a/common/mekanism/client/render/block/MachineRenderingHandler.java +++ b/common/mekanism/client/render/block/MachineRenderingHandler.java @@ -1,10 +1,18 @@ package mekanism.client.render.block; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import mekanism.client.ClientProxy; -import mekanism.client.model.*; +import mekanism.client.model.ModelChargepad; +import mekanism.client.model.ModelChemicalCrystalizer; +import mekanism.client.model.ModelChemicalDissolutionChamber; +import mekanism.client.model.ModelChemicalInfuser; +import mekanism.client.model.ModelChemicalOxidizer; +import mekanism.client.model.ModelChemicalWasher; +import mekanism.client.model.ModelDigitalMiner; +import mekanism.client.model.ModelElectricPump; +import mekanism.client.model.ModelElectrolyticSeparator; +import mekanism.client.model.ModelLogisticalSorter; +import mekanism.client.model.ModelMetallurgicInfuser; +import mekanism.client.model.ModelRotaryCondensentrator; import mekanism.client.render.MekanismRenderer; import mekanism.common.block.BlockMachine.MachineType; import mekanism.common.util.MekanismUtils; @@ -13,8 +21,13 @@ import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.world.IBlockAccess; + import org.lwjgl.opengl.GL11; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) public class MachineRenderingHandler implements ISimpleBlockRenderingHandler { @@ -27,7 +40,9 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler public ModelChemicalOxidizer chemicalOxidizer = new ModelChemicalOxidizer(); public ModelChemicalInfuser chemicalInfuser = new ModelChemicalInfuser(); public ModelElectrolyticSeparator electrolyticSeparator = new ModelElectrolyticSeparator(); - + public ModelChemicalDissolutionChamber chemicalDissolutionChamber = new ModelChemicalDissolutionChamber(); + public ModelChemicalWasher chemicalWasher = new ModelChemicalWasher(); + public ModelChemicalCrystalizer chemicalCrystalizer = new ModelChemicalCrystalizer(); @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) @@ -114,6 +129,30 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ElectrolyticSeparator.png")); electrolyticSeparator.render(0.0625F); } + else if(type == MachineType.CHEMICAL_DISSOLUTION_CHAMBER) + { + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(270F, 0.0F, -1.0F, 0.0F); + GL11.glTranslatef(0.0F, -1.06F, 0.05F); + Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ChemicalDissolutionChamber.png")); + chemicalDissolutionChamber.render(0.0625F); + } + else if(type == MachineType.CHEMICAL_WASHER) + { + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(270F, 0.0F, -1.0F, 0.0F); + GL11.glTranslatef(0.0F, -1.06F, 0.05F); + Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ChemicalWasher.png")); + chemicalWasher.render(0.0625F); + } + else if(type == MachineType.CHEMICAL_CRYSTALIZER) + { + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(270F, 0.0F, -1.0F, 0.0F); + GL11.glTranslatef(0.0F, -1.06F, 0.05F); + Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ChemicalCrystalizer.png")); + chemicalCrystalizer.render(0.0625F); + } else { MekanismRenderer.renderItem(renderer, metadata, block); } diff --git a/common/mekanism/client/render/tileentity/RenderChemicalCrystalizer.java b/common/mekanism/client/render/tileentity/RenderChemicalCrystalizer.java new file mode 100644 index 000000000..8ce35ab8e --- /dev/null +++ b/common/mekanism/client/render/tileentity/RenderChemicalCrystalizer.java @@ -0,0 +1,44 @@ +package mekanism.client.render.tileentity; + +import mekanism.client.model.ModelChemicalCrystalizer; +import mekanism.common.tile.TileEntityChemicalCrystalizer; +import mekanism.common.util.MekanismUtils; +import mekanism.common.util.MekanismUtils.ResourceType; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class RenderChemicalCrystalizer extends TileEntitySpecialRenderer +{ + private ModelChemicalCrystalizer model = new ModelChemicalCrystalizer(); + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) + { + renderAModelAt((TileEntityChemicalCrystalizer)tileEntity, x, y, z, partialTick); + } + + private void renderAModelAt(TileEntityChemicalCrystalizer 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, "ChemicalCrystalizer.png")); + + switch(tileEntity.facing) + { + case 2: GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); break; + case 3: GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); break; + case 4: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break; + case 5: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break; + } + + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + model.render(0.0625F); + GL11.glPopMatrix(); + } +} diff --git a/common/mekanism/client/render/tileentity/RenderChemicalDissolutionChamber.java b/common/mekanism/client/render/tileentity/RenderChemicalDissolutionChamber.java new file mode 100644 index 000000000..9d9ceb2ae --- /dev/null +++ b/common/mekanism/client/render/tileentity/RenderChemicalDissolutionChamber.java @@ -0,0 +1,44 @@ +package mekanism.client.render.tileentity; + +import mekanism.client.model.ModelChemicalDissolutionChamber; +import mekanism.common.tile.TileEntityChemicalDissolutionChamber; +import mekanism.common.util.MekanismUtils; +import mekanism.common.util.MekanismUtils.ResourceType; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class RenderChemicalDissolutionChamber extends TileEntitySpecialRenderer +{ + private ModelChemicalDissolutionChamber model = new ModelChemicalDissolutionChamber(); + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) + { + renderAModelAt((TileEntityChemicalDissolutionChamber)tileEntity, x, y, z, partialTick); + } + + private void renderAModelAt(TileEntityChemicalDissolutionChamber 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, "ChemicalDissolutionChamber.png")); + + switch(tileEntity.facing) + { + case 2: GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); break; + case 3: GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); break; + case 4: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break; + case 5: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break; + } + + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + model.render(0.0625F); + GL11.glPopMatrix(); + } +} diff --git a/common/mekanism/client/render/tileentity/RenderChemicalWasher.java b/common/mekanism/client/render/tileentity/RenderChemicalWasher.java new file mode 100644 index 000000000..89a16cf9f --- /dev/null +++ b/common/mekanism/client/render/tileentity/RenderChemicalWasher.java @@ -0,0 +1,40 @@ +package mekanism.client.render.tileentity; + +import mekanism.client.model.ModelChemicalWasher; +import mekanism.common.tile.TileEntityChemicalWasher; +import mekanism.common.util.MekanismUtils; +import mekanism.common.util.MekanismUtils.ResourceType; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; + +import org.lwjgl.opengl.GL11; + +public class RenderChemicalWasher extends TileEntitySpecialRenderer +{ + private ModelChemicalWasher model = new ModelChemicalWasher(); + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) + { + renderAModelAt((TileEntityChemicalWasher)tileEntity, x, y, z, partialTick); + } + + private void renderAModelAt(TileEntityChemicalWasher 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, "ChemicalWasher.png")); + + switch(tileEntity.facing) + { + case 2: GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); break; + case 3: GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); break; + case 4: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break; + case 5: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break; + } + + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + model.render(0.0625F); + GL11.glPopMatrix(); + } +} diff --git a/common/mekanism/common/CommonProxy.java b/common/mekanism/common/CommonProxy.java index 12be3a848..effb0cf36 100644 --- a/common/mekanism/common/CommonProxy.java +++ b/common/mekanism/common/CommonProxy.java @@ -33,9 +33,12 @@ import mekanism.common.tile.TileEntityAdvancedFactory; import mekanism.common.tile.TileEntityBin; import mekanism.common.tile.TileEntityChanceMachine; import mekanism.common.tile.TileEntityChargepad; +import mekanism.common.tile.TileEntityChemicalCrystalizer; +import mekanism.common.tile.TileEntityChemicalDissolutionChamber; import mekanism.common.tile.TileEntityChemicalInfuser; import mekanism.common.tile.TileEntityChemicalInjectionChamber; import mekanism.common.tile.TileEntityChemicalOxidizer; +import mekanism.common.tile.TileEntityChemicalWasher; import mekanism.common.tile.TileEntityCombiner; import mekanism.common.tile.TileEntityContainerBlock; import mekanism.common.tile.TileEntityCrusher; @@ -118,6 +121,9 @@ public class CommonProxy GameRegistry.registerTileEntity(TileEntitySalinationValve.class, "SalinationValve"); GameRegistry.registerTileEntity(TileEntitySalinationTank.class, "SalinationTank"); GameRegistry.registerTileEntity(TileEntityPrecisionSawmill.class, "PrecisionSawmill"); + GameRegistry.registerTileEntity(TileEntityChemicalDissolutionChamber.class, "ChemicalDissolutionChamber"); + GameRegistry.registerTileEntity(TileEntityChemicalWasher.class, "ChemicalWasher"); + GameRegistry.registerTileEntity(TileEntityChemicalCrystalizer.class, "ChemicalCrystalizer"); } /** @@ -229,6 +235,9 @@ public class CommonProxy Mekanism.chemicalInjectionChamberUsage = Mekanism.configuration.get("usage", "ChemicalInjectionChamberUsage", 400D).getDouble(400D); Mekanism.electrolyticSeparatorUsage = Mekanism.configuration.get("usage", "ElectrolyticSeparatorUsage", 50D).getDouble(50D); Mekanism.precisionSawmillUsage = Mekanism.configuration.get("usage", "PrecisionSawmillUsage", 50D).getDouble(50D); + Mekanism.chemicalDissolutionChamberUsage = Mekanism.configuration.get("usage", "ChemicalDissolutionChamberUsage", 400D).getDouble(400D); + Mekanism.chemicalWasherUsage = Mekanism.configuration.get("usage", "ChemicalWasherUsage", 200D).getDouble(200D); + Mekanism.chemicalCrystalizerUsage = Mekanism.configuration.get("usage", "ChemicalCrystalizerUsage", 400D).getDouble(400D); Mekanism.configuration.save(); } diff --git a/common/mekanism/common/Mekanism.java b/common/mekanism/common/Mekanism.java index efb1d221f..7993bee47 100644 --- a/common/mekanism/common/Mekanism.java +++ b/common/mekanism/common/Mekanism.java @@ -323,6 +323,9 @@ public class Mekanism public static double chemicalInjectionChamberUsage; public static double electrolyticSeparatorUsage; public static double precisionSawmillUsage; + public static double chemicalDissolutionChamberUsage; + public static double chemicalWasherUsage; + public static double chemicalCrystalizerUsage; /** * Adds all in-game crafting and smelting recipes. @@ -568,10 +571,10 @@ public class Mekanism "ETE", Character.valueOf('E'), EnrichedAlloy, Character.valueOf('T'), new ItemStack(PartTransmitter, 1, 0) })); CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(PartTransmitter, 1, 2), new Object[] { - "CTC", Character.valueOf('C'), "circuitBasic", Character.valueOf('T'), new ItemStack(PartTransmitter, 1, 1) + "CTC", Character.valueOf('C'), "circuitBasic", Character.valueOf('T'), new ItemStack(PartTransmitter, 1, 0) })); CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(PartTransmitter, 1, 3), new Object[] { - "CTC", Character.valueOf('C'), AtomicCore, Character.valueOf('T'), new ItemStack(PartTransmitter, 1, 2) + "CTC", Character.valueOf('C'), AtomicCore, Character.valueOf('T'), new ItemStack(PartTransmitter, 1, 0) })); CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(PartTransmitter, 8, 4), new Object[] { "SBS", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Item.bucketEmpty @@ -706,6 +709,18 @@ 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("brine", 10), new ChemicalPair(new GasStack(GasRegistry.getGas("hydrogen"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1))); + + //Chemical Washer Recipes + for(Gas gas : GasRegistry.getRegisteredGasses()) + { + if(gas instanceof OreGas && !((OreGas)gas).isClean()) + { + OreGas oreGas = (OreGas)gas; + + RecipeHandler.addChemicalWasherRecipe(new GasStack(oreGas, 1), new GasStack(oreGas.getCleanGas(), 1)); + RecipeHandler.addChemicalCrystalizerRecipe(new GasStack(oreGas, 200), new ItemStack(Crystal, 1, Resource.getFromName(oreGas.getName()).ordinal())); + } + } //Infuse objects InfuseRegistry.registerInfuseObject(new ItemStack(Item.coal, 1, 0), new InfuseObject(InfuseRegistry.get("CARBON"), 10)); @@ -1068,8 +1083,8 @@ public class Mekanism { String name = resource.getName(); - GasRegistry.register(new OreGas(name.toLowerCase(), "oregas." + name.toLowerCase()).setVisible(false)); - GasRegistry.register(new OreGas("clean" + name, "oregas." + name.toLowerCase()).setVisible(false)); + OreGas clean = (OreGas)GasRegistry.register(new OreGas("clean" + name, "oregas." + name.toLowerCase()).setVisible(false)); + GasRegistry.register(new OreGas(name.toLowerCase(), "oregas." + name.toLowerCase()).setCleanGas(clean).setVisible(false)); } FluidRegistry.registerFluid(new Fluid("brine")); diff --git a/common/mekanism/common/Resource.java b/common/mekanism/common/Resource.java index 969b99356..faf554fec 100644 --- a/common/mekanism/common/Resource.java +++ b/common/mekanism/common/Resource.java @@ -18,6 +18,19 @@ public enum Resource name = s; } + public static Resource getFromName(String s) + { + for(Resource r : values()) + { + if(r.name.toLowerCase().equals(s.toLowerCase())) + { + return r; + } + } + + return null; + } + public String getName() { return name; diff --git a/common/mekanism/common/block/BlockMachine.java b/common/mekanism/common/block/BlockMachine.java index 60f209a04..292611568 100644 --- a/common/mekanism/common/block/BlockMachine.java +++ b/common/mekanism/common/block/BlockMachine.java @@ -29,9 +29,12 @@ import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket; import mekanism.common.tile.TileEntityAdvancedFactory; import mekanism.common.tile.TileEntityBasicBlock; import mekanism.common.tile.TileEntityChargepad; +import mekanism.common.tile.TileEntityChemicalCrystalizer; +import mekanism.common.tile.TileEntityChemicalDissolutionChamber; import mekanism.common.tile.TileEntityChemicalInfuser; import mekanism.common.tile.TileEntityChemicalInjectionChamber; import mekanism.common.tile.TileEntityChemicalOxidizer; +import mekanism.common.tile.TileEntityChemicalWasher; import mekanism.common.tile.TileEntityCombiner; import mekanism.common.tile.TileEntityContainerBlock; import mekanism.common.tile.TileEntityCrusher; @@ -104,6 +107,9 @@ import cpw.mods.fml.relauncher.SideOnly; * 1:3: Chemical Injection Chamber * 1:4: Electrolytic Separator * 1:5: Precision Sawmill + * 1:6: Chemical Dissolution Chamber + * 1:7: Chemical Washer + * 1:8: Chemical Crystalizer * @author AidanBrady * */ @@ -1093,7 +1099,10 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds CHEMICAL_INFUSER(Mekanism.machineBlock2ID, 2, "ChemicalInfuser", 30, 20000, TileEntityChemicalInfuser.class, true, false), CHEMICAL_INJECTION_CHAMBER(Mekanism.machineBlock2ID, 3, "ChemicalInjectionChamber", 31, Mekanism.chemicalInjectionChamberUsage*400, TileEntityChemicalInjectionChamber.class, false, true), ELECTROLYTIC_SEPARATOR(Mekanism.machineBlock2ID, 4, "ElectrolyticSeparator", 32, 20000, TileEntityElectrolyticSeparator.class, true, false), - PRECISION_SAWMILL(Mekanism.machineBlock2ID, 5, "PrecisionSawmill", 34, Mekanism.precisionSawmillUsage*400, TileEntityPrecisionSawmill.class, false, true); + PRECISION_SAWMILL(Mekanism.machineBlock2ID, 5, "PrecisionSawmill", 34, Mekanism.precisionSawmillUsage*400, TileEntityPrecisionSawmill.class, false, true), + CHEMICAL_DISSOLUTION_CHAMBER(Mekanism.machineBlock2ID, 6, "ChemicalDissolutionChamber", -1, 20000, TileEntityChemicalDissolutionChamber.class, true, false), + CHEMICAL_WASHER(Mekanism.machineBlock2ID, 7, "ChemicalWasher", -1, 20000, TileEntityChemicalWasher.class, true, false), + CHEMICAL_CRYSTALIZER(Mekanism.machineBlock2ID, 8, "ChemicalCrystalizer", -1, 20000, TileEntityChemicalCrystalizer.class, true, false); public int typeId; public int meta; diff --git a/common/mekanism/common/integration/OreDictManager.java b/common/mekanism/common/integration/OreDictManager.java index e63529286..ea4cf4939 100644 --- a/common/mekanism/common/integration/OreDictManager.java +++ b/common/mekanism/common/integration/OreDictManager.java @@ -220,6 +220,7 @@ public final class OreDictManager RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Dust, 2, 6)); RecipeHandler.addPurificationChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Clump, 3, 3)); RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(Mekanism.Shard, 4, 3)); + RecipeHandler.addChemicalDissolutionChamberRecipe(MekanismUtils.size(ore, 1), new GasStack(GasRegistry.getGas("copper"), 1000)); } for(ItemStack ore : OreDictionary.getOres("oreTin")) @@ -227,6 +228,7 @@ public final class OreDictManager RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Dust, 2, 7)); RecipeHandler.addPurificationChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Clump, 3, 4)); RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(Mekanism.Shard, 4, 4)); + RecipeHandler.addChemicalDissolutionChamberRecipe(MekanismUtils.size(ore, 1), new GasStack(GasRegistry.getGas("tin"), 1000)); } for(ItemStack ore : OreDictionary.getOres("oreOsmium")) @@ -234,6 +236,7 @@ public final class OreDictManager RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Dust, 2, 2)); RecipeHandler.addPurificationChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Clump, 3, 2)); RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(Mekanism.Shard, 4, 2)); + RecipeHandler.addChemicalDissolutionChamberRecipe(MekanismUtils.size(ore, 1), new GasStack(GasRegistry.getGas("osmium"), 1000)); } for(ItemStack ore : OreDictionary.getOres("oreIron")) @@ -241,6 +244,7 @@ public final class OreDictManager RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Dust, 2, 0)); RecipeHandler.addPurificationChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Clump, 3, 0)); RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(Mekanism.Shard, 4, 0)); + RecipeHandler.addChemicalDissolutionChamberRecipe(MekanismUtils.size(ore, 1), new GasStack(GasRegistry.getGas("iron"), 1000)); } for(ItemStack ore : OreDictionary.getOres("oreGold")) @@ -248,6 +252,7 @@ public final class OreDictManager RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Dust, 2, 1)); RecipeHandler.addPurificationChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Clump, 3, 1)); RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(Mekanism.Shard, 4, 1)); + RecipeHandler.addChemicalDissolutionChamberRecipe(MekanismUtils.size(ore, 1), new GasStack(GasRegistry.getGas("gold"), 1000)); } for(ItemStack ore : OreDictionary.getOres("oreSilver")) @@ -255,6 +260,7 @@ public final class OreDictManager RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Dust, 2, 8)); RecipeHandler.addPurificationChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Clump, 3, 5)); RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(Mekanism.Shard, 4, 5)); + RecipeHandler.addChemicalDissolutionChamberRecipe(MekanismUtils.size(ore, 1), new GasStack(GasRegistry.getGas("silver"), 1000)); } for(ItemStack ore : OreDictionary.getOres("oreLead")) @@ -262,6 +268,7 @@ public final class OreDictManager RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Dust, 2, 9)); RecipeHandler.addPurificationChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Clump, 3, 7)); RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(Mekanism.Shard, 4, 7)); + RecipeHandler.addChemicalDissolutionChamberRecipe(MekanismUtils.size(ore, 1), new GasStack(GasRegistry.getGas("lead"), 1000)); } for(ItemStack ore : OreDictionary.getOres("oreNickel")) diff --git a/common/mekanism/common/inventory/container/ContainerChemicalCrystalizer.java b/common/mekanism/common/inventory/container/ContainerChemicalCrystalizer.java new file mode 100644 index 000000000..054538695 --- /dev/null +++ b/common/mekanism/common/inventory/container/ContainerChemicalCrystalizer.java @@ -0,0 +1,6 @@ +package mekanism.common.inventory.container; + +public class ContainerChemicalCrystalizer +{ + +} diff --git a/common/mekanism/common/inventory/container/ContainerChemicalDissolutionChamber.java b/common/mekanism/common/inventory/container/ContainerChemicalDissolutionChamber.java new file mode 100644 index 000000000..0623cda71 --- /dev/null +++ b/common/mekanism/common/inventory/container/ContainerChemicalDissolutionChamber.java @@ -0,0 +1,6 @@ +package mekanism.common.inventory.container; + +public class ContainerChemicalDissolutionChamber +{ + +} diff --git a/common/mekanism/common/inventory/container/ContainerChemicalOxidizer.java b/common/mekanism/common/inventory/container/ContainerChemicalOxidizer.java index 3c1aa674e..3735c09fe 100644 --- a/common/mekanism/common/inventory/container/ContainerChemicalOxidizer.java +++ b/common/mekanism/common/inventory/container/ContainerChemicalOxidizer.java @@ -4,6 +4,7 @@ import mekanism.api.gas.IGasItem; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; import mekanism.common.inventory.slot.SlotStorageTank; import mekanism.common.recipe.RecipeHandler; +import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.tile.TileEntityChemicalOxidizer; import mekanism.common.util.ChargeUtils; import net.minecraft.entity.player.EntityPlayer; @@ -68,7 +69,7 @@ public class ContainerChemicalOxidizer extends Container ItemStack slotStack = currentSlot.getStack(); stack = slotStack.copy(); - if(RecipeHandler.getChemicalOxidizerOutput(slotStack, false) != null) + if(RecipeHandler.getItemToGasOutput(slotStack, false, Recipe.CHEMICAL_OXIDIZER.get()) != null) { if(!mergeItemStack(slotStack, 0, 1, true)) { diff --git a/common/mekanism/common/inventory/container/ContainerChemicalWasher.java b/common/mekanism/common/inventory/container/ContainerChemicalWasher.java new file mode 100644 index 000000000..4ee70b7a5 --- /dev/null +++ b/common/mekanism/common/inventory/container/ContainerChemicalWasher.java @@ -0,0 +1,6 @@ +package mekanism.common.inventory.container; + +public class ContainerChemicalWasher +{ + +} diff --git a/common/mekanism/common/item/ItemBlockMachine.java b/common/mekanism/common/item/ItemBlockMachine.java index 6ef768f34..486cd09df 100644 --- a/common/mekanism/common/item/ItemBlockMachine.java +++ b/common/mekanism/common/item/ItemBlockMachine.java @@ -76,6 +76,9 @@ import cpw.mods.fml.relauncher.SideOnly; * 1:3: Chemical Injection Chamber * 1:4: Electrolytic Separator * 1:5: Precision Sawmill + * 1:6: Chemical Dissolution Chamber + * 1:7: Chemical Washer + * 1:8: Chemical Crystalizer * @author AidanBrady * */ diff --git a/common/mekanism/common/network/PacketConfigSync.java b/common/mekanism/common/network/PacketConfigSync.java index fef2ef7e6..70d21a688 100644 --- a/common/mekanism/common/network/PacketConfigSync.java +++ b/common/mekanism/common/network/PacketConfigSync.java @@ -70,6 +70,9 @@ public class PacketConfigSync implements IMekanismPacket Mekanism.chemicalInjectionChamberUsage = dataStream.readDouble(); Mekanism.electrolyticSeparatorUsage = dataStream.readDouble(); Mekanism.precisionSawmillUsage = dataStream.readDouble(); + Mekanism.chemicalDissolutionChamberUsage = dataStream.readDouble(); + Mekanism.chemicalWasherUsage = dataStream.readDouble(); + Mekanism.chemicalCrystalizerUsage = dataStream.readDouble(); for(IModule module : Mekanism.modulesLoaded) { @@ -123,6 +126,9 @@ public class PacketConfigSync implements IMekanismPacket dataStream.writeDouble(Mekanism.chemicalInjectionChamberUsage); dataStream.writeDouble(Mekanism.electrolyticSeparatorUsage); dataStream.writeDouble(Mekanism.precisionSawmillUsage); + dataStream.writeDouble(Mekanism.chemicalDissolutionChamberUsage); + dataStream.writeDouble(Mekanism.chemicalWasherUsage); + dataStream.writeDouble(Mekanism.chemicalCrystalizerUsage); for(IModule module : Mekanism.modulesLoaded) { diff --git a/common/mekanism/common/recipe/RecipeHandler.java b/common/mekanism/common/recipe/RecipeHandler.java index e918faa6c..41936fc8f 100644 --- a/common/mekanism/common/recipe/RecipeHandler.java +++ b/common/mekanism/common/recipe/RecipeHandler.java @@ -6,6 +6,7 @@ import java.util.Map; import mekanism.api.AdvancedInput; import mekanism.api.ChanceOutput; import mekanism.api.ChemicalPair; +import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; @@ -138,6 +139,36 @@ public final class RecipeHandler { Recipe.PRECISION_SAWMILL.put(input, output); } + + /** + * Add a Chemical Dissolution Chamber recipe. + * @param input - input ItemStack + * @param output - output GasStack + */ + public static void addChemicalDissolutionChamberRecipe(ItemStack input, GasStack output) + { + Recipe.CHEMICAL_DISSOLUTION_CHAMBER.put(input, output); + } + + /** + * Add a Chemical Washer recipe. + * @param input - input GasStack + * @param output - output GasStack + */ + public static void addChemicalWasherRecipe(GasStack input, GasStack output) + { + Recipe.CHEMICAL_WASHER.put(input, output); + } + + /** + * Add a Chemical Crystalizer recipe. + * @param input - input GasStack + * @param output - output ItemStack + */ + public static void addChemicalCrystalizerRecipe(GasStack input, ItemStack output) + { + Recipe.CHEMICAL_CRYSTALIZER.put(input, output); + } /** * Gets the InfusionOutput of the InfusionInput in the parameters. @@ -206,19 +237,77 @@ public final class RecipeHandler return null; } + + /** + * Gets the Chemical Crystalizer ItemStack output of the defined GasTank input. + * @param itemstack - input GasTank + * @param removeGas - whether or not to use gas in the gas tank + * @return output ItemStack + */ + public static ItemStack getChemicalCrystalizerOutput(GasTank gasTank, boolean removeGas) + { + GasStack gas = gasTank.getGas(); + + if(gas != null) + { + HashMap recipes = Recipe.CHEMICAL_CRYSTALIZER.get(); + + for(Map.Entry entry : recipes.entrySet()) + { + GasStack key = (GasStack)entry.getKey(); + + if(key != null && key.getGas() == gas.getGas() && key.amount >= gas.amount) + { + gasTank.draw(key.amount, removeGas); + + return entry.getValue().copy(); + } + } + } + + return null; + } + + /** + * Gets the Chemical Washer GasStack output of the defined GasTank input. + * @param gasTank - input GasTank + * @param removeGas - whether or not to use gas in the gas tank + * @return output GasStack + */ + public static GasStack getChemicalWasherOutput(GasTank gasTank, boolean removeGas) + { + GasStack gas = gasTank.getGas(); + + if(gas != null) + { + HashMap recipes = Recipe.CHEMICAL_WASHER.get(); + + for(Map.Entry entry : recipes.entrySet()) + { + GasStack key = (GasStack)entry.getKey(); + + if(key != null && key.getGas() == gas.getGas() && key.amount >= gas.amount) + { + gasTank.draw(key.amount, removeGas); + + return entry.getValue().copy(); + } + } + } + + return null; + } /** - * Gets the InfusionOutput of the ItemStack in the parameters. + * Gets the GasStack of the ItemStack in the parameters using a defined map. * @param itemstack - input ItemStack * @param stackDecrease - whether or not to decrease the input slot's stack size * @return output GasStack */ - public static GasStack getChemicalOxidizerOutput(ItemStack itemstack, boolean stackDecrease) + public static GasStack getItemToGasOutput(ItemStack itemstack, boolean stackDecrease, HashMap recipes) { if(itemstack != null) { - HashMap recipes = Recipe.CHEMICAL_OXIDIZER.get(); - for(Map.Entry entry : recipes.entrySet()) { ItemStack stack = (ItemStack)entry.getKey(); @@ -325,30 +414,6 @@ public final class RecipeHandler return null; } - /** - * Gets the output ItemStack of the ItemStack in the parameters. - * @param itemstack - input ItemStack - * @param recipes - Map of recipes - * @return whether the item can be used in a recipe - */ - public static boolean isInRecipe(ItemStack itemstack, Map recipes) - { - if(itemstack != null) - { - for(Map.Entry entry : recipes.entrySet()) - { - ItemStack stack = (ItemStack)entry.getKey(); - - if(StackUtils.equalsWildcard(stack, itemstack)) - { - return true; - } - } - } - - return false; - } - /** * Get the result of electrolysing a given fluid * @param fluidTank - the FluidTank to electrolyse fluid from @@ -376,6 +441,30 @@ public final class RecipeHandler return null; } + + /** + * Gets the output ItemStack of the ItemStack in the parameters. + * @param itemstack - input ItemStack + * @param recipes - Map of recipes + * @return whether the item can be used in a recipe + */ + public static boolean isInRecipe(ItemStack itemstack, Map recipes) + { + if(itemstack != null) + { + for(Map.Entry entry : recipes.entrySet()) + { + ItemStack stack = (ItemStack)entry.getKey(); + + if(StackUtils.equalsWildcard(stack, itemstack)) + { + return true; + } + } + } + + return false; + } public static enum Recipe { @@ -389,7 +478,10 @@ public final class RecipeHandler CHEMICAL_OXIDIZER(new HashMap()), CHEMICAL_INJECTION_CHAMBER(new HashMap()), ELECTROLYTIC_SEPARATOR(new HashMap()), - PRECISION_SAWMILL(new HashMap()); + PRECISION_SAWMILL(new HashMap()), + CHEMICAL_DISSOLUTION_CHAMBER(new HashMap()), + CHEMICAL_WASHER(new HashMap()), + CHEMICAL_CRYSTALIZER(new HashMap()); private HashMap recipes; diff --git a/common/mekanism/common/tile/TileEntityChemicalCrystalizer.java b/common/mekanism/common/tile/TileEntityChemicalCrystalizer.java new file mode 100644 index 000000000..de4d37b23 --- /dev/null +++ b/common/mekanism/common/tile/TileEntityChemicalCrystalizer.java @@ -0,0 +1,428 @@ +package mekanism.common.tile; + +import java.util.ArrayList; + +import mekanism.api.Coord4D; +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; +import mekanism.api.gas.ITubeConnection; +import mekanism.client.sound.IHasSound; +import mekanism.common.IActiveState; +import mekanism.common.IRedstoneControl; +import mekanism.common.Mekanism; +import mekanism.common.PacketHandler; +import mekanism.common.PacketHandler.Transmission; +import mekanism.common.block.BlockMachine.MachineType; +import mekanism.common.network.PacketTileEntity; +import mekanism.common.recipe.RecipeHandler; +import mekanism.common.util.ChargeUtils; +import mekanism.common.util.InventoryUtils; +import mekanism.common.util.MekanismUtils; +import mekanism.common.util.PipeUtils; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; + +import com.google.common.io.ByteArrayDataInput; + +public class TileEntityChemicalCrystalizer extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IHasSound +{ + public GasTank inputTank = new GasTank(MAX_GAS); + + public static final int MAX_GAS = 10000; + public static final int MAX_FLUID = 10000; + + public static int WATER_USAGE = 5; + + public int updateDelay; + + public int gasOutput = 16; + + public int operatingTicks; + + public int TICKS_REQUIRED = 200; + + public boolean isActive; + + public boolean clientActive; + + public double prevEnergy; + + public final double ENERGY_USAGE = Mekanism.chemicalCrystalizerUsage; + + /** This machine's current RedstoneControl type. */ + public RedstoneControl controlType = RedstoneControl.DISABLED; + + public TileEntityChemicalCrystalizer() + { + super("ChemicalCrystalizer", MachineType.CHEMICAL_CRYSTALIZER.baseEnergy); + inventory = new ItemStack[3]; + } + + @Override + public void onUpdate() + { + if(worldObj.isRemote) + { + Mekanism.proxy.registerSound(this); + + if(updateDelay > 0) + { + updateDelay--; + + if(updateDelay == 0 && clientActive != isActive) + { + isActive = clientActive; + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } + } + } + + if(!worldObj.isRemote) + { + if(updateDelay > 0) + { + updateDelay--; + + if(updateDelay == 0 && clientActive != isActive) + { + PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTileEntity().setParams(Coord4D.get(this), getNetworkedData(new ArrayList()))); + } + } + + ChargeUtils.discharge(2, this); + + if(inventory[0] != null && (inputTank.getGas() == null || inputTank.getStored() < inputTank.getMaxGas())) + { + inputTank.receive(GasTransmission.removeGas(inventory[0], null, inputTank.getNeeded()), true); + } + + if(canOperate() && MekanismUtils.canFunction(this) && getEnergy() >= ENERGY_USAGE) + { + setActive(true); + + if((operatingTicks+1) < TICKS_REQUIRED) + { + operatingTicks++; + setEnergy(getEnergy() - ENERGY_USAGE); + } + else if((operatingTicks+1) >= TICKS_REQUIRED) + { + operate(); + + operatingTicks = 0; + setEnergy(getEnergy() - ENERGY_USAGE); + } + } + else { + if(prevEnergy >= getEnergy()) + { + setActive(false); + } + } + + if(!canOperate()) + { + operatingTicks = 0; + } + + prevEnergy = getEnergy(); + } + } + + public boolean canOperate() + { + if(inputTank.getGas() == null) + { + return false; + } + + ItemStack itemstack = RecipeHandler.getChemicalCrystalizerOutput(inputTank, false); + + if(itemstack == null) + { + return false; + } + + if(inventory[1] == null) + { + return true; + } + + if(!inventory[1].isItemEqual(itemstack)) + { + return false; + } + else { + return inventory[1].stackSize + itemstack.stackSize <= inventory[1].getMaxStackSize(); + } + } + + public void operate() + { + ItemStack itemstack = RecipeHandler.getChemicalCrystalizerOutput(inputTank, true); + + if(inventory[0].stackSize <= 0) + { + inventory[0] = null; + } + + if(inventory[2] == null) + { + inventory[2] = itemstack; + } + else { + inventory[2].stackSize += itemstack.stackSize; + } + + onInventoryChanged(); + } + + @Override + public void handlePacketData(ByteArrayDataInput dataStream) + { + if(!worldObj.isRemote) + { + int type = dataStream.readInt(); + + if(type == 0) + { + inputTank.setGas(null); + } + + for(EntityPlayer player : playersUsing) + { + PacketHandler.sendPacket(Transmission.SINGLE_CLIENT, new PacketTileEntity().setParams(Coord4D.get(this), getNetworkedData(new ArrayList())), player); + } + + return; + } + + super.handlePacketData(dataStream); + + isActive = dataStream.readBoolean(); + operatingTicks = dataStream.readInt(); + controlType = RedstoneControl.values()[dataStream.readInt()]; + + if(dataStream.readBoolean()) + { + inputTank.setGas(new GasStack(GasRegistry.getGas(dataStream.readInt()), dataStream.readInt())); + } + else { + inputTank.setGas(null); + } + + + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } + + @Override + public ArrayList getNetworkedData(ArrayList data) + { + super.getNetworkedData(data); + + data.add(isActive); + data.add(operatingTicks); + data.add(controlType.ordinal()); + + if(inputTank.getGas() != null) + { + data.add(true); + data.add(inputTank.getGas().getGas().getID()); + data.add(inputTank.getStored()); + } + else { + data.add(false); + } + + return data; + } + + @Override + public void readFromNBT(NBTTagCompound nbtTags) + { + super.readFromNBT(nbtTags); + + isActive = nbtTags.getBoolean("isActive"); + operatingTicks = nbtTags.getInteger("operatingTicks"); + controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")]; + + inputTank.read(nbtTags.getCompoundTag("rightTank")); + } + + @Override + public void writeToNBT(NBTTagCompound nbtTags) + { + super.writeToNBT(nbtTags); + + nbtTags.setBoolean("isActive", isActive); + nbtTags.setInteger("operatingTicks", operatingTicks); + nbtTags.setInteger("controlType", controlType.ordinal()); + + nbtTags.setCompoundTag("rightTank", inputTank.write(new NBTTagCompound())); + } + + @Override + public boolean canSetFacing(int i) + { + return i != 0 && i != 1; + } + + public int getScaledInputGasLevel(int i) + { + return inputTank != null ? inputTank.getStored()*i / MAX_GAS : 0; + } + + @Override + public void setActive(boolean active) + { + isActive = active; + + if(clientActive != active && updateDelay == 0) + { + PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTileEntity().setParams(Coord4D.get(this), getNetworkedData(new ArrayList()))); + + updateDelay = 10; + clientActive = active; + } + } + + @Override + public boolean getActive() + { + return isActive; + } + + @Override + public boolean renderUpdate() + { + return false; + } + + @Override + public boolean lightUpdate() + { + return true; + } + + @Override + public boolean canTubeConnect(ForgeDirection side) + { + return side == MekanismUtils.getLeft(facing); + } + + @Override + public boolean canReceiveGas(ForgeDirection side, Gas type) + { + return side == MekanismUtils.getLeft(facing) && inputTank.canReceive(type); + } + + @Override + public RedstoneControl getControlType() + { + return controlType; + } + + @Override + public void setControlType(RedstoneControl type) + { + controlType = type; + MekanismUtils.saveChunk(this); + } + + @Override + public int receiveGas(ForgeDirection side, GasStack stack) + { + if(canReceiveGas(side, stack.getGas())) + { + return inputTank.receive(stack, true); + } + + return 0; + } + + @Override + public GasStack drawGas(ForgeDirection side, int amount) + { + return null; + } + + @Override + public boolean canDrawGas(ForgeDirection side, Gas type) + { + return false; + } + + @Override + public boolean isItemValidForSlot(int slotID, ItemStack itemstack) + { + if(slotID == 0) + { + return FluidContainerRegistry.getFluidForFilledItem(itemstack) != null && FluidContainerRegistry.getFluidForFilledItem(itemstack).getFluid() == FluidRegistry.WATER; + } + else if(slotID == 2) + { + return ChargeUtils.canBeDischarged(itemstack); + } + + return false; + } + + @Override + public boolean canExtractItem(int slotID, ItemStack itemstack, int side) + { + if(slotID == 1) + { + return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null); + } + else if(slotID == 2) + { + return ChargeUtils.canBeOutputted(itemstack, false); + } + + return false; + } + + @Override + public int[] getAccessibleSlotsFromSide(int side) + { + if(side == MekanismUtils.getLeft(facing).ordinal()) + { + return new int[] {0}; + } + else if(side == MekanismUtils.getRight(facing).ordinal()) + { + return new int[] {1}; + } + else if(side == 0 || side == 1) + { + return new int[2]; + } + + return InventoryUtils.EMPTY; + } + + @Override + public String getSoundPath() + { + return "ChemicalCrystalizer.ogg"; + } + + @Override + public float getVolumeMultiplier() + { + return 1; + } +} diff --git a/common/mekanism/common/tile/TileEntityChemicalDissolutionChamber.java b/common/mekanism/common/tile/TileEntityChemicalDissolutionChamber.java new file mode 100644 index 000000000..567f98a2c --- /dev/null +++ b/common/mekanism/common/tile/TileEntityChemicalDissolutionChamber.java @@ -0,0 +1,420 @@ +package mekanism.common.tile; + +import java.util.ArrayList; + +import mekanism.api.Coord4D; +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; +import mekanism.api.gas.ITubeConnection; +import mekanism.client.sound.IHasSound; +import mekanism.common.IActiveState; +import mekanism.common.IRedstoneControl; +import mekanism.common.Mekanism; +import mekanism.common.PacketHandler; +import mekanism.common.PacketHandler.Transmission; +import mekanism.common.block.BlockMachine.MachineType; +import mekanism.common.network.PacketTileEntity; +import mekanism.common.recipe.RecipeHandler; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.util.ChargeUtils; +import mekanism.common.util.InventoryUtils; +import mekanism.common.util.MekanismUtils; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.ForgeDirection; + +import com.google.common.io.ByteArrayDataInput; + +public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBlock implements IActiveState, ITubeConnection, IRedstoneControl, IHasSound, IGasHandler +{ + public GasTank injectTank = new GasTank(MAX_GAS); + public GasTank outputTank = new GasTank(MAX_GAS); + + public static final int MAX_GAS = 10000; + + public static final int INJECT_USAGE = 1; + + public int updateDelay; + + public int gasOutput = 16; + + public boolean isActive; + + public boolean clientActive; + + public double prevEnergy; + + public int operatingTicks = 0; + + public int TICKS_REQUIRED = 100; + + public final double ENERGY_USAGE = Mekanism.chemicalDissolutionChamberUsage; + + public RedstoneControl controlType = RedstoneControl.DISABLED; + + public TileEntityChemicalDissolutionChamber() + { + super("ChemicalDissolutionChamber", MachineType.CHEMICAL_DISSOLUTION_CHAMBER.baseEnergy); + inventory = new ItemStack[4]; + } + + @Override + public void onUpdate() + { + if(worldObj.isRemote) + { + Mekanism.proxy.registerSound(this); + + if(updateDelay > 0) + { + updateDelay--; + + if(updateDelay == 0 && clientActive != isActive) + { + isActive = clientActive; + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } + } + } + + if(!worldObj.isRemote) + { + if(updateDelay > 0) + { + updateDelay--; + + if(updateDelay == 0 && clientActive != isActive) + { + PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTileEntity().setParams(Coord4D.get(this), getNetworkedData(new ArrayList()))); + } + } + + ChargeUtils.discharge(3, this); + + if(inventory[0] != null && (injectTank.getGas() == null || injectTank.getStored() < injectTank.getMaxGas())) + { + injectTank.receive(GasTransmission.removeGas(inventory[0], GasRegistry.getGas("sulfuricAcid"), injectTank.getNeeded()), true); + } + + if(inventory[2] != null && outputTank.getGas() != null) + { + outputTank.draw(GasTransmission.addGas(inventory[2], outputTank.getGas()), true); + } + + if(canOperate() && getEnergy() >= ENERGY_USAGE && MekanismUtils.canFunction(this)) + { + setActive(true); + setEnergy(getEnergy() - ENERGY_USAGE); + + if(operatingTicks < TICKS_REQUIRED) + { + operatingTicks++; + } + else { + GasStack stack = RecipeHandler.getItemToGasOutput(inventory[1], true, Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get()); + + outputTank.receive(stack, true); + injectTank.draw(INJECT_USAGE, true); + + operatingTicks = 0; + + if(inventory[1].stackSize <= 0) + { + inventory[1] = null; + } + + onInventoryChanged(); + } + } + else { + if(prevEnergy >= getEnergy()) + { + setActive(false); + } + } + + prevEnergy = getEnergy(); + + if(outputTank.getGas() != null) + { + GasStack toSend = new GasStack(outputTank.getGas().getGas(), Math.min(outputTank.getStored(), gasOutput)); + outputTank.draw(GasTransmission.emitGasToNetwork(toSend, this, MekanismUtils.getRight(facing)), true); + + TileEntity tileEntity = Coord4D.get(this).getFromSide(MekanismUtils.getRight(facing)).getTileEntity(worldObj); + + if(tileEntity instanceof IGasHandler) + { + if(((IGasHandler)tileEntity).canReceiveGas(MekanismUtils.getRight(facing).getOpposite(), outputTank.getGas().getGas())) + { + outputTank.draw(((IGasHandler)tileEntity).receiveGas(MekanismUtils.getRight(facing).getOpposite(), toSend), true); + } + } + } + } + } + + @Override + public boolean isItemValidForSlot(int slotID, ItemStack itemstack) + { + if(slotID == 1) + { + return RecipeHandler.getItemToGasOutput(itemstack, false, Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get()) != null; + } + else if(slotID == 3) + { + return ChargeUtils.canBeDischarged(itemstack); + } + + return false; + } + + @Override + public boolean canExtractItem(int slotID, ItemStack itemstack, int side) + { + if(slotID == 2) + { + return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null); + } + + return false; + } + + @Override + public int[] getAccessibleSlotsFromSide(int side) + { + if(side == MekanismUtils.getLeft(facing).ordinal()) + { + return new int[] {1}; + } + else if(side == 0 || side == 1) + { + return new int[] {0}; + } + else if(side == MekanismUtils.getRight(facing).ordinal()) + { + return new int[] {2}; + } + + return InventoryUtils.EMPTY; + } + + public int getScaledProgress(int i) + { + return operatingTicks*i / TICKS_REQUIRED; + } + + public boolean canOperate() + { + if(injectTank.getStored() < INJECT_USAGE || inventory[1] == null) + { + return false; + } + + GasStack stack = RecipeHandler.getItemToGasOutput(inventory[1], false, Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get()); + + if(stack == null || (outputTank.getGas() != null && (outputTank.getGas().getGas() != stack.getGas() || outputTank.getNeeded() < stack.amount))) + { + return false; + } + + return true; + } + + @Override + public void handlePacketData(ByteArrayDataInput dataStream) + { + super.handlePacketData(dataStream); + + isActive = dataStream.readBoolean(); + controlType = RedstoneControl.values()[dataStream.readInt()]; + operatingTicks = dataStream.readInt(); + + if(dataStream.readBoolean()) + { + injectTank.setGas(new GasStack(GasRegistry.getGas(dataStream.readInt()), dataStream.readInt())); + } + else { + injectTank.setGas(null); + } + + if(dataStream.readBoolean()) + { + outputTank.setGas(new GasStack(GasRegistry.getGas(dataStream.readInt()), dataStream.readInt())); + } + else { + outputTank.setGas(null); + } + + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } + + @Override + public ArrayList getNetworkedData(ArrayList data) + { + super.getNetworkedData(data); + + data.add(isActive); + data.add(controlType.ordinal()); + data.add(operatingTicks); + + if(injectTank.getGas() != null) + { + data.add(true); + data.add(injectTank.getGas().getGas().getID()); + data.add(injectTank.getStored()); + } + else { + data.add(false); + } + + if(outputTank.getGas() != null) + { + data.add(true); + data.add(outputTank.getGas().getGas().getID()); + data.add(outputTank.getStored()); + } + else { + data.add(false); + } + + return data; + } + + @Override + public void readFromNBT(NBTTagCompound nbtTags) + { + super.readFromNBT(nbtTags); + + isActive = nbtTags.getBoolean("isActive"); + controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")]; + operatingTicks = nbtTags.getInteger("operatingTicks"); + injectTank.read(nbtTags.getCompoundTag("injectTank")); + outputTank.read(nbtTags.getCompoundTag("gasTank")); + } + + @Override + public void writeToNBT(NBTTagCompound nbtTags) + { + super.writeToNBT(nbtTags); + + nbtTags.setBoolean("isActive", isActive); + nbtTags.setInteger("controlType", controlType.ordinal()); + nbtTags.setInteger("operatingTicks", operatingTicks); + nbtTags.setCompoundTag("injectTank", injectTank.write(new NBTTagCompound())); + nbtTags.setCompoundTag("gasTank", outputTank.write(new NBTTagCompound())); + } + + @Override + public boolean canSetFacing(int i) + { + return i != 0 && i != 1; + } + + public int getScaledInjectGasLevel(int i) + { + return injectTank.getGas() != null ? injectTank.getStored()*i / MAX_GAS : 0; + } + + public int getScaledOutputGasLevel(int i) + { + return outputTank.getGas() != null ? outputTank.getStored()*i / MAX_GAS : 0; + } + + @Override + public void setActive(boolean active) + { + isActive = active; + + if(clientActive != active && updateDelay == 0) + { + PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTileEntity().setParams(Coord4D.get(this), getNetworkedData(new ArrayList()))); + + updateDelay = 10; + clientActive = active; + } + } + + @Override + public boolean getActive() + { + return isActive; + } + + @Override + public boolean renderUpdate() + { + return false; + } + + @Override + public boolean lightUpdate() + { + return true; + } + + @Override + public boolean canTubeConnect(ForgeDirection side) + { + return side == MekanismUtils.getLeft(facing) || side == MekanismUtils.getRight(facing); + } + + @Override + public RedstoneControl getControlType() + { + return controlType; + } + + @Override + public void setControlType(RedstoneControl type) + { + controlType = type; + MekanismUtils.saveChunk(this); + } + + @Override + public String getSoundPath() + { + return "ChemicalDissolutionChamber.ogg"; + } + + @Override + public float getVolumeMultiplier() + { + return 1; + } + + @Override + public int receiveGas(ForgeDirection side, GasStack stack) + { + if(canReceiveGas(side, stack.getGas())) + { + return injectTank.receive(stack, true); + } + + return 0; + } + + @Override + public GasStack drawGas(ForgeDirection side, int amount) + { + return null; + } + + @Override + public boolean canReceiveGas(ForgeDirection side, Gas type) + { + return side == MekanismUtils.getLeft(facing) && type == GasRegistry.getGas("sulfuricAcid"); + } + + @Override + public boolean canDrawGas(ForgeDirection side, Gas type) + { + return false; + } +} diff --git a/common/mekanism/common/tile/TileEntityChemicalInfuser.java b/common/mekanism/common/tile/TileEntityChemicalInfuser.java index 9a4693960..503da3962 100644 --- a/common/mekanism/common/tile/TileEntityChemicalInfuser.java +++ b/common/mekanism/common/tile/TileEntityChemicalInfuser.java @@ -153,7 +153,7 @@ public class TileEntityChemicalInfuser extends TileEntityElectricBlock implement GasStack out = RecipeHandler.getChemicalInfuserOutput(leftTank, rightTank, false); - if(out == null) + if(out == null || centerTank.getGas() != null && centerTank.getGas().getGas() != out.getGas()) { return false; } @@ -432,10 +432,14 @@ public class TileEntityChemicalInfuser extends TileEntityElectricBlock implement { return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canReceiveGas(itemstack, null); } - if(slotID == 1) + else if(slotID == 1) { return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null); } + else if(slotID == 3) + { + return ChargeUtils.canBeOutputted(itemstack, false); + } return false; } diff --git a/common/mekanism/common/tile/TileEntityChemicalOxidizer.java b/common/mekanism/common/tile/TileEntityChemicalOxidizer.java index 7c78cbdf0..84a1fb066 100644 --- a/common/mekanism/common/tile/TileEntityChemicalOxidizer.java +++ b/common/mekanism/common/tile/TileEntityChemicalOxidizer.java @@ -19,6 +19,7 @@ import mekanism.common.PacketHandler.Transmission; import mekanism.common.block.BlockMachine.MachineType; import mekanism.common.network.PacketTileEntity; import mekanism.common.recipe.RecipeHandler; +import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.util.ChargeUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; @@ -107,7 +108,7 @@ public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implemen operatingTicks++; } else { - GasStack stack = RecipeHandler.getChemicalOxidizerOutput(inventory[0], true); + GasStack stack = RecipeHandler.getItemToGasOutput(inventory[0], true, Recipe.CHEMICAL_OXIDIZER.get()); gasTank.receive(stack, true); operatingTicks = 0; @@ -152,7 +153,7 @@ public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implemen { if(slotID == 0) { - return RecipeHandler.getChemicalOxidizerOutput(itemstack, false) != null; + return RecipeHandler.getItemToGasOutput(itemstack, false, Recipe.CHEMICAL_OXIDIZER.get()) != null; } else if(slotID == 1) { @@ -204,7 +205,7 @@ public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implemen return false; } - GasStack stack = RecipeHandler.getChemicalOxidizerOutput(inventory[0], false); + GasStack stack = RecipeHandler.getItemToGasOutput(inventory[0], false, Recipe.CHEMICAL_OXIDIZER.get()); if(stack == null || (gasTank.getGas() != null && (gasTank.getGas().getGas() != stack.getGas() || gasTank.getNeeded() < stack.amount))) { @@ -231,7 +232,6 @@ public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implemen gasTank.setGas(null); } - MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); } diff --git a/common/mekanism/common/tile/TileEntityChemicalWasher.java b/common/mekanism/common/tile/TileEntityChemicalWasher.java new file mode 100644 index 000000000..2c2d25691 --- /dev/null +++ b/common/mekanism/common/tile/TileEntityChemicalWasher.java @@ -0,0 +1,553 @@ +package mekanism.common.tile; + +import java.util.ArrayList; + +import mekanism.api.Coord4D; +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; +import mekanism.api.gas.ITubeConnection; +import mekanism.client.sound.IHasSound; +import mekanism.common.IActiveState; +import mekanism.common.IRedstoneControl; +import mekanism.common.Mekanism; +import mekanism.common.PacketHandler; +import mekanism.common.PacketHandler.Transmission; +import mekanism.common.block.BlockMachine.MachineType; +import mekanism.common.network.PacketTileEntity; +import mekanism.common.recipe.RecipeHandler; +import mekanism.common.util.ChargeUtils; +import mekanism.common.util.InventoryUtils; +import mekanism.common.util.MekanismUtils; +import mekanism.common.util.PipeUtils; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTank; +import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidHandler; + +import com.google.common.io.ByteArrayDataInput; + +public class TileEntityChemicalWasher extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IHasSound, IFluidHandler +{ + public FluidTank fluidTank = new FluidTank(MAX_FLUID); + public GasTank inputTank = new GasTank(MAX_GAS); + public GasTank outputTank = new GasTank(MAX_GAS); + + public static final int MAX_GAS = 10000; + public static final int MAX_FLUID = 10000; + + public static int WATER_USAGE = 5; + + public int updateDelay; + + public int gasOutput = 16; + + public boolean isActive; + + public boolean clientActive; + + public double prevEnergy; + + public final double ENERGY_USAGE = Mekanism.chemicalWasherUsage; + + /** This machine's current RedstoneControl type. */ + public RedstoneControl controlType = RedstoneControl.DISABLED; + + public TileEntityChemicalWasher() + { + super("ChemicalWasher", MachineType.CHEMICAL_WASHER.baseEnergy); + inventory = new ItemStack[3]; + } + + @Override + public void onUpdate() + { + if(worldObj.isRemote) + { + Mekanism.proxy.registerSound(this); + + if(updateDelay > 0) + { + updateDelay--; + + if(updateDelay == 0 && clientActive != isActive) + { + isActive = clientActive; + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } + } + } + + if(!worldObj.isRemote) + { + if(updateDelay > 0) + { + updateDelay--; + + if(updateDelay == 0 && clientActive != isActive) + { + PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTileEntity().setParams(Coord4D.get(this), getNetworkedData(new ArrayList()))); + } + } + + ChargeUtils.discharge(2, this); + + if(inventory[1] != null && outputTank.getGas() != null) + { + outputTank.draw(GasTransmission.addGas(inventory[1], outputTank.getGas()), true); + } + + if(canOperate() && getEnergy() >= ENERGY_USAGE && MekanismUtils.canFunction(this)) + { + setActive(true); + GasStack stack = RecipeHandler.getChemicalWasherOutput(inputTank, true); + + outputTank.receive(stack, true); + fluidTank.drain(WATER_USAGE, true); + + setEnergy(getEnergy() - ENERGY_USAGE); + } + else { + if(prevEnergy >= getEnergy()) + { + setActive(false); + } + } + + if(outputTank.getGas() != null) + { + GasStack toSend = new GasStack(outputTank.getGas().getGas(), Math.min(outputTank.getStored(), gasOutput)); + outputTank.draw(GasTransmission.emitGasToNetwork(toSend, this, MekanismUtils.getRight(facing)), true); + + TileEntity tileEntity = Coord4D.get(this).getFromSide(MekanismUtils.getRight(facing)).getTileEntity(worldObj); + + if(tileEntity instanceof IGasHandler) + { + if(((IGasHandler)tileEntity).canReceiveGas(MekanismUtils.getRight(facing).getOpposite(), outputTank.getGas().getGas())) + { + outputTank.draw(((IGasHandler)tileEntity).receiveGas(MekanismUtils.getRight(facing).getOpposite(), toSend), true); + } + } + } + + prevEnergy = getEnergy(); + } + } + + public boolean canOperate() + { + if(fluidTank.getFluidAmount() < WATER_USAGE || inputTank.getGas() == null || outputTank.getNeeded() == 0) + { + return false; + } + + GasStack out = RecipeHandler.getChemicalWasherOutput(inputTank, false); + + if(out == null || outputTank.getGas() != null && outputTank.getGas().getGas() != out.getGas()) + { + return false; + } + + if(outputTank.getNeeded() < out.amount) + { + return false; + } + + return true; + } + + private void manageBuckets() + { + if(FluidContainerRegistry.isFilledContainer(inventory[0])) + { + FluidStack itemFluid = FluidContainerRegistry.getFluidForFilledItem(inventory[0]); + + if((fluidTank.getFluid() == null && itemFluid.amount <= MAX_FLUID) || fluidTank.getFluid().amount+itemFluid.amount <= MAX_FLUID) + { + if(itemFluid.getFluid() != FluidRegistry.WATER || (fluidTank.getFluid() != null && !fluidTank.getFluid().isFluidEqual(itemFluid))) + { + return; + } + + ItemStack containerItem = inventory[0].getItem().getContainerItemStack(inventory[0]); + + boolean filled = false; + + if(containerItem != null) + { + if(inventory[1] == null || (inventory[1].isItemEqual(containerItem) && inventory[1].stackSize+1 <= containerItem.getMaxStackSize())) + { + inventory[0] = null; + + if(inventory[1] == null) + { + inventory[1] = containerItem; + } + else { + inventory[1].stackSize++; + } + + filled = true; + } + } + else { + inventory[0].stackSize--; + + if(inventory[0].stackSize == 0) + { + inventory[0] = null; + } + + filled = true; + } + + if(filled) + { + fluidTank.fill(itemFluid, true); + } + } + } + } + + @Override + public void handlePacketData(ByteArrayDataInput dataStream) + { + super.handlePacketData(dataStream); + + isActive = dataStream.readBoolean(); + controlType = RedstoneControl.values()[dataStream.readInt()]; + + if(dataStream.readBoolean()) + { + fluidTank.setFluid(new FluidStack(FluidRegistry.getFluid(dataStream.readInt()), dataStream.readInt())); + } + else { + fluidTank.setFluid(null); + } + + if(dataStream.readBoolean()) + { + inputTank.setGas(new GasStack(GasRegistry.getGas(dataStream.readInt()), dataStream.readInt())); + } + else { + inputTank.setGas(null); + } + + if(dataStream.readBoolean()) + { + outputTank.setGas(new GasStack(GasRegistry.getGas(dataStream.readInt()), dataStream.readInt())); + } + else { + outputTank.setGas(null); + } + + + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } + + @Override + public ArrayList getNetworkedData(ArrayList data) + { + super.getNetworkedData(data); + + data.add(isActive); + data.add(controlType.ordinal()); + + if(fluidTank.getFluid() != null) + { + data.add(true); + data.add(fluidTank.getFluid().getFluid().getID()); + data.add(fluidTank.getFluidAmount()); + } + else { + data.add(false); + } + + if(inputTank.getGas() != null) + { + data.add(true); + data.add(inputTank.getGas().getGas().getID()); + data.add(inputTank.getStored()); + } + else { + data.add(false); + } + + if(outputTank.getGas() != null) + { + data.add(true); + data.add(outputTank.getGas().getGas().getID()); + data.add(outputTank.getStored()); + } + else { + data.add(false); + } + + return data; + } + + @Override + public void readFromNBT(NBTTagCompound nbtTags) + { + super.readFromNBT(nbtTags); + + isActive = nbtTags.getBoolean("isActive"); + controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")]; + + fluidTank.readFromNBT(nbtTags.getCompoundTag("leftTank")); + inputTank.read(nbtTags.getCompoundTag("rightTank")); + outputTank.read(nbtTags.getCompoundTag("centerTank")); + } + + @Override + public void writeToNBT(NBTTagCompound nbtTags) + { + super.writeToNBT(nbtTags); + + nbtTags.setBoolean("isActive", isActive); + nbtTags.setInteger("controlType", controlType.ordinal()); + + nbtTags.setCompoundTag("leftTank", fluidTank.writeToNBT(new NBTTagCompound())); + nbtTags.setCompoundTag("rightTank", inputTank.write(new NBTTagCompound())); + nbtTags.setCompoundTag("centerTank", outputTank.write(new NBTTagCompound())); + } + + @Override + public boolean canSetFacing(int i) + { + return i != 0 && i != 1; + } + + public GasTank getTank(ForgeDirection side) + { + if(side == MekanismUtils.getLeft(facing)) + { + return inputTank; + } + else if(side == MekanismUtils.getRight(facing)) + { + return outputTank; + } + + return null; + } + + public int getScaledFluidLevel(int i) + { + return fluidTank != null ? fluidTank.getFluidAmount()*i / MAX_FLUID : 0; + } + + public int getScaledInputGasLevel(int i) + { + return inputTank != null ? inputTank.getStored()*i / MAX_GAS : 0; + } + + public int getScaledOutputGasLevel(int i) + { + return outputTank != null ? outputTank.getStored()*i / MAX_GAS : 0; + } + + @Override + public void setActive(boolean active) + { + isActive = active; + + if(clientActive != active && updateDelay == 0) + { + PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTileEntity().setParams(Coord4D.get(this), getNetworkedData(new ArrayList()))); + + updateDelay = 10; + clientActive = active; + } + } + + @Override + public boolean getActive() + { + return isActive; + } + + @Override + public boolean renderUpdate() + { + return false; + } + + @Override + public boolean lightUpdate() + { + return true; + } + + @Override + public boolean canTubeConnect(ForgeDirection side) + { + return side == MekanismUtils.getLeft(facing) || side == MekanismUtils.getRight(facing); + } + + @Override + public boolean canReceiveGas(ForgeDirection side, Gas type) + { + return getTank(side) != null && getTank(side) != outputTank ? getTank(side).canReceive(type) : false; + } + + @Override + public RedstoneControl getControlType() + { + return controlType; + } + + @Override + public void setControlType(RedstoneControl type) + { + controlType = type; + MekanismUtils.saveChunk(this); + } + + @Override + public int receiveGas(ForgeDirection side, GasStack stack) + { + if(canReceiveGas(side, stack != null ? stack.getGas() : null)) + { + return getTank(side).receive(stack, true); + } + + return 0; + } + + @Override + public GasStack drawGas(ForgeDirection side, int amount) + { + if(canDrawGas(side, null)) + { + return getTank(side).draw(amount, true); + } + + return null; + } + + @Override + public boolean canDrawGas(ForgeDirection side, Gas type) + { + return getTank(side) == outputTank ? getTank(side).canDraw(type) : false; + } + + @Override + public boolean isItemValidForSlot(int slotID, ItemStack itemstack) + { + if(slotID == 0) + { + return FluidContainerRegistry.getFluidForFilledItem(itemstack) != null && FluidContainerRegistry.getFluidForFilledItem(itemstack).getFluid() == FluidRegistry.WATER; + } + else if(slotID == 2) + { + return ChargeUtils.canBeDischarged(itemstack); + } + + return false; + } + + @Override + public boolean canExtractItem(int slotID, ItemStack itemstack, int side) + { + if(slotID == 1) + { + return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null); + } + else if(slotID == 2) + { + return ChargeUtils.canBeOutputted(itemstack, false); + } + + return false; + } + + @Override + public int[] getAccessibleSlotsFromSide(int side) + { + if(side == MekanismUtils.getLeft(facing).ordinal()) + { + return new int[] {0}; + } + else if(side == MekanismUtils.getRight(facing).ordinal()) + { + return new int[] {1}; + } + else if(side == 0 || side == 1) + { + return new int[2]; + } + + return InventoryUtils.EMPTY; + } + + @Override + public String getSoundPath() + { + return "ChemicalWasher.ogg"; + } + + @Override + public float getVolumeMultiplier() + { + return 1; + } + + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) + { + if(canFill(from, resource.getFluid())) + { + return fluidTank.fill(resource, doFill); + } + + return 0; + } + + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) + { + return null; + } + + @Override + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) + { + return null; + } + + @Override + public boolean canFill(ForgeDirection from, Fluid fluid) + { + return from == ForgeDirection.UP && fluid == FluidRegistry.WATER; + } + + @Override + public boolean canDrain(ForgeDirection from, Fluid fluid) + { + return false; + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection from) + { + if(from == ForgeDirection.UP) + { + return new FluidTankInfo[] {fluidTank.getInfo()}; + } + + return PipeUtils.EMPTY; + } +} diff --git a/resources/assets/mekanism/gui/GuiChemicalCrystalizer.png b/resources/assets/mekanism/gui/GuiChemicalCrystalizer.png new file mode 100644 index 000000000..46923b2ed Binary files /dev/null and b/resources/assets/mekanism/gui/GuiChemicalCrystalizer.png differ diff --git a/resources/assets/mekanism/gui/GuiChemicalInfuser.png b/resources/assets/mekanism/gui/GuiChemicalInfuser.png index d024079f8..0b6e1f669 100644 Binary files a/resources/assets/mekanism/gui/GuiChemicalInfuser.png and b/resources/assets/mekanism/gui/GuiChemicalInfuser.png differ diff --git a/resources/assets/mekanism/gui/GuiChemicalRecrystalizationChamber.png b/resources/assets/mekanism/gui/GuiChemicalRecrystalizationChamber.png deleted file mode 100644 index 2b7438c3d..000000000 Binary files a/resources/assets/mekanism/gui/GuiChemicalRecrystalizationChamber.png and /dev/null differ diff --git a/resources/assets/mekanism/gui/GuiChemicalWasher.png b/resources/assets/mekanism/gui/GuiChemicalWasher.png index c13975d78..e4ff0c9e5 100644 Binary files a/resources/assets/mekanism/gui/GuiChemicalWasher.png and b/resources/assets/mekanism/gui/GuiChemicalWasher.png differ diff --git a/resources/assets/mekanism/lang/de_DE.lang b/resources/assets/mekanism/lang/de_DE.lang index 042ef41b4..b3fbf6446 100644 --- a/resources/assets/mekanism/lang/de_DE.lang +++ b/resources/assets/mekanism/lang/de_DE.lang @@ -85,6 +85,9 @@ tile.MachineBlock2.ChemicalCombiner.name=Chemischer Kombinierer tile.MachineBlock2.ChemicalInjectionChamber.name=Chemische Injektionskammer tile.MachineBlock2.ElectrolyticSeparator.name=Elektrolytischer Separator tile.MachineBlock2.PrecisionSawmill.name=Präzisionssägewerk +tile.MachineBlock2.ChemicalDissolutionChamber.name=Chemische Auflösungskammer +tile.MachineBlock2.ChemicalWasher.name=Chemische Waschanlage +tile.MachineBlock2.ChemicalCrystalizer.name=Chemischer Kristallisierer //Infuse types infuse.carbon=Kohlenstoff diff --git a/resources/assets/mekanism/lang/en_US.lang b/resources/assets/mekanism/lang/en_US.lang index 8d1df6fab..bef18987a 100644 --- a/resources/assets/mekanism/lang/en_US.lang +++ b/resources/assets/mekanism/lang/en_US.lang @@ -85,6 +85,9 @@ tile.MachineBlock2.ChemicalCombiner.name=Chemical Combiner tile.MachineBlock2.ChemicalInjectionChamber.name=Chemical Injection Chamber tile.MachineBlock2.ElectrolyticSeparator.name=Electrolytic Separator tile.MachineBlock2.PrecisionSawmill.name=Precision Sawmill +tile.MachineBlock2.ChemicalDissolutionChamber.name=Chemical Dissolution Chamber +tile.MachineBlock2.ChemicalWasher.name=Chemical Washer +tile.MachineBlock2.ChemicalCrystalizer.name=Chemical Crystalizer //Infuse types infuse.carbon=Carbon diff --git a/resources/assets/mekanism/render/ChemicalCrystalizer.png b/resources/assets/mekanism/render/ChemicalCrystalizer.png new file mode 100644 index 000000000..ed9fad844 Binary files /dev/null and b/resources/assets/mekanism/render/ChemicalCrystalizer.png differ diff --git a/resources/assets/mekanism/render/ChemicalDissolutionChamber.png b/resources/assets/mekanism/render/ChemicalDissolutionChamber.png new file mode 100644 index 000000000..cabac78aa Binary files /dev/null and b/resources/assets/mekanism/render/ChemicalDissolutionChamber.png differ diff --git a/resources/assets/mekanism/render/ChemicalWasher.png b/resources/assets/mekanism/render/ChemicalWasher.png new file mode 100644 index 000000000..93c84aa42 Binary files /dev/null and b/resources/assets/mekanism/render/ChemicalWasher.png differ