diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/IguanaTweaksTConstruct.java b/src/main/java/iguanaman/iguanatweakstconstruct/IguanaTweaksTConstruct.java index 150a6bf..7ab1ce7 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/IguanaTweaksTConstruct.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/IguanaTweaksTConstruct.java @@ -16,6 +16,7 @@ import iguanaman.iguanatweakstconstruct.leveling.commands.debug; import iguanaman.iguanatweakstconstruct.proxy.CommonProxy; import iguanaman.iguanatweakstconstruct.reference.Config; import iguanaman.iguanatweakstconstruct.reference.Reference; +import iguanaman.iguanatweakstconstruct.util.HarvestLevels; import iguanaman.iguanatweakstconstruct.util.Log; import mantle.pulsar.config.ForgeCFG; import mantle.pulsar.control.PulseManager; @@ -65,6 +66,10 @@ public class IguanaTweaksTConstruct { TinkerTools.arrowhead ); */ + // if we don't use our custom harvest levels, we have to adjust what we're using + if(!isHarvestTweaksActive) + HarvestLevels.adjustToVanillaLevels(); + pulsar.registerPulse(new IguanaToolLeveling()); pulsar.registerPulse(new IguanaHarvestLevelTweaks()); pulsar.preInit(event); @@ -99,6 +104,6 @@ public class IguanaTweaksTConstruct { // backwards compatibility public static String getHarvestLevelName (int num) { - return Reference.getHarvestLevelName(num); + return HarvestLevels.getHarvestLevelName(num); } } \ No newline at end of file diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/HarvestLevelTweaks.java b/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/HarvestLevelTweaks.java index e2ec3cc..00d4b40 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/HarvestLevelTweaks.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/HarvestLevelTweaks.java @@ -1,6 +1,6 @@ package iguanaman.iguanatweakstconstruct.harvestlevels; -import iguanaman.iguanatweakstconstruct.harvestlevels.IguanaHarvestLevelTweaks.HarvestLevels; +import iguanaman.iguanatweakstconstruct.util.HarvestLevels; import iguanaman.iguanatweakstconstruct.util.Log; import net.minecraft.block.Block; @@ -10,10 +10,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.oredict.OreDictionary; -import tconstruct.world.TinkerWorld; - -import static net.minecraft.init.Blocks.*; -import static net.minecraft.init.Blocks.lit_redstone_ore; /** * Used to modify the harvest levels of all known/findable tools and blocks. Vanilla and modded. diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/IguanaHarvestLevelTweaks.java b/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/IguanaHarvestLevelTweaks.java index 6672b31..44a1408 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/IguanaHarvestLevelTweaks.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/IguanaHarvestLevelTweaks.java @@ -26,19 +26,6 @@ import net.minecraftforge.common.MinecraftForge; @Pulse(id = Reference.PULSE_HARVESTTWEAKS, description = "Modify tool and block mining levels to create a tiered-ish progression") public class IguanaHarvestLevelTweaks { - // strength of the tool-material. stone == strength of a stone pick etc. - public abstract class HarvestLevels { - public static final int _0_stone = 0; - public static final int _1_flint = 1; - public static final int _2_copper = 2; - public static final int _3_iron = 3; - public static final int _4_bronze = 4; - public static final int _5_diamond = 5; - public static final int _6_obsidian = 6; - public static final int _7_ardite = 7; - public static final int _8_cobalt = 8; - public static final int _9_manyullym = 9; - } @Handler public void applyTinkerTweaks(FMLPreInitializationEvent event) diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/TinkerToolTweaks.java b/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/TinkerToolTweaks.java index b0b24bd..8c7d664 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/TinkerToolTweaks.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/harvestlevels/TinkerToolTweaks.java @@ -6,7 +6,7 @@ import tconstruct.library.TConstructRegistry; import tconstruct.library.tools.ToolMaterial; import tconstruct.tools.TinkerTools; -import static iguanaman.iguanatweakstconstruct.harvestlevels.IguanaHarvestLevelTweaks.HarvestLevels.*; +import static iguanaman.iguanatweakstconstruct.util.HarvestLevels.*; /** * Used to modify the harvest levels and speeds of the tinker tool parts. diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/leveling/LevelingLogic.java b/src/main/java/iguanaman/iguanatweakstconstruct/leveling/LevelingLogic.java index 38c4d62..a562368 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/leveling/LevelingLogic.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/leveling/LevelingLogic.java @@ -1,9 +1,9 @@ package iguanaman.iguanatweakstconstruct.leveling; -import iguanaman.iguanatweakstconstruct.harvestlevels.IguanaHarvestLevelTweaks; import iguanaman.iguanatweakstconstruct.old.modifiers.*; import iguanaman.iguanatweakstconstruct.reference.Config; import iguanaman.iguanatweakstconstruct.reference.Reference; +import iguanaman.iguanatweakstconstruct.util.HarvestLevels; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -46,8 +46,8 @@ public abstract class LevelingLogic { public static boolean canBoostMiningLevel(int hLevel) { - return hLevel >= IguanaHarvestLevelTweaks.HarvestLevels._2_copper && - (!Config.pickaxeBoostRequired && hLevel < IguanaHarvestLevelTweaks.HarvestLevels._8_cobalt || Config.pickaxeBoostRequired && hLevel < IguanaHarvestLevelTweaks.HarvestLevels._9_manyullym); + return hLevel >= HarvestLevels._2_copper && + (!Config.pickaxeBoostRequired && hLevel < HarvestLevels._8_cobalt || Config.pickaxeBoostRequired && hLevel < HarvestLevels._9_manyullym); } /** @@ -197,7 +197,7 @@ public abstract class LevelingLogic { if (miningBoost) { - int harvestLevelCopper = IguanaHarvestLevelTweaks.HarvestLevels._2_copper; + int harvestLevelCopper = HarvestLevels._2_copper; int harvestLevel = TConstructRegistry.getMaterial(tags.getInteger("Head")).harvestLevel(); if (harvestLevel >= harvestLevelCopper) base *= Math.pow(Config.xpPerLevelMultiplier, harvestLevel - harvestLevelCopper); base *= Config.levelingPickaxeBoostXpPercentage / 100f; diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/leveling/LevelingTooltips.java b/src/main/java/iguanaman/iguanatweakstconstruct/leveling/LevelingTooltips.java index e603ab4..f994783 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/leveling/LevelingTooltips.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/leveling/LevelingTooltips.java @@ -1,7 +1,7 @@ package iguanaman.iguanatweakstconstruct.leveling; import iguanaman.iguanatweakstconstruct.reference.Config; -import iguanaman.iguanatweakstconstruct.reference.Reference; +import iguanaman.iguanatweakstconstruct.util.HarvestLevels; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -71,7 +71,7 @@ public abstract class LevelingTooltips { public static String getMiningLevelTooltip(int hLevel) { - return "Mining Level: " + Reference.getHarvestLevelName(hLevel); + return "Mining Level: " + HarvestLevels.getHarvestLevelName(hLevel); } public static String getBoostedTooltip() diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/old/gui/IguanaPartCrafterGui.java b/src/main/java/iguanaman/iguanatweakstconstruct/old/gui/IguanaPartCrafterGui.java index aba8a0f..a7f2551 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/old/gui/IguanaPartCrafterGui.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/old/gui/IguanaPartCrafterGui.java @@ -1,6 +1,6 @@ package iguanaman.iguanatweakstconstruct.old.gui; -import iguanaman.iguanatweakstconstruct.reference.Reference; +import iguanaman.iguanatweakstconstruct.util.HarvestLevels; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.InventoryPlayer; @@ -132,7 +132,7 @@ public class IguanaPartCrafterGui extends NewContainerGui public static String getHarvestLevelName (int num) { - return Reference.getHarvestLevelName(num); + return HarvestLevels.getHarvestLevelName(num); } private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/toolparts.png"); diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/old/gui/IguanaToolStationGui.java b/src/main/java/iguanaman/iguanatweakstconstruct/old/gui/IguanaToolStationGui.java index b1ee95d..61660ac 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/old/gui/IguanaToolStationGui.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/old/gui/IguanaToolStationGui.java @@ -5,7 +5,7 @@ import java.text.DecimalFormat; import java.util.Arrays; import java.util.List; -import iguanaman.iguanatweakstconstruct.reference.Reference; +import iguanaman.iguanatweakstconstruct.util.HarvestLevels; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiTextField; import net.minecraft.entity.player.InventoryPlayer; @@ -402,7 +402,7 @@ public class IguanaToolStationGui extends NewContainerGui String getHarvestLevelName (int num) { - return Reference.getHarvestLevelName(num); + return HarvestLevels.getHarvestLevelName(num); } private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/toolstation.png"); diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/old/items/IguanaToolPart.java b/src/main/java/iguanaman/iguanatweakstconstruct/old/items/IguanaToolPart.java index 390e225..c1828d7 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/old/items/IguanaToolPart.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/old/items/IguanaToolPart.java @@ -4,7 +4,7 @@ import iguanaman.iguanatweakstconstruct.reference.Config; import java.util.List; -import iguanaman.iguanatweakstconstruct.reference.Reference; +import iguanaman.iguanatweakstconstruct.util.HarvestLevels; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import tconstruct.library.TConstructRegistry; @@ -36,7 +36,7 @@ public class IguanaToolPart extends ToolPart { if (partName.equals("PickHead") || partName.equals("HammerHead") || partName.equals("ShovelHead") || partName.equals("ExcavatorHead")) - par3List.add("Mining Level: " + Reference.getHarvestLevelName(material.harvestLevel)); + par3List.add("Mining Level: " + HarvestLevels.getHarvestLevelName(material.harvestLevel)); if ( partName.equals("PickHead") || partName.equals("HammerHead") || partName.equals("ShovelHead") || partName.equals("ExcavatorHead") diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/old/modifiers/IguanaModHeads.java b/src/main/java/iguanaman/iguanatweakstconstruct/old/modifiers/IguanaModHeads.java index 24a14e9..a8b26b5 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/old/modifiers/IguanaModHeads.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/old/modifiers/IguanaModHeads.java @@ -3,7 +3,7 @@ package iguanaman.iguanatweakstconstruct.old.modifiers; import java.util.ArrayList; import java.util.List; -import iguanaman.iguanatweakstconstruct.reference.Reference; +import iguanaman.iguanatweakstconstruct.util.HarvestLevels; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import tconstruct.items.tools.Hammer; @@ -67,7 +67,7 @@ public class IguanaModHeads extends ItemModifier { List tips = new ArrayList(); List modifierTips = new ArrayList(); - tips.add("Mining Level: " + Reference.getHarvestLevelName(toolTag.getInteger("HarvestLevel"))); + tips.add("Mining Level: " + HarvestLevels.getHarvestLevelName(toolTag.getInteger("HarvestLevel"))); modifierTips.add(""); diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/old/modifiers/IguanaModUpgrade.java b/src/main/java/iguanaman/iguanatweakstconstruct/old/modifiers/IguanaModUpgrade.java index 26ded0b..565a765 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/old/modifiers/IguanaModUpgrade.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/old/modifiers/IguanaModUpgrade.java @@ -9,7 +9,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import iguanaman.iguanatweakstconstruct.reference.Reference; +import iguanaman.iguanatweakstconstruct.util.HarvestLevels; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import tconstruct.items.tools.Hammer; @@ -391,7 +391,7 @@ public class IguanaModUpgrade extends ItemModifier { //add mining level tooltip if (tool.getItem() instanceof Pickaxe || tool.getItem() instanceof Hammer) { - String mLevel = Reference.getHarvestLevelName(tags.getInteger("HarvestLevel")); + String mLevel = HarvestLevels.getHarvestLevelName(tags.getInteger("HarvestLevel")); tips.add("Mining Level: " + mLevel); modifierTips.add(""); } diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/reference/Reference.java b/src/main/java/iguanaman/iguanatweakstconstruct/reference/Reference.java index 2b089d7..d00b7b4 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/reference/Reference.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/reference/Reference.java @@ -2,7 +2,7 @@ package iguanaman.iguanatweakstconstruct.reference; import static net.minecraft.util.EnumChatFormatting.*; -import static iguanaman.iguanatweakstconstruct.harvestlevels.IguanaHarvestLevelTweaks.HarvestLevels.*; +import static iguanaman.iguanatweakstconstruct.util.HarvestLevels.*; public class Reference { public static final String MOD_ID = "IguanaTweaksTConstruct"; @@ -15,21 +15,4 @@ public class Reference { public static final String PROXY_CLIENT_CLASS = "iguanaman.iguanatweakstconstruct.proxy.ClientProxy"; public static final String PROXY_SERVER_CLASS = "iguanaman.iguanatweakstconstruct.proxy.ServerProxy"; - public static String getHarvestLevelName (int num) - { - //if (Config.pickaxeBoostRequired && num > 1) --num; - switch (num) - { - case _0_stone: return GRAY + "Stone"; - case _1_flint: return GOLD + "Copper"; - case _2_copper: return DARK_RED + "Iron"; - case _3_iron: return WHITE + "Tin"; - case _4_bronze: return AQUA + "Diamond"; - case _5_diamond: return LIGHT_PURPLE + "Obsidian"; - case _6_obsidian: return RED + "Ardite"; - case _7_ardite: return BLUE + "Cobalt"; - case _8_cobalt: return DARK_PURPLE + "Manyullyn"; - default: return "\u00a7k\u00a7k\u00a7k\u00a7k\u00a7k\u00a7k"; - } - } } diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/util/HarvestLevels.java b/src/main/java/iguanaman/iguanatweakstconstruct/util/HarvestLevels.java new file mode 100644 index 0000000..1bfe3db --- /dev/null +++ b/src/main/java/iguanaman/iguanatweakstconstruct/util/HarvestLevels.java @@ -0,0 +1,73 @@ +package iguanaman.iguanatweakstconstruct.util; + +import static net.minecraft.util.EnumChatFormatting.*; + +// strength of the tool-material. stone == strength of a stone pick etc. +public abstract class HarvestLevels { + public static int _0_stone = 0; + public static int _1_flint = 1; + public static int _2_copper = 2; + public static int _3_iron = 3; + public static int _4_bronze = 4; + public static int _5_diamond = 5; + public static int _6_obsidian = 6; + public static int _7_ardite = 7; + public static int _8_cobalt = 8; + public static int _9_manyullym = 9; + + private static boolean vanilla = false; + + // needed if HarvestLevels module is deactivated to achieve vanilla mining levels + public static void adjustToVanillaLevels() + { + _1_flint = 1; + _2_copper = 1; + _3_iron = 2; + _4_bronze = 2; + _5_diamond = 3; + _6_obsidian = 4; + _7_ardite = 5; + _8_cobalt = 6; + _9_manyullym = 7; + + vanilla = true; + } + + public static String getHarvestLevelName (int num) + { + if(vanilla) return getVanillaHarvestLevelName(num); + + //if (Config.pickaxeBoostRequired && num > 1) --num; + switch (num) + { + case 0: return GRAY + "Stone"; + case 1: return GOLD + "Copper"; + case 2: return DARK_RED + "Iron"; + case 3: return WHITE + "Tin"; + case 4: return AQUA + "Diamond"; + case 5: return LIGHT_PURPLE + "Obsidian"; + case 6: return RED + "Ardite"; + case 7: return BLUE + "Cobalt"; + case 8: return DARK_PURPLE + "Manyullyn"; + default: return "\u00a7k\u00a7k\u00a7k\u00a7k\u00a7k\u00a7k"; + } + } + + public static String getVanillaHarvestLevelName (int num) + { + //if (Config.pickaxeBoostRequired && num > 1) --num; + switch (num) + { + case 0: return GRAY + "Stone"; + case 1: return DARK_RED + "Iron"; + case 2: return AQUA + "Diamond"; + case 3: return LIGHT_PURPLE + "Obsidian"; + case 4: return RED + "Ardite"; + case 5: return BLUE + "Cobalt"; + case 6: return DARK_PURPLE + "Manyullyn"; + default: return "\u00a7k\u00a7k\u00a7k\u00a7k\u00a7k\u00a7k"; + } + } + + +}