diff --git a/src/main/java/com/hbm/inventory/AnvilRecipes.java b/src/main/java/com/hbm/inventory/AnvilRecipes.java index 573c76e60..5a95c30c1 100644 --- a/src/main/java/com/hbm/inventory/AnvilRecipes.java +++ b/src/main/java/com/hbm/inventory/AnvilRecipes.java @@ -102,6 +102,7 @@ public class AnvilRecipes { constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack("dustEmerald"), new AnvilOutput(new ItemStack(Items.emerald))).setTier(3)); registerConstructionAmmo(); + registerConstructionUpgrades(); registerConstructionRecycling(); } @@ -283,6 +284,34 @@ public class AnvilRecipes { } } + public static void registerConstructionUpgrades() { + pullFromAssembler(new ComparableStack(ModItems.upgrade_template), 2); + pullFromAssembler(new ComparableStack(ModItems.upgrade_speed_1), 2); + pullFromAssembler(new ComparableStack(ModItems.upgrade_speed_2), 3); + pullFromAssembler(new ComparableStack(ModItems.upgrade_speed_3), 4); + pullFromAssembler(new ComparableStack(ModItems.upgrade_power_1), 2); + pullFromAssembler(new ComparableStack(ModItems.upgrade_power_2), 3); + pullFromAssembler(new ComparableStack(ModItems.upgrade_power_3), 4); + pullFromAssembler(new ComparableStack(ModItems.upgrade_effect_1), 2); + pullFromAssembler(new ComparableStack(ModItems.upgrade_effect_2), 3); + pullFromAssembler(new ComparableStack(ModItems.upgrade_effect_3), 4); + pullFromAssembler(new ComparableStack(ModItems.upgrade_fortune_1), 2); + pullFromAssembler(new ComparableStack(ModItems.upgrade_fortune_2), 3); + pullFromAssembler(new ComparableStack(ModItems.upgrade_fortune_3), 4); + pullFromAssembler(new ComparableStack(ModItems.upgrade_afterburn_1), 2); + pullFromAssembler(new ComparableStack(ModItems.upgrade_afterburn_2), 3); + pullFromAssembler(new ComparableStack(ModItems.upgrade_afterburn_3), 4); + + pullFromAssembler(new ComparableStack(ModItems.upgrade_radius), 4); + pullFromAssembler(new ComparableStack(ModItems.upgrade_health), 4); + pullFromAssembler(new ComparableStack(ModItems.upgrade_smelter), 4); + pullFromAssembler(new ComparableStack(ModItems.upgrade_shredder), 4); + pullFromAssembler(new ComparableStack(ModItems.upgrade_centrifuge), 4); + pullFromAssembler(new ComparableStack(ModItems.upgrade_crystallizer), 4); + pullFromAssembler(new ComparableStack(ModItems.upgrade_nullifier), 4); + pullFromAssembler(new ComparableStack(ModItems.upgrade_screm), 4); + } + public static void registerConstructionRecycling() { constructionRecipes.add(new AnvilConstructionRecipe( new ComparableStack(ModBlocks.barrel_tcalloy), @@ -396,6 +425,15 @@ public class AnvilRecipes { ).setTier(4)); } + public static void pullFromAssembler(ComparableStack result, int tier) { + + AStack[] ingredients = AssemblerRecipes.recipes.get(result); + + if(ingredients != null) { + constructionRecipes.add(new AnvilConstructionRecipe(ingredients, new AnvilOutput(result.toStack())).setTier(tier)); + } + } + public static List getSmithing() { return smithingRecipes; } diff --git a/src/main/java/com/hbm/inventory/AnvilSmithingCyanideRecipe.java b/src/main/java/com/hbm/inventory/AnvilSmithingCyanideRecipe.java index e4429d25e..d0b3918e5 100644 --- a/src/main/java/com/hbm/inventory/AnvilSmithingCyanideRecipe.java +++ b/src/main/java/com/hbm/inventory/AnvilSmithingCyanideRecipe.java @@ -11,7 +11,7 @@ import net.minecraft.nbt.NBTTagCompound; public class AnvilSmithingCyanideRecipe extends AnvilSmithingRecipe { public AnvilSmithingCyanideRecipe() { - super(0, new ItemStack(Items.bread), new ComparableStack(Items.bread), new ComparableStack(ModItems.plan_c)); + super(1, new ItemStack(Items.bread), new ComparableStack(Items.bread), new ComparableStack(ModItems.plan_c)); if(!this.output.hasTagCompound()) this.output.stackTagCompound = new NBTTagCompound(); diff --git a/src/main/java/com/hbm/inventory/AnvilSmithingRenameRecipe.java b/src/main/java/com/hbm/inventory/AnvilSmithingRenameRecipe.java index 62d54009f..1b508825d 100644 --- a/src/main/java/com/hbm/inventory/AnvilSmithingRenameRecipe.java +++ b/src/main/java/com/hbm/inventory/AnvilSmithingRenameRecipe.java @@ -9,7 +9,7 @@ import net.minecraft.nbt.NBTTagCompound; public class AnvilSmithingRenameRecipe extends AnvilSmithingRecipe { public AnvilSmithingRenameRecipe() { - super(0, new ItemStack(Items.iron_sword), new ComparableStack(Items.iron_sword), new ComparableStack(Items.name_tag, 0)); + super(1, new ItemStack(Items.iron_sword), new ComparableStack(Items.iron_sword), new ComparableStack(Items.name_tag, 0)); } @Override diff --git a/src/main/java/com/hbm/inventory/AssemblerRecipes.java b/src/main/java/com/hbm/inventory/AssemblerRecipes.java index 5643b6982..a1e99e05e 100644 --- a/src/main/java/com/hbm/inventory/AssemblerRecipes.java +++ b/src/main/java/com/hbm/inventory/AssemblerRecipes.java @@ -237,9 +237,9 @@ public class AssemblerRecipes { makeRecipe(new ComparableStack(ModItems.upgrade_afterburn_3, 1), new AStack[] {new ComparableStack(ModItems.upgrade_afterburn_2, 1), new ComparableStack(ModItems.powder_polymer, 2), new OreDictStack("dustTungsten", 6), new OreDictStack("ingotDesh", 4), },500); makeRecipe(new ComparableStack(ModItems.upgrade_radius, 1), new AStack[] {new ComparableStack(ModItems.upgrade_template, 1), new ComparableStack(Items.glowstone_dust, 6), new OreDictStack("dustDiamond", 4), },500); makeRecipe(new ComparableStack(ModItems.upgrade_health, 1), new AStack[] {new ComparableStack(ModItems.upgrade_template, 1), new ComparableStack(Items.glowstone_dust, 6), new OreDictStack("dustTitanium", 4), },500); - makeRecipe(new ComparableStack(ModItems.upgrade_overdrive_1, 1), new AStack[] {new ComparableStack(ModItems.upgrade_speed_3, 4), new ComparableStack(ModItems.upgrade_effect_3, 2), new OreDictStack("ingotDesh", 8), new ComparableStack(ModItems.powder_power, 16), new ComparableStack(ModItems.crystal_lithium, 4), new ComparableStack(ModItems.circuit_schrabidium, 4), },200); - makeRecipe(new ComparableStack(ModItems.upgrade_overdrive_2, 1), new AStack[] {new ComparableStack(ModItems.upgrade_overdrive_1, 1), new ComparableStack(ModItems.upgrade_afterburn_1, 1), new ComparableStack(ModItems.upgrade_speed_3, 2), new ComparableStack(ModItems.upgrade_effect_3, 2), new ComparableStack(ModItems.ingot_saturnite, 12), new ComparableStack(ModItems.powder_nitan_mix, 16), new ComparableStack(ModItems.crystal_starmetal, 6), new ComparableStack(ModItems.circuit_schrabidium, 6), },300); - makeRecipe(new ComparableStack(ModItems.upgrade_overdrive_3, 1), new AStack[] {new ComparableStack(ModItems.upgrade_overdrive_2, 1), new ComparableStack(ModItems.upgrade_afterburn_1, 1), new ComparableStack(ModItems.upgrade_speed_3, 2), new ComparableStack(ModItems.upgrade_effect_3, 2), new OreDictStack("ingotDesh", 8), new ComparableStack(ModItems.powder_power, 16), new ComparableStack(ModItems.crystal_lithium, 4), new ComparableStack(ModItems.circuit_schrabidium, 4), },500); + makeRecipe(new ComparableStack(ModItems.upgrade_overdrive_1, 1), new AStack[] {new ComparableStack(ModItems.upgrade_speed_3, 1), new ComparableStack(ModItems.upgrade_effect_3, 1), new OreDictStack("ingotDesh", 8), new ComparableStack(ModItems.powder_power, 16), new ComparableStack(ModItems.crystal_lithium, 4), new ComparableStack(ModItems.circuit_schrabidium, 1), }, 200); + makeRecipe(new ComparableStack(ModItems.upgrade_overdrive_2, 1), new AStack[] {new ComparableStack(ModItems.upgrade_overdrive_1, 1), new ComparableStack(ModItems.upgrade_afterburn_1, 1), new ComparableStack(ModItems.upgrade_speed_3, 1), new ComparableStack(ModItems.upgrade_effect_3, 1), new ComparableStack(ModItems.crystal_lithium, 8), new ComparableStack(ModItems.circuit_tantalium, 16), }, 300); + makeRecipe(new ComparableStack(ModItems.upgrade_overdrive_3, 1), new AStack[] {new ComparableStack(ModItems.upgrade_overdrive_2, 1), new ComparableStack(ModItems.upgrade_afterburn_1, 1), new ComparableStack(ModItems.upgrade_speed_3, 1), new ComparableStack(ModItems.upgrade_effect_3, 1), new ComparableStack(ModItems.crystal_lithium, 16), new ComparableStack(ModItems.circuit_bismuth, 1), }, 500); makeRecipe(new ComparableStack(ModItems.fuse, 1), new AStack[] {new OreDictStack("plateSteel", 2), new ComparableStack(Blocks.glass_pane, 1), new ComparableStack(ModItems.wire_aluminium, 1), },100); makeRecipe(new ComparableStack(ModItems.redcoil_capacitor, 1), new AStack[] {new OreDictStack("plateGold", 3), new ComparableStack(ModItems.fuse, 1), new ComparableStack(ModItems.wire_advanced_alloy, 4), new ComparableStack(ModItems.coil_advanced_alloy, 6), new ComparableStack(Blocks.redstone_block, 2), },200); makeRecipe(new ComparableStack(ModItems.titanium_filter, 1), new AStack[] {new OreDictStack("plateLead", 3), new ComparableStack(ModItems.fuse, 1), new ComparableStack(ModItems.wire_tungsten, 4), new OreDictStack("plateTitanium", 6), new ComparableStack(ModItems.ingot_u238, 2), },200); diff --git a/src/main/java/com/hbm/inventory/OreDictManager.java b/src/main/java/com/hbm/inventory/OreDictManager.java index 0923c7a44..c2028d07d 100644 --- a/src/main/java/com/hbm/inventory/OreDictManager.java +++ b/src/main/java/com/hbm/inventory/OreDictManager.java @@ -278,6 +278,7 @@ public class OreDictManager { OreDictionary.registerOre("blockZirconium", ModBlocks.block_zirconium); OreDictionary.registerOre("blockBoron", ModBlocks.block_boron); OreDictionary.registerOre("blockColtan", ModBlocks.block_coltan); + OreDictionary.registerOre("blockLithium", ModBlocks.block_lithium); OreDictionary.registerOre("blockThorium", ModBlocks.block_thorium); OreDictionary.registerOre("blockThorium232", ModBlocks.block_thorium); diff --git a/src/main/java/com/hbm/inventory/UpgradeManager.java b/src/main/java/com/hbm/inventory/UpgradeManager.java new file mode 100644 index 000000000..39c366de4 --- /dev/null +++ b/src/main/java/com/hbm/inventory/UpgradeManager.java @@ -0,0 +1,50 @@ +package com.hbm.inventory; + +import java.util.HashMap; + +import com.hbm.interfaces.Untested; +import com.hbm.items.machine.ItemMachineUpgrade; +import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; + +import net.minecraft.item.ItemStack; + +public class UpgradeManager { + + private static HashMap upgrades = new HashMap(); + private static UpgradeType mutexType = null; + + @Untested + public static void eval(ItemStack[] slots, int start, int end) { + + upgrades.clear(); + + for(int i = start; i <= end; i++) { + + if(slots[i] != null && slots[i].getItem() instanceof ItemMachineUpgrade) { + ItemMachineUpgrade item = (ItemMachineUpgrade) slots[i].getItem(); + + if(item.type.mutex) { + + if(mutexType == null || mutexType.ordinal() < item.type.ordinal()) { + mutexType = item.type; + } + + } else { + Integer up = upgrades.get(item.type); + int upgrade = (up == null ? 0 : up); + upgrade += item.tier; + upgrades.put(item.type, upgrade); + } + } + } + } + + public static int getLevel(UpgradeType type) { + Integer up = upgrades.get(type); + return up == null ? 0 : up; + } + + public static UpgradeType getMinerMutex() { + return mutexType; + } +} diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 345af4ae3..96699b7d2 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -11,6 +11,7 @@ import com.hbm.items.armor.*; import com.hbm.items.bomb.*; import com.hbm.items.food.*; import com.hbm.items.machine.*; +import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; import com.hbm.items.machine.ItemRBMKRod.EnumBurnFunc; import com.hbm.items.special.*; import com.hbm.items.tool.*; @@ -4346,33 +4347,33 @@ public class ModItems { fusion_shield_chlorophyte = new ItemFusionShield(60 * 60 * 60 * 15, 9000).setUnlocalizedName("fusion_shield_chlorophyte").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fusion_shield_chlorophyte"); fusion_shield_vaporwave = new ItemFusionShield(60 * 60 * 60 * 10, 1916169).setUnlocalizedName("fusion_shield_vaporwave").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fusion_shield_vaporwave"); - upgrade_template = new ItemCustomLore().setUnlocalizedName("upgrade_template").setMaxStackSize(1).setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":upgrade_template"); - upgrade_speed_1 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_speed_1").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_speed_1"); - upgrade_speed_2 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_speed_2").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_speed_2"); - upgrade_speed_3 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_speed_3").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_speed_3"); - upgrade_effect_1 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_effect_1").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_effect_1"); - upgrade_effect_2 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_effect_2").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_effect_2"); - upgrade_effect_3 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_effect_3").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_effect_3"); - upgrade_power_1 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_power_1").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_power_1"); - upgrade_power_2 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_power_2").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_power_2"); - upgrade_power_3 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_power_3").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_power_3"); - upgrade_fortune_1 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_fortune_1").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_fortune_1"); - upgrade_fortune_2 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_fortune_2").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_fortune_2"); - upgrade_fortune_3 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_fortune_3").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_fortune_3"); - upgrade_afterburn_1 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_afterburn_1").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_afterburn_1"); - upgrade_afterburn_2 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_afterburn_2").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_afterburn_2"); - upgrade_afterburn_3 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_afterburn_3").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_afterburn_3"); - upgrade_overdrive_1 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_overdrive_1").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_overdrive_1"); - upgrade_overdrive_2 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_overdrive_2").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_overdrive_2"); - upgrade_overdrive_3 = new ItemMachineUpgrade().setUnlocalizedName("upgrade_overdrive_3").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_overdrive_3"); + upgrade_template = new ItemCustomLore().setUnlocalizedName("upgrade_template").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":upgrade_template"); + upgrade_speed_1 = new ItemMachineUpgrade(UpgradeType.SPEED, 1).setUnlocalizedName("upgrade_speed_1").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_speed_1"); + upgrade_speed_2 = new ItemMachineUpgrade(UpgradeType.SPEED, 2).setUnlocalizedName("upgrade_speed_2").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_speed_2"); + upgrade_speed_3 = new ItemMachineUpgrade(UpgradeType.SPEED, 3).setUnlocalizedName("upgrade_speed_3").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_speed_3"); + upgrade_effect_1 = new ItemMachineUpgrade(UpgradeType.EFFECT, 1).setUnlocalizedName("upgrade_effect_1").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_effect_1"); + upgrade_effect_2 = new ItemMachineUpgrade(UpgradeType.EFFECT, 2).setUnlocalizedName("upgrade_effect_2").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_effect_2"); + upgrade_effect_3 = new ItemMachineUpgrade(UpgradeType.EFFECT, 3).setUnlocalizedName("upgrade_effect_3").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_effect_3"); + upgrade_power_1 = new ItemMachineUpgrade(UpgradeType.POWER, 1).setUnlocalizedName("upgrade_power_1").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_power_1"); + upgrade_power_2 = new ItemMachineUpgrade(UpgradeType.POWER, 2).setUnlocalizedName("upgrade_power_2").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_power_2"); + upgrade_power_3 = new ItemMachineUpgrade(UpgradeType.POWER, 3).setUnlocalizedName("upgrade_power_3").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_power_3"); + upgrade_fortune_1 = new ItemMachineUpgrade(UpgradeType.FORTUNE, 1).setUnlocalizedName("upgrade_fortune_1").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_fortune_1"); + upgrade_fortune_2 = new ItemMachineUpgrade(UpgradeType.FORTUNE, 2).setUnlocalizedName("upgrade_fortune_2").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_fortune_2"); + upgrade_fortune_3 = new ItemMachineUpgrade(UpgradeType.FORTUNE, 3).setUnlocalizedName("upgrade_fortune_3").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_fortune_3"); + upgrade_afterburn_1 = new ItemMachineUpgrade(UpgradeType.AFTERBURN, 1).setUnlocalizedName("upgrade_afterburn_1").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_afterburn_1"); + upgrade_afterburn_2 = new ItemMachineUpgrade(UpgradeType.AFTERBURN, 2).setUnlocalizedName("upgrade_afterburn_2").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_afterburn_2"); + upgrade_afterburn_3 = new ItemMachineUpgrade(UpgradeType.AFTERBURN, 3).setUnlocalizedName("upgrade_afterburn_3").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_afterburn_3"); + upgrade_overdrive_1 = new ItemMachineUpgrade(UpgradeType.OVERDRIVE, 1).setUnlocalizedName("upgrade_overdrive_1").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_overdrive_1"); + upgrade_overdrive_2 = new ItemMachineUpgrade(UpgradeType.OVERDRIVE, 2).setUnlocalizedName("upgrade_overdrive_2").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_overdrive_2"); + upgrade_overdrive_3 = new ItemMachineUpgrade(UpgradeType.OVERDRIVE, 3).setUnlocalizedName("upgrade_overdrive_3").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_overdrive_3"); upgrade_radius = new ItemMachineUpgrade().setUnlocalizedName("upgrade_radius").setMaxStackSize(16).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_radius"); upgrade_health = new ItemMachineUpgrade().setUnlocalizedName("upgrade_health").setMaxStackSize(16).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_health"); - upgrade_smelter = new ItemMachineUpgrade().setUnlocalizedName("upgrade_smelter").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_smelter"); - upgrade_shredder = new ItemMachineUpgrade().setUnlocalizedName("upgrade_shredder").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_shredder"); - upgrade_centrifuge = new ItemMachineUpgrade().setUnlocalizedName("upgrade_centrifuge").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_centrifuge"); - upgrade_crystallizer = new ItemMachineUpgrade().setUnlocalizedName("upgrade_crystallizer").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_crystallizer"); - upgrade_nullifier = new ItemMachineUpgrade().setUnlocalizedName("upgrade_nullifier").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_nullifier"); - upgrade_screm = new ItemMachineUpgrade().setUnlocalizedName("upgrade_screm").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_screm"); + upgrade_smelter = new ItemMachineUpgrade().setUnlocalizedName("upgrade_smelter").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_smelter"); + upgrade_shredder = new ItemMachineUpgrade().setUnlocalizedName("upgrade_shredder").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_shredder"); + upgrade_centrifuge = new ItemMachineUpgrade().setUnlocalizedName("upgrade_centrifuge").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_centrifuge"); + upgrade_crystallizer = new ItemMachineUpgrade().setUnlocalizedName("upgrade_crystallizer").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_crystallizer"); + upgrade_nullifier = new ItemMachineUpgrade().setUnlocalizedName("upgrade_nullifier").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_nullifier"); + upgrade_screm = new ItemMachineUpgrade().setUnlocalizedName("upgrade_screm").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_screm"); wand = new ItemWand().setUnlocalizedName("wand_k").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":wand"); wand_s = new ItemWandS().setUnlocalizedName("wand_s").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":wand_s"); diff --git a/src/main/java/com/hbm/items/machine/ItemMachineUpgrade.java b/src/main/java/com/hbm/items/machine/ItemMachineUpgrade.java index c88cf06e9..904bf9e8b 100644 --- a/src/main/java/com/hbm/items/machine/ItemMachineUpgrade.java +++ b/src/main/java/com/hbm/items/machine/ItemMachineUpgrade.java @@ -10,172 +10,80 @@ import net.minecraft.item.ItemStack; public class ItemMachineUpgrade extends Item { + public UpgradeType type; + public int tier = 0; + + public ItemMachineUpgrade() { + this.setMaxStackSize(1); + this.type = UpgradeType.SPECIAL; + } + + public ItemMachineUpgrade(UpgradeType type) { + this.setMaxStackSize(1); + this.type = type; + } + + public ItemMachineUpgrade(UpgradeType type, int tier) { + this(type); + this.tier = tier; + } + @Override public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) { - if(this == ModItems.upgrade_speed_1) - { + if(this.type == UpgradeType.SPEED) { list.add("Mining Drill:"); - list.add("Delay -15 / Consumption +300"); + list.add("Delay -" + (15 * this.tier) + "% / Consumption +" + (300 * this.tier) + "HE/t"); + list.add(""); + list.add("Laser Miner:"); + list.add("Delay รท" + (1 + this.tier) + " / Consumption +" + (625 * this.tier) + "HE/t"); list.add(""); list.add("Assembly Machine:"); - list.add("Delay -25 / Consumption +300"); + list.add("Delay -" + (25 * this.tier) + "% / Consumption +" + (300 * this.tier) + "HE/t"); list.add(""); list.add("Chemical Plant:"); - list.add("Delay -25 / Consumption +300"); + list.add("Delay -" + (25 * this.tier) + "% / Consumption +" + (300 * this.tier) + "HE/t"); list.add(""); list.add("Crystallizer:"); - list.add("Delay -10% / Consumption +1000"); + list.add("Delay -" + (20 * this.tier) + "% / Consumption +" + (1000 * this.tier) + "HE/t"); list.add(""); list.add("Cyclotron:"); - list.add("Speed x2"); + list.add("Speed x" + (1 + this.tier)); list.add(""); list.add("Maxwell:"); - list.add("Damage +0.25/t"); + list.add("Damage +" + (0.25 * (double)this.tier) + "/t"); } - if(this == ModItems.upgrade_speed_2) - { + if(this.type == UpgradeType.EFFECT) { list.add("Mining Drill:"); - list.add("Delay -30 / Consumption +600"); - list.add(""); - list.add("Assembly Machine:"); - list.add("Delay -50 / Consumption +600"); - list.add(""); - list.add("Chemical Plant:"); - list.add("Delay -50 / Consumption +600"); + list.add("Radius +" + this.tier + "m / Consumption +" + (80 * this.tier) + "HE/t"); list.add(""); list.add("Crystallizer:"); - list.add("Delay -20% / Consumption +2000"); + list.add("+" + (5 * this.tier) + "% chance of not consuming an item / Acid consumption +" + (1000 * this.tier) + "mB"); list.add(""); list.add("Cyclotron:"); - list.add("Speed x3"); + list.add("-" + (100 - 100 / this.tier) + "% chance of incrementing overheat counter"); list.add(""); list.add("Maxwell:"); - list.add("Damage +0.5/t"); + list.add("Range +" + (3 * this.tier) + "m"); } - if(this == ModItems.upgrade_speed_3) - { + if(this.type == UpgradeType.POWER) { list.add("Mining Drill:"); - list.add("Delay -45 / Consumption +900"); + list.add("Consumption -" + (30 * this.tier) + "HE/t / Delay +" + (5 * this.tier) + "%"); list.add(""); list.add("Assembly Machine:"); - list.add("Delay -75 / Consumption +900"); + list.add("Consumption -" + (30 * this.tier) + "HE/t / Delay +" + (5 * this.tier) + "%"); list.add(""); list.add("Chemical Plant:"); - list.add("Delay -75 / Consumption +900"); - list.add(""); - list.add("Crystallizer"); - list.add("Speed Delay -30% / Consumption +3000"); - list.add(""); - list.add("Cyclotron"); - list.add("Speed x4"); - list.add(""); - list.add("Maxwell:"); - list.add("Damage +0.75/t"); - } - - if(this == ModItems.upgrade_effect_1) - { - list.add("Mining Drill:"); - list.add("Radius +1 / Consumption +80"); - list.add(""); - list.add("Crystallizer:"); - list.add("+5% chance of not consuming an item / Acid consumption +1000mB"); + list.add("Consumption -" + (30 * this.tier) + "HE/t / Delay +" + (5 * this.tier) + "%"); list.add(""); list.add("Cyclotron:"); - list.add("-50% chance of incrementing overheat counter"); + list.add("Consumption -" + (100 * this.tier) + "kHE/t"); list.add(""); list.add("Maxwell:"); - list.add("Range +3m"); - } - - if(this == ModItems.upgrade_effect_2) - { - list.add("Mining Drill:"); - list.add("Radius +2 / Consumption +160"); - list.add(""); - list.add("Crystallizer:"); - list.add("+10% chance of not consuming an item / Acid consumption +2000mB"); - list.add(""); - list.add("Cyclotron:"); - list.add("-66% chance of incrementing overheat counter"); - list.add(""); - list.add("Maxwell:"); - list.add("Range +6m"); - } - - if(this == ModItems.upgrade_effect_3) - { - list.add("Mining Drill:"); - list.add("Radius +3 / Consumption +240"); - list.add(""); - list.add("Crystallizer:"); - list.add("+15% chance of not consuming an item / Acid consumption +3000mB"); - list.add(""); - list.add("Cyclotron:"); - list.add("-75% chance of incrementing overheat counter"); - list.add(""); - list.add("Maxwell:"); - list.add("Range +9m"); - } - - if(this == ModItems.upgrade_power_1) - { - list.add("Mining Drill:"); - list.add("Consumption -30 / Delay +5"); - list.add(""); - list.add("Assembly Machine:"); - list.add("Consumption -30 / Delay +5"); - list.add(""); - list.add("Chemical Plant:"); - list.add("Consumption -30 / Delay +5"); - list.add(""); - list.add("Cyclotron:"); - list.add("Consumption -100k"); - list.add(""); - list.add("Maxwell:"); - list.add("Consumption -150"); - list.add("Consumption when firing -1500"); - } - - if(this == ModItems.upgrade_power_2) - { - list.add("Mining Drill:"); - list.add("Consumption -60 / Delay +10"); - list.add(""); - list.add("Assembly Machine:"); - list.add("Consumption -60 / Delay +10"); - list.add(""); - list.add("Chemical Plant:"); - list.add("Consumption -60 / Delay +10"); - list.add(""); - list.add("Cyclotron:"); - list.add("Consumption -200k"); - list.add(""); - list.add("Maxwell:"); - list.add("Consumption -300"); - list.add("Consumption when firing -3000"); - } - - if(this == ModItems.upgrade_power_3) - { - list.add("Mining Drill:"); - list.add("Consumption -90 / Delay +15"); - list.add(""); - list.add("Assembly Machine:"); - list.add("Consumption -90 / Delay +15"); - list.add(""); - list.add("Chemical Plant:"); - list.add("Consumption -90 / Delay +15"); - list.add(""); - list.add("Cyclotron:"); - list.add("Consumption -300k"); - list.add(""); - list.add("Maxwell:"); - list.add("Consumption -450"); - list.add("Consumption when firing -4500"); + list.add("Consumption -" + (150 * this.tier) + "HE/t"); + list.add("Consumption when firing -" + (1500 * this.tier) + "HE/t"); } if(this == ModItems.upgrade_fortune_1) @@ -239,44 +147,62 @@ public class ItemMachineUpgrade extends Item { list.add("Stacks to 16"); } - if(this == ModItems.upgrade_smelter) - { + if(this == ModItems.upgrade_smelter) { list.add("Mining Laser Upgrade"); list.add("Smelts blocks. Easy enough."); } - if(this == ModItems.upgrade_shredder) - { + if(this == ModItems.upgrade_shredder) { list.add("Mining Laser Upgrade"); list.add("Crunches ores"); } - if(this == ModItems.upgrade_centrifuge) - { + if(this == ModItems.upgrade_centrifuge) { list.add("Mining Laser Upgrade"); list.add("Hopefully self-explanatory"); } - if(this == ModItems.upgrade_crystallizer) - { + if(this == ModItems.upgrade_crystallizer) { list.add("Mining Laser Upgrade"); list.add("Your new best friend"); } - if(this == ModItems.upgrade_screm) - { + if(this == ModItems.upgrade_screm) { list.add("Mining Laser Upgrade"); list.add("It's like in Super Mario where all blocks are"); list.add("actually Toads, but here it's Half-Life scientists"); list.add("and they scream. A lot."); } - if(this == ModItems.upgrade_nullifier) - { + if(this == ModItems.upgrade_nullifier) { list.add("Mining Laser Upgrade"); list.add("50% chance to override worthless items with /dev/zero"); list.add("50% chance to move worthless items to /dev/null"); } } + + public static enum UpgradeType { + SPEED, + EFFECT, + POWER, + FORTUNE, + AFTERBURN, + OVERDRIVE, + SPECIAL, + LM_DESROYER, + LM_SCREM, + LM_SMELTER(true), + LM_SHREDDER(true), + LM_CENTRIFUGE(true), + LM_CRYSTALLIZER(true); + + public boolean mutex = false; + + private UpgradeType() { } + + private UpgradeType(boolean mutex) { + this.mutex = mutex; + } + } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssembler.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssembler.java index 724985384..8445db3ff 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssembler.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssembler.java @@ -8,8 +8,10 @@ import com.hbm.blocks.ModBlocks; import com.hbm.interfaces.IConsumer; import com.hbm.inventory.AssemblerRecipes; import com.hbm.inventory.RecipesCommon.AStack; +import com.hbm.inventory.UpgradeManager; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemAssemblyTemplate; +import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; import com.hbm.lib.Library; import com.hbm.main.MainRegistry; import com.hbm.packet.AuxElectricityPacket; @@ -126,41 +128,18 @@ public class TileEntityMachineAssembler extends TileEntityMachineBase implements this.consumption = 100; this.speed = 100; - for(int i = 1; i < 4; i++) { - ItemStack stack = slots[i]; - - if(stack != null) { - if(stack.getItem() == ModItems.upgrade_speed_1) { - this.speed -= 25; - this.consumption += 300; - } - if(stack.getItem() == ModItems.upgrade_speed_2) { - this.speed -= 50; - this.consumption += 600; - } - if(stack.getItem() == ModItems.upgrade_speed_3) { - this.speed -= 75; - this.consumption += 900; - } - if(stack.getItem() == ModItems.upgrade_power_1) { - this.consumption -= 30; - this.speed += 5; - } - if(stack.getItem() == ModItems.upgrade_power_2) { - this.consumption -= 60; - this.speed += 10; - } - if(stack.getItem() == ModItems.upgrade_power_3) { - this.consumption -= 90; - this.speed += 15; - } - } - } + UpgradeManager.eval(slots, 1, 3); + + int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); + int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); + int overLevel = UpgradeManager.getLevel(UpgradeType.OVERDRIVE); - if(speed < 25) - speed = 25; - if(consumption < 10) - consumption = 10; + speed -= speedLevel * 25; + consumption += speedLevel * 300; + speed += powerLevel * 5; + consumption -= powerLevel * 30; + speed /= (overLevel + 1); + consumption *= (overLevel + 1); isProgressing = false; power = Library.chargeTEFromItems(slots, 0, power, maxPower); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java index 9405fc144..32663c7f3 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java @@ -12,8 +12,10 @@ import com.hbm.interfaces.IFluidSource; import com.hbm.inventory.FluidStack; import com.hbm.inventory.FluidTank; import com.hbm.inventory.MachineRecipes; +import com.hbm.inventory.UpgradeManager; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemChemistryTemplate; +import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; import com.hbm.lib.Library; import com.hbm.packet.AuxElectricityPacket; import com.hbm.packet.AuxParticlePacket; @@ -244,41 +246,18 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve this.consumption = 100; this.speed = 100; - for(int i = 1; i < 4; i++) { - ItemStack stack = slots[i]; - - if(stack != null) { - if(stack.getItem() == ModItems.upgrade_speed_1) { - this.speed -= 25; - this.consumption += 300; - } - if(stack.getItem() == ModItems.upgrade_speed_2) { - this.speed -= 50; - this.consumption += 600; - } - if(stack.getItem() == ModItems.upgrade_speed_3) { - this.speed -= 75; - this.consumption += 900; - } - if(stack.getItem() == ModItems.upgrade_power_1) { - this.consumption -= 30; - this.speed += 5; - } - if(stack.getItem() == ModItems.upgrade_power_2) { - this.consumption -= 60; - this.speed += 10; - } - if(stack.getItem() == ModItems.upgrade_power_3) { - this.consumption -= 90; - this.speed += 15; - } - } - } + UpgradeManager.eval(slots, 1, 3); + + int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); + int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); + int overLevel = UpgradeManager.getLevel(UpgradeType.OVERDRIVE); - if(speed < 25) - speed = 25; - if(consumption < 10) - consumption = 10; + speed -= speedLevel * 25; + consumption += speedLevel * 300; + speed += powerLevel * 5; + consumption -= powerLevel * 30; + speed /= (overLevel + 1); + consumption *= (overLevel + 1); if(!worldObj.isRemote) { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCrystallizer.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCrystallizer.java index d1a70c097..62c00ec75 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCrystallizer.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCrystallizer.java @@ -188,14 +188,14 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme for(int i = 5; i <= 6; i++) { if(slots[i] != null && slots[i].getItem() == ModItems.upgrade_speed_1) - durationMod -= 0.1F; + durationMod -= 0.25F; if(slots[i] != null && slots[i].getItem() == ModItems.upgrade_speed_2) - durationMod -= 0.2F; + durationMod -= 0.50F; if(slots[i] != null && slots[i].getItem() == ModItems.upgrade_speed_3) - durationMod -= 0.3F; + durationMod -= 0.75F; } - return (int) (duration * Math.max(durationMod, 0.7F)); + return (int) (duration * Math.max(durationMod, 0.25F)); } public int getPowerRequired() { @@ -222,11 +222,11 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme for(int i = 5; i <= 6; i++) { if(slots[i] != null && slots[i].getItem() == ModItems.upgrade_overdrive_1) - cycles += 1; - if(slots[i] != null && slots[i].getItem() == ModItems.upgrade_overdrive_2) cycles += 2; + if(slots[i] != null && slots[i].getItem() == ModItems.upgrade_overdrive_2) + cycles += 4; if(slots[i] != null && slots[i].getItem() == ModItems.upgrade_overdrive_3) - cycles += 3; + cycles += 6; } return Math.min(cycles, 4); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningLaser.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningLaser.java index 5e7d6e6e8..fd5293265 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningLaser.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningLaser.java @@ -14,8 +14,10 @@ import com.hbm.inventory.CentrifugeRecipes; import com.hbm.inventory.CrystallizerRecipes; import com.hbm.inventory.FluidTank; import com.hbm.inventory.ShredderRecipes; +import com.hbm.inventory.UpgradeManager; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemMachineUpgrade; +import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; import com.hbm.lib.Library; import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.util.InventoryUtil; @@ -100,11 +102,14 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen if(isOn) { - int cycles = getOverdrive(); - int speed = getSpeed(); - int range = getRange(); - int fortune = getFortune(); - int consumption = getConsumption() * speed; + UpgradeManager.eval(slots, 1, 8); + int cycles = 1 + UpgradeManager.getLevel(UpgradeType.OVERDRIVE); + int speed = 1 + Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 12); + int range = 1 + Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT) * 2, 24); + int fortune = Math.min(UpgradeManager.getLevel(UpgradeType.FORTUNE), 3); + int consumption = this.consumption + - (this.consumption * Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 12) / 16) + + (this.consumption * Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 12) / 16); for(int i = 0; i < cycles; i++) {