diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index 409fed4a8..2dbfc0d44 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -867,6 +867,8 @@ public class ModBlocks { public static Block machine_geo; public static Block machine_minirtg; public static Block machine_powerrtg; + public static Block machine_radiolysis; + public static final int guiID_machine_radiolysis = 125; public static Block machine_well; public static Block oil_pipe; @@ -1785,7 +1787,8 @@ public class ModBlocks { machine_geo = new MachineAmgen(Material.iron).setBlockName("machine_geo").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); machine_minirtg = new MachineMiniRTG(Material.iron).setBlockName("machine_minirtg").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rtg_cell"); machine_powerrtg = new MachineMiniRTG(Material.iron).setBlockName("machine_powerrtg").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rtg_polonium"); - + machine_radiolysis = new MachineRadiolysis(Material.iron).setBlockName("machine_radiolysis").setHardness(10.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); + red_wire_coated = new WireCoated(Material.iron).setBlockName("red_wire_coated").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_wire_coated"); red_cable = new BlockCable(Material.iron).setBlockName("red_cable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":cable_neo"); rf_cable = new BlockRFCable(Material.iron).setBlockName("rf_cable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":rf_cable_icon"); @@ -2811,6 +2814,7 @@ public class ModBlocks { GameRegistry.registerBlock(machine_amgen, machine_amgen.getUnlocalizedName()); GameRegistry.registerBlock(machine_minirtg, machine_minirtg.getUnlocalizedName()); GameRegistry.registerBlock(machine_powerrtg, machine_powerrtg.getUnlocalizedName()); + GameRegistry.registerBlock(machine_radiolysis, machine_radiolysis.getUnlocalizedName()); GameRegistry.registerBlock(machine_spp_bottom, machine_spp_bottom.getUnlocalizedName()); GameRegistry.registerBlock(machine_spp_top, machine_spp_top.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/blocks/machine/MachineRadiolysis.java b/src/main/java/com/hbm/blocks/machine/MachineRadiolysis.java new file mode 100644 index 000000000..d048d7697 --- /dev/null +++ b/src/main/java/com/hbm/blocks/machine/MachineRadiolysis.java @@ -0,0 +1,71 @@ +package com.hbm.blocks.machine; + +import com.hbm.blocks.BlockDummyable; +import com.hbm.blocks.ModBlocks; +import com.hbm.handler.BossSpawnHandler; +import com.hbm.main.MainRegistry; +import com.hbm.tileentity.TileEntityProxyCombo; +import com.hbm.tileentity.machine.TileEntityMachineRadiolysis; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class MachineRadiolysis extends BlockDummyable { + + public MachineRadiolysis(Material mat) { + super(mat); + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + + if(meta >= 12) + return new TileEntityMachineRadiolysis(); + if(meta >= 6) + return new TileEntityProxyCombo(false, true, true); + + return null; + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + if(world.isRemote) { + return true; + } else if(!player.isSneaking()) { + BossSpawnHandler.markFBI(player); + + int[] pos = this.findCore(world, x, y, z); + + if(pos == null) + return false; + + FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_radiolysis, world, pos[0], pos[1], pos[2]); + return true; + } else { + return false; + } + } + + @Override + public int[] getDimensions() { + return new int[] {2, 0, 1, 1, 1, 1,}; + } + + @Override + public int getOffset() { + return 0; + } + + protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { + super.fillSpace(world, x, y, z, dir, o); + + this.makeExtra(world, x + dir.offsetX * o + 1, y, z + dir.offsetZ * o); + this.makeExtra(world, x + dir.offsetX * o - 1, y, z + dir.offsetZ * o); + this.makeExtra(world, x + dir.offsetX * o, y, z + dir.offsetZ * o + 1); + this.makeExtra(world, x + dir.offsetX * o, y, z + dir.offsetZ * o - 1); + } +} diff --git a/src/main/java/com/hbm/crafting/MineralRecipes.java b/src/main/java/com/hbm/crafting/MineralRecipes.java index b56c8f072..29ab3ae64 100644 --- a/src/main/java/com/hbm/crafting/MineralRecipes.java +++ b/src/main/java/com/hbm/crafting/MineralRecipes.java @@ -2,6 +2,7 @@ package com.hbm.crafting; import com.hbm.blocks.ModBlocks; import com.hbm.items.ModItems; +import com.hbm.items.machine.ItemRTGPelletDepleted.DepletedRTGMaterial; import com.hbm.items.special.ItemWasteLong; import com.hbm.items.special.ItemWasteShort; import static com.hbm.inventory.OreDictManager.*; @@ -11,6 +12,7 @@ import net.minecraft.block.Block; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; @@ -211,12 +213,22 @@ public class MineralRecipes { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.pellet_rtg_radium), new Object[] { ModItems.billet_ra226, ModItems.billet_ra226, ModItems.billet_ra226, "plateIron" })); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.pellet_rtg_weak), new Object[] { ModItems.billet_u238, ModItems.billet_u238, ModItems.billet_pu238, "plateIron" })); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.pellet_rtg_strontium), new Object[] { ModItems.billet_sr90, ModItems.billet_sr90, ModItems.billet_sr90, "plateIron" })); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.pellet_rtg_cobalt), new Object[] { ModItems.billet_co60, ModItems.billet_co60, ModItems.billet_co60, "plateIron" })); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.pellet_rtg_actinium), new Object[] { ModItems.billet_actinium, ModItems.billet_actinium, ModItems.billet_actinium, "plateIron" })); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.pellet_rtg_polonium), new Object[] { ModItems.billet_polonium, ModItems.billet_polonium, ModItems.billet_polonium, "plateIron" })); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.pellet_rtg_lead), new Object[] { ModItems.billet_pb209, ModItems.billet_pb209, ModItems.billet_pb209, "plateIron" })); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.pellet_rtg_gold), new Object[] { ModItems.billet_au198, ModItems.billet_au198, ModItems.billet_au198, "plateIron" })); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.pellet_rtg_americium), new Object[] { ModItems.billet_am241, ModItems.billet_am241, ModItems.billet_am241, "plateIron" })); + //There's no need for anvil recycling recipes if you simply set the container item + GameRegistry.addShapelessRecipe(new ItemStack(ModItems.billet_bismuth, 3), new Object[] { new ItemStack(ModItems.pellet_rtg_depleted, 1, DepletedRTGMaterial.BISMUTH.ordinal()) }); + GameRegistry.addShapelessRecipe(new ItemStack(ModItems.ingot_lead, 2), new Object[] { new ItemStack(ModItems.pellet_rtg_depleted, 1, DepletedRTGMaterial.LEAD.ordinal()) }); + GameRegistry.addShapelessRecipe(new ItemStack(ModItems.ingot_mercury, 2), new Object[] { new ItemStack(ModItems.pellet_rtg_depleted, 1, DepletedRTGMaterial.MERCURY.ordinal()) }); + GameRegistry.addShapelessRecipe(new ItemStack(ModItems.billet_neptunium, 3), new Object[] { new ItemStack(ModItems.pellet_rtg_depleted, 1, DepletedRTGMaterial.NEPTUNIUM.ordinal()) }); + GameRegistry.addShapelessRecipe(new ItemStack(ModItems.billet_zirconium, 3), new Object[] { new ItemStack(ModItems.pellet_rtg_depleted, 1, DepletedRTGMaterial.ZIRCONIUM.ordinal()) }); + if(OreDictionary.doesOreNameExist("ingotNickel")) + GameRegistry.addShapelessRecipe(new ItemStack(OreDictionary.getOres("ingotNickel").get(0).getItem(), 2), new Object[] { new ItemStack(ModItems.pellet_rtg_depleted, 1, DepletedRTGMaterial.NICKEL.ordinal()) }); + GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_copper), 1), new Object[] { "###", "###", "###", '#', ModItems.ingot_copper }); GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_fluorite), 1), new Object[] { "###", "###", "###", '#', ModItems.fluorite }); GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_niter), 1), new Object[] { "###", "###", "###", '#', ModItems.niter }); diff --git a/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java b/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java index dfbb1aa4c..cf49930bc 100644 --- a/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java @@ -19,6 +19,8 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + public class AnvilRecipes { @@ -596,18 +598,6 @@ public class AnvilRecipes { new AnvilOutput(new ItemStack(ModBlocks.crate_steel, 2)) }).setTier(4)); - //RTG - constructionRecipes.add(new AnvilConstructionRecipe(new ComparableStack(new ItemStack(ModItems.pellet_rtg_depleted, 1, DepletedRTGMaterial.BISMUTH.ordinal())), new AnvilOutput[] { - new AnvilOutput(new ItemStack(ModItems.billet_bismuth, 3)), new AnvilOutput(new ItemStack(ModItems.plate_iron, 1)) }).setTier(3)); - constructionRecipes.add(new AnvilConstructionRecipe(new ComparableStack(new ItemStack(ModItems.pellet_rtg_depleted, 1, DepletedRTGMaterial.LEAD.ordinal())), new AnvilOutput[] { - new AnvilOutput(new ItemStack(ModItems.ingot_lead, 2)), new AnvilOutput(new ItemStack(ModItems.plate_iron, 1)) }).setTier(3)); - constructionRecipes.add(new AnvilConstructionRecipe(new ComparableStack(new ItemStack(ModItems.pellet_rtg_depleted, 1, DepletedRTGMaterial.MERCURY.ordinal())), new AnvilOutput[] { - new AnvilOutput(new ItemStack(ModItems.ingot_mercury, 2)), new AnvilOutput(new ItemStack(ModItems.plate_iron, 1)) }).setTier(3)); - constructionRecipes.add(new AnvilConstructionRecipe(new ComparableStack(new ItemStack(ModItems.pellet_rtg_depleted, 1, DepletedRTGMaterial.NEPTUNIUM.ordinal())), new AnvilOutput[] { - new AnvilOutput(new ItemStack(ModItems.billet_neptunium, 3)), new AnvilOutput(new ItemStack(ModItems.plate_iron, 1)) }).setTier(3)); - constructionRecipes.add(new AnvilConstructionRecipe(new ComparableStack(new ItemStack(ModItems.pellet_rtg_depleted, 1, DepletedRTGMaterial.ZIRCONIUM.ordinal())), new AnvilOutput[] { - new AnvilOutput(new ItemStack(ModItems.billet_zirconium, 3)), new AnvilOutput(new ItemStack(ModItems.plate_iron, 1)) }).setTier(3)); - if(!GeneralConfig.enable528) { constructionRecipes.add(new AnvilConstructionRecipe( diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 0c2fd40ba..39282d584 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -724,16 +724,17 @@ public class ModItems { public static Item pellet_rtg_depleted; - public static Item pellet_rtg; public static Item pellet_rtg_radium; public static Item pellet_rtg_weak; - public static Item pellet_rtg_polonium; - public static Item pellet_rtg_actinium; + public static Item pellet_rtg; public static Item pellet_rtg_strontium; - public static Item pellet_rtg_lead; - public static Item pellet_rtg_gold; + public static Item pellet_rtg_cobalt; + public static Item pellet_rtg_actinium; + public static Item pellet_rtg_polonium; public static Item pellet_rtg_americium; public static Item pellet_rtg_berkelium; + public static Item pellet_rtg_gold; + public static Item pellet_rtg_lead; public static Item tritium_deuterium_cake; @@ -3095,18 +3096,19 @@ public class ModItems { wiring_red_copper = new ItemWiring().setUnlocalizedName("wiring_red_copper").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":wiring_red_copper"); - pellet_rtg_depleted = new ItemRTGPelletDepleted().setUnlocalizedName("pellet_rtg_depleted").setCreativeTab(MainRegistry.controlTab); //TODO: add localization; uncrafting recipes; make radiation scale with depletion for rtgs + pellet_rtg_depleted = new ItemRTGPelletDepleted().setContainerItem(plate_iron).setUnlocalizedName("pellet_rtg_depleted").setCreativeTab(MainRegistry.controlTab); - pellet_rtg = new ItemRTGPellet(10).setDecays(DepletedRTGMaterial.LEAD, (long) (RTGUtil.getLifespan(87.7F, HalfLifeType.MEDIUM, false) * 1.5)).setUnlocalizedName("pellet_rtg").setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":pellet_rtg"); pellet_rtg_radium = new ItemRTGPellet(3).setDecays(DepletedRTGMaterial.LEAD, (long) (RTGUtil.getLifespan(16.0F, HalfLifeType.LONG, false) * 1.5)).setUnlocalizedName("pellet_rtg_radium").setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":pellet_rtg_radium"); pellet_rtg_weak = new ItemRTGPellet(5).setDecays(DepletedRTGMaterial.LEAD, (long) (RTGUtil.getLifespan(1.0F, HalfLifeType.LONG, false) * 1.5)).setUnlocalizedName("pellet_rtg_weak").setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":pellet_rtg_weak"); - pellet_rtg_polonium = new ItemRTGPellet(50).setDecays(DepletedRTGMaterial.LEAD, (long) (RTGUtil.getLifespan(138.0F, HalfLifeType.SHORT, false) * 1.5)).setUnlocalizedName("pellet_rtg_polonium").setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":pellet_rtg_polonium"); - pellet_rtg_actinium = new ItemRTGPellet(20).setDecays(DepletedRTGMaterial.LEAD, (long) (RTGUtil.getLifespan(21.7F, HalfLifeType.MEDIUM, false) * 1.5)).setUnlocalizedName("pellet_rtg_actinium").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":pellet_rtg_actinium"); + pellet_rtg = new ItemRTGPellet(10).setDecays(DepletedRTGMaterial.LEAD, (long) (RTGUtil.getLifespan(87.7F, HalfLifeType.MEDIUM, false) * 1.5)).setUnlocalizedName("pellet_rtg").setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":pellet_rtg"); pellet_rtg_strontium = new ItemRTGPellet(15).setDecays(DepletedRTGMaterial.ZIRCONIUM, (long) (RTGUtil.getLifespan(29.0F, HalfLifeType.MEDIUM, false) * 1.5)).setUnlocalizedName("pellet_rtg_strontium").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":pellet_rtg_strontium"); - pellet_rtg_lead = new ItemRTGPellet(VersatileConfig.rtgDecay() ? 600 : 200).setDecays(DepletedRTGMaterial.BISMUTH, (long) (RTGUtil.getLifespan(0.3F, HalfLifeType.SHORT, false) * 1.5)).setUnlocalizedName("pellet_rtg_lead").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":pellet_rtg_lead"); - pellet_rtg_gold = new ItemRTGPellet(VersatileConfig.rtgDecay() ? 300 : 100).setDecays(DepletedRTGMaterial.MERCURY, (long) (RTGUtil.getLifespan(2.7F, HalfLifeType.SHORT, false) * 1.5)).setUnlocalizedName("pellet_rtg_gold").setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":pellet_rtg_gold"); + pellet_rtg_cobalt = new ItemRTGPellet(15).setDecays(DepletedRTGMaterial.NICKEL, (long) (RTGUtil.getLifespan(29.0F, HalfLifeType.MEDIUM, false) * 1.5)).setUnlocalizedName("pellet_rtg_cobalt").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":pellet_rtg_cobalt"); + pellet_rtg_actinium = new ItemRTGPellet(20).setDecays(DepletedRTGMaterial.LEAD, (long) (RTGUtil.getLifespan(5.3F, HalfLifeType.MEDIUM, false) * 1.5)).setUnlocalizedName("pellet_rtg_actinium").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":pellet_rtg_actinium"); pellet_rtg_americium = new ItemRTGPellet(20).setDecays(DepletedRTGMaterial.NEPTUNIUM, (long) (RTGUtil.getLifespan(4.7F, HalfLifeType.LONG, false) * 1.5)).setUnlocalizedName("pellet_rtg_americium").setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":pellet_rtg_americium"); pellet_rtg_berkelium = new ItemRTGPellet(20).setUnlocalizedName("pellet_rtg_berkelium").setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":pellet_rtg_berkelium"); + pellet_rtg_polonium = new ItemRTGPellet(50).setDecays(DepletedRTGMaterial.LEAD, (long) (RTGUtil.getLifespan(138.0F, HalfLifeType.SHORT, false) * 1.5)).setUnlocalizedName("pellet_rtg_polonium").setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":pellet_rtg_polonium"); + pellet_rtg_gold = new ItemRTGPellet(VersatileConfig.rtgDecay() ? 300 : 100).setDecays(DepletedRTGMaterial.MERCURY, (long) (RTGUtil.getLifespan(2.7F, HalfLifeType.SHORT, false) * 1.5)).setUnlocalizedName("pellet_rtg_gold").setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":pellet_rtg_gold"); + pellet_rtg_lead = new ItemRTGPellet(VersatileConfig.rtgDecay() ? 600 : 200).setDecays(DepletedRTGMaterial.BISMUTH, (long) (RTGUtil.getLifespan(0.3F, HalfLifeType.SHORT, false) * 1.5)).setUnlocalizedName("pellet_rtg_lead").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":pellet_rtg_lead"); tritium_deuterium_cake = new ItemCustomLore().setUnlocalizedName("tritium_deuterium_cake").setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":tritium_deuterium_cake"); @@ -6151,16 +6153,17 @@ public class ModItems { GameRegistry.registerItem(flame_opinion, flame_opinion.getUnlocalizedName()); //Pellets - GameRegistry.registerItem(pellet_rtg, pellet_rtg.getUnlocalizedName()); GameRegistry.registerItem(pellet_rtg_radium, pellet_rtg_radium.getUnlocalizedName()); GameRegistry.registerItem(pellet_rtg_weak, pellet_rtg_weak.getUnlocalizedName()); - GameRegistry.registerItem(pellet_rtg_polonium, pellet_rtg_polonium.getUnlocalizedName()); + GameRegistry.registerItem(pellet_rtg, pellet_rtg.getUnlocalizedName()); GameRegistry.registerItem(pellet_rtg_strontium, pellet_rtg_strontium.getUnlocalizedName()); + GameRegistry.registerItem(pellet_rtg_cobalt, pellet_rtg_cobalt.getUnlocalizedName()); GameRegistry.registerItem(pellet_rtg_actinium, pellet_rtg_actinium.getUnlocalizedName()); - GameRegistry.registerItem(pellet_rtg_lead, pellet_rtg_lead.getUnlocalizedName()); - GameRegistry.registerItem(pellet_rtg_gold, pellet_rtg_gold.getUnlocalizedName()); + GameRegistry.registerItem(pellet_rtg_polonium, pellet_rtg_polonium.getUnlocalizedName()); GameRegistry.registerItem(pellet_rtg_americium, pellet_rtg_americium.getUnlocalizedName()); GameRegistry.registerItem(pellet_rtg_berkelium, pellet_rtg_berkelium.getUnlocalizedName()); + GameRegistry.registerItem(pellet_rtg_gold, pellet_rtg_gold.getUnlocalizedName()); + GameRegistry.registerItem(pellet_rtg_lead, pellet_rtg_lead.getUnlocalizedName()); GameRegistry.registerItem(pellet_rtg_depleted, pellet_rtg_depleted.getUnlocalizedName()); GameRegistry.registerItem(tritium_deuterium_cake, tritium_deuterium_cake.getUnlocalizedName()); GameRegistry.registerItem(pellet_cluster, pellet_cluster.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/items/machine/ItemRTGPelletDepleted.java b/src/main/java/com/hbm/items/machine/ItemRTGPelletDepleted.java index f6d932e70..f560f400a 100644 --- a/src/main/java/com/hbm/items/machine/ItemRTGPelletDepleted.java +++ b/src/main/java/com/hbm/items/machine/ItemRTGPelletDepleted.java @@ -13,6 +13,7 @@ public class ItemRTGPelletDepleted extends ItemEnumMulti { MERCURY, NEPTUNIUM, LEAD, - ZIRCONIUM; + ZIRCONIUM, + NICKEL; } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadiolysis.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadiolysis.java new file mode 100644 index 000000000..dd53f06f8 --- /dev/null +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadiolysis.java @@ -0,0 +1,255 @@ +package com.hbm.tileentity.machine; + +import java.util.List; + +import com.hbm.interfaces.IFluidAcceptor; +import com.hbm.interfaces.IFluidContainer; +import com.hbm.interfaces.IFluidSource; +import com.hbm.inventory.FluidTank; +import com.hbm.inventory.fluid.FluidType; +import com.hbm.inventory.fluid.Fluids; +import com.hbm.inventory.recipes.RefineryRecipes; +import com.hbm.items.machine.ItemRTGPellet; +import com.hbm.items.machine.ItemRTGPelletDepleted; +import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.util.RTGUtil; +import com.hbm.util.Tuple.Quartet; + +import api.hbm.energy.IEnergyGenerator; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import scala.actors.threadpool.Arrays; + +public class TileEntityMachineRadiolysis extends TileEntityMachineBase implements IEnergyGenerator, IFluidAcceptor, IFluidSource, IFluidContainer { + + public long power; + public int progress; + public static final int maxProgress = 100; + public static final int maxPower = 1000000; + + public FluidTank[] tanks; + + private static final int[] slot_io = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 13 }; + private static final int[] slot_rtg = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + + public TileEntityMachineRadiolysis() { + super(14); //10 rtg slots, 2 fluid ID slots, 2 irradiation slots + tanks = new FluidTank[3]; + tanks[0] = new FluidTank(Fluids.NONE, 8000, 0); + tanks[1] = new FluidTank(Fluids.NONE, 8000, 1); + tanks[2] = new FluidTank(Fluids.NONE, 8000, 2); + } + + @Override + public String getName() { + return "container.radiolysis"; + } + + //IO Methods + @Override + public boolean isItemValidForSlot(int i, ItemStack itemStack) { + return i == 12 || (i < 10 && itemStack.getItem() instanceof ItemRTGPellet); + } + + @Override + public int[] getAccessibleSlotsFromSide(int side) { + return slot_io; + } + + @Override + public boolean canExtractItem(int i, ItemStack itemStack, int j) { + return (i < 10 && itemStack.getItem() instanceof ItemRTGPelletDepleted) || i == 13; + } + + //NBT Methods + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + this.power = nbt.getLong("power"); + this.progress = nbt.getInteger("progress"); + + tanks[0].readFromNBT(nbt, "input"); + tanks[1].readFromNBT(nbt, "output1"); + tanks[2].readFromNBT(nbt, "output2"); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setLong("power", power); + nbt.setInteger("progress", progress); + + tanks[0].writeToNBT(nbt, "input"); + tanks[1].writeToNBT(nbt, "output1"); + tanks[2].writeToNBT(nbt, "output2"); + } + + public void networkUnpack(NBTTagCompound data) { + this.power = data.getLong("power"); + this.progress = data.getInteger("progress"); + } + + @Override + public void updateEntity() { + + if(!worldObj.isRemote) { + int heat = RTGUtil.updateRTGs(slots, slot_io); + power += heat * 15; + + if(power > maxPower) + power = maxPower; + + setupTanks(); + + if(heat > 0) { + progress += heat; + if(progress >= maxProgress) { + crack(); + progress = 0; + } + } else { + progress = 0; + } + + NBTTagCompound data = new NBTTagCompound(); + data.setLong("power", power); + data.setInteger("progress", progress); + this.networkPack(data, 50); + } + } + + //Processing Methods + private boolean canDoRadiolysis() { + + + + return false; + } + + private void crack() { + + Quartet quart = RefineryRecipes.getCracking(tanks[0].getTankType()); + + if(quart != null) { + + int left = quart.getY(); + int right = quart.getZ(); + + if(tanks[0].getFill() >= 100 && hasSpace(left, right)) { + tanks[0].setFill(tanks[0].getFill() - 100); + tanks[1].setFill(tanks[2].getFill() + left); + tanks[2].setFill(tanks[3].getFill() + right); + } + } + } + + private boolean hasSpace(int left, int right) { + return tanks[2].getFill() + left <= tanks[2].getMaxFill() && tanks[3].getFill() + right <= tanks[3].getMaxFill(); + } + + private void setupTanks() { + + Quartet quart = RefineryRecipes.getCracking(tanks[0].getTankType()); + + if(quart != null) { + tanks[1].setTankType(quart.getW()); + tanks[2].setTankType(quart.getX()); + } else { + tanks[0].setTankType(Fluids.NONE); + tanks[1].setTankType(Fluids.NONE); + tanks[2].setTankType(Fluids.NONE); + } + + } + + //Power methods + @Override + public void setPower(long power) { + this.power = power; + } + + @Override + public long getPower() { + return power; + } + + @Override + public long getMaxPower() { + return maxPower; + } + + //Fluid Methods + @Override + public void setFillstate(int fill, int index) { + if(index < 3 && tanks[index] != null) + tanks[index].setFill(fill); + } + + @Override + public void setFluidFill(int fill, FluidType type) { + for(FluidTank tank : tanks) { + if(tank.getTankType() == type) { + tank.setFill(fill); + } + } + } + + @Override + public void setType(FluidType type, int index) { + this.tanks[index].setTankType(type); + } + + @Override + public List getTanks() { + return Arrays.asList(this.tanks); + } + + @Override + public int getFluidFill(FluidType type) { + for(FluidTank tank : tanks) { + if(tank.getTankType() == type) { + return tank.getFill(); + } + } + return 0; + } + + @Override + public int getMaxFluidFill(FluidType type) { + if(type == tanks[0].getTankType()) + return tanks[0].getMaxFill(); + else + return 0; + } + + @Override + public void fillFluidInit(FluidType type) { + // TODO Auto-generated method stub + + } + + @Override + public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) { + // TODO Auto-generated method stub + + } + + @Override + public boolean getTact() { + return worldObj.getTotalWorldTime() % 10 == 0; + } + + @Override + public List getFluidList(FluidType type) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void clearFluidList(FluidType type) { + // TODO Auto-generated method stub + + } +} diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index d47fecc0c..75fc0909d 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -2266,10 +2266,13 @@ item.pellet_rtg_americium.name=Americium-241 RTG Pellet item.pellet_rtg_americium.desc=Rare and reliable, good old Americium! item.pellet_rtg_berkelium.name=Berkelium RTG Pellet item.pellet_rtg_berkelium.desc= +item.pellet_rtg_cobalt.name=Cobalt-60 RTG Pellet +item.pellet_rtg_cobalt.desc=Not the best as an RTG, but great for gamma radiation! item.pellet_rtg_depleted.bismuth.name=Decayed Bismuth RTG Pellet item.pellet_rtg_depleted.lead.name=Decayed Lead RTG Pellet item.pellet_rtg_depleted.neptunium.name=Decayed Neptunium RTG Pellet item.pellet_rtg_depleted.mercury.name=Decayed Mercury RTG Pellet +item.pellet_rtg_depleted.nickel.name=Decayed Nickel RTG Pellet item.pellet_rtg_depleted.zirconium.name=Decayed Zirconium RTG Pellet item.pellet_rtg_lead.name=Lead-209 RTG Pellet item.pellet_rtg_lead.desc=Exposure will result in immediate death. diff --git a/src/main/resources/assets/hbm/textures/items/pellet_rtg_cobalt.png b/src/main/resources/assets/hbm/textures/items/pellet_rtg_cobalt.png new file mode 100644 index 000000000..2b422f3a2 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pellet_rtg_cobalt.png differ diff --git a/src/main/resources/assets/hbm/textures/items/pellet_rtg_depleted.nickel.png b/src/main/resources/assets/hbm/textures/items/pellet_rtg_depleted.nickel.png new file mode 100644 index 000000000..4947f0e29 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/pellet_rtg_depleted.nickel.png differ