diff --git a/src/main/java/mekanism/common/Mekanism.java b/src/main/java/mekanism/common/Mekanism.java index d7ac7c545..09fb37063 100644 --- a/src/main/java/mekanism/common/Mekanism.java +++ b/src/main/java/mekanism/common/Mekanism.java @@ -456,7 +456,7 @@ public class Mekanism " O ", "G G", "GGG", Character.valueOf('O'), "ingotOsmium", Character.valueOf('G'), "paneGlass" })); MachineType.SOLAR_NEUTRON_ACTIVATOR.addRecipe(new MekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock3, 1, 1), new Object[] { - "APA", "CSC", "BBB", Character.valueOf('A'), "alloyElite", Character.valueOf('S'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('P'), MekanismItems.Polyethene, Character.valueOf('B'), "ingotBronze", Character.valueOf('C'), "circuitElite" + "APA", "CSC", "BBB", Character.valueOf('A'), "alloyElite", Character.valueOf('S'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('P'), new ItemStack(MekanismItems.Polyethene, 1, 2), Character.valueOf('B'), "ingotBronze", Character.valueOf('C'), "circuitElite" })); CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock2, 4, 1), new Object[] { " S ", "SES", " S ", Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem() @@ -771,6 +771,7 @@ public class Mekanism RecipeHandler.addChemicalInfuserRecipe(new GasStack(GasRegistry.getGas("oxygen"), 1), new GasStack(GasRegistry.getGas("sulfurDioxideGas"), 2), new GasStack(GasRegistry.getGas("sulfurTrioxideGas"), 2)); RecipeHandler.addChemicalInfuserRecipe(new GasStack(GasRegistry.getGas("sulfurTrioxideGas"), 1), new GasStack(GasRegistry.getGas("water"), 1), new GasStack(GasRegistry.getGas("sulfuricAcid"), 1)); RecipeHandler.addChemicalInfuserRecipe(new GasStack(GasRegistry.getGas("hydrogen"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1), new GasStack(GasRegistry.getGas("hydrogenChloride"), 1)); + RecipeHandler.addChemicalInfuserRecipe(new GasStack(GasRegistry.getGas("deuterium"), 1), new GasStack(GasRegistry.getGas("tritium"), 1), new GasStack(GasRegistry.getGas("fusionFuelDT"), 2)); //Electrolytic Separator Recipes RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("water", 2), 2 * general.FROM_H2, new GasStack(GasRegistry.getGas("hydrogen"), 2), new GasStack(GasRegistry.getGas("oxygen"), 1)); diff --git a/src/main/java/mekanism/generators/common/GeneratorsItems.java b/src/main/java/mekanism/generators/common/GeneratorsItems.java index b6fa43f98..e91174693 100644 --- a/src/main/java/mekanism/generators/common/GeneratorsItems.java +++ b/src/main/java/mekanism/generators/common/GeneratorsItems.java @@ -1,7 +1,7 @@ package mekanism.generators.common; import mekanism.common.item.ItemMekanism; - +import mekanism.generators.common.item.ItemHohlraum; import net.minecraft.item.Item; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder; @@ -10,9 +10,11 @@ import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder; public class GeneratorsItems { public static final Item SolarPanel = new ItemMekanism().setUnlocalizedName("SolarPanel"); + public static final ItemHohlraum Hohlraum = (ItemHohlraum)new ItemHohlraum().setUnlocalizedName("Hohlraum"); public static void register() { GameRegistry.registerItem(SolarPanel, "SolarPanel"); + GameRegistry.registerItem(Hohlraum, "Hohlraum"); } } diff --git a/src/main/java/mekanism/generators/common/item/ItemHohlraum.java b/src/main/java/mekanism/generators/common/item/ItemHohlraum.java index b1670f990..bd59dc582 100644 --- a/src/main/java/mekanism/generators/common/item/ItemHohlraum.java +++ b/src/main/java/mekanism/generators/common/item/ItemHohlraum.java @@ -1,7 +1,161 @@ package mekanism.generators.common.item; -import mekanism.common.item.ItemMekanism; +import java.util.List; -public class ItemHohlraum extends ItemMekanism +import mekanism.api.gas.Gas; +import mekanism.api.gas.GasRegistry; +import mekanism.api.gas.GasStack; +import mekanism.api.gas.IGasItem; +import mekanism.common.item.ItemMekanism; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class ItemHohlraum extends ItemMekanism implements IGasItem { + public static final int MAX_GAS = 10; + public static final int TRANSFER_RATE = 1; + + public ItemHohlraum() + { + super(); + setMaxStackSize(1); + setMaxDamage(100); + setNoRepair(); + } + + @Override + public int getMaxGas(ItemStack itemstack) + { + return MAX_GAS; + } + + @Override + public int getRate(ItemStack itemstack) + { + return TRANSFER_RATE; + } + + @Override + public int addGas(ItemStack itemstack, GasStack stack) + { + if(getGas(itemstack) != null && getGas(itemstack).getGas() != stack.getGas()) + { + return 0; + } + + if(stack.getGas() != GasRegistry.getGas("fusionFuelDT")) + { + return 0; + } + + int toUse = Math.min(getMaxGas(itemstack)-getStored(itemstack), Math.min(getRate(itemstack), stack.amount)); + setGas(itemstack, new GasStack(stack.getGas(), getStored(itemstack)+toUse)); + + return toUse; + } + + @Override + public GasStack removeGas(ItemStack itemstack, int amount) + { + if(getGas(itemstack) == null) + { + return null; + } + + Gas type = getGas(itemstack).getGas(); + + int gasToUse = Math.min(getStored(itemstack), Math.min(getRate(itemstack), amount)); + setGas(itemstack, new GasStack(type, getStored(itemstack)-gasToUse)); + + return new GasStack(type, gasToUse); + } + + public int getStored(ItemStack itemstack) + { + return getGas(itemstack) != null ? getGas(itemstack).amount : 0; + } + + @Override + public boolean canReceiveGas(ItemStack itemstack, Gas type) + { + return type == GasRegistry.getGas("hydrogen"); + } + + @Override + public boolean canProvideGas(ItemStack itemstack, Gas type) + { + return false; + } + + @Override + public GasStack getGas(ItemStack itemstack) + { + if(itemstack.stackTagCompound == null) + { + return null; + } + + GasStack stored = GasStack.readFromNBT(itemstack.stackTagCompound.getCompoundTag("stored")); + + if(stored == null) + { + itemstack.setItemDamage(100); + } + else { + itemstack.setItemDamage((int)Math.max(1, (Math.abs((((float)stored.amount/getMaxGas(itemstack))*100)-100)))); + } + + return stored; + } + + @Override + public boolean isMetadataSpecific(ItemStack itemStack) + { + return false; + } + + @Override + public void setGas(ItemStack itemstack, GasStack stack) + { + if(itemstack.stackTagCompound == null) + { + itemstack.setTagCompound(new NBTTagCompound()); + } + + if(stack == null || stack.amount == 0) + { + itemstack.setItemDamage(100); + itemstack.stackTagCompound.removeTag("stored"); + } + else { + int amount = Math.max(0, Math.min(stack.amount, getMaxGas(itemstack))); + GasStack gasStack = new GasStack(stack.getGas(), amount); + + itemstack.setItemDamage((int)Math.max(1, (Math.abs((((float)amount/getMaxGas(itemstack))*100)-100)))); + itemstack.stackTagCompound.setTag("stored", gasStack.write(new NBTTagCompound())); + } + } + + public ItemStack getEmptyItem() + { + ItemStack empty = new ItemStack(this); + setGas(empty, null); + empty.setItemDamage(100); + return empty; + } + + @Override + public void getSubItems(Item item, CreativeTabs tabs, List list) + { + ItemStack empty = new ItemStack(this); + setGas(empty, null); + empty.setItemDamage(100); + list.add(empty); + + ItemStack filled = new ItemStack(this); + setGas(filled, new GasStack(GasRegistry.getGas("hydrogen"), ((IGasItem)filled.getItem()).getMaxGas(filled))); + list.add(filled); + } } diff --git a/src/main/resources/assets/mekanism/lang/en_US.lang b/src/main/resources/assets/mekanism/lang/en_US.lang index 3ec63fe29..18450a135 100644 --- a/src/main/resources/assets/mekanism/lang/en_US.lang +++ b/src/main/resources/assets/mekanism/lang/en_US.lang @@ -44,6 +44,7 @@ item.PlaStick.name=PlaStick item.Substrate.name=Substrate item.Flamethrower.name=Flamethrower item.GaugeDropper.name=Gauge Dropper +item.BioFuel.name=Bio Fuel //Control Circuits item.BasicControlCircuit.name=Basic Control Circuit @@ -151,6 +152,7 @@ infuse.diamond=Diamond infuse.redstone=Redstone infuse.fungi=Fungi infuse.obsidian=Obsidian +infuse.bio=Biomass //Ore Block tile.OreBlock.OsmiumOre.name=Osmium Ore @@ -643,6 +645,7 @@ tooltip.FluidicPlenisher=A machine that is capable of creating entire !nlakes by tooltip.Laser=An advanced form of linear energy!ntransfer that utilizes an extremely!ncollimated beam of light. tooltip.LaserAmplifier=A block that can be used to merge,!nredirect and amplify laser beams,!nwith fine controls over when to fire tooltip.LaserTractorBeam=A block used to merge and!nredirect laser beams. Collects!ndrops from blocks it has broken. +tooltip.SolarNeutronActivator=A machine that directs the neutron radiation !nof the sun into its internal reservoir, allowing !nfor the slow creation of various isotopes. tooltip.HeatGenerator=A generator that uses the heat of lava or !nother burnable resources to produce energy. tooltip.SolarGenerator=A generator that uses the power !nof the sun to produce energy. @@ -729,11 +732,8 @@ nei.rotaryCondensentrator=R. Condensentrator //**********// //Items -item.BioFuel.name=Bio Fuel item.SolarPanel.name=Solar Panel - -//Infuse types -infuse.bio=Biomass +item.Hohlraum.name=Hohlraum //Generators tile.Generator.HeatGenerator.name=Heat Generator diff --git a/src/main/resources/assets/mekanism/textures/items/Hohlraum.png b/src/main/resources/assets/mekanism/textures/items/Hohlraum.png new file mode 100644 index 000000000..954b503dc Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/items/Hohlraum.png differ