mirror of
https://github.com/GTNewHorizons/IguanaTweaksTConstruct.git
synced 2026-11-26 06:43:05 +00:00
Move HarvestLevels + their names into a separate class and add special behavior if vanilla harvest levels are required
This commit is contained in:
1 parent
812841245d
commit
b9ba483d6f
13 files changed
+98
-54
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
+1
-5
@@ -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.
|
||||
|
||||
-13
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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<String> tips = new ArrayList<String>();
|
||||
List<String> modifierTips = new ArrayList<String>();
|
||||
|
||||
tips.add("Mining Level: " + Reference.getHarvestLevelName(toolTag.getInteger("HarvestLevel")));
|
||||
tips.add("Mining Level: " + HarvestLevels.getHarvestLevelName(toolTag.getInteger("HarvestLevel")));
|
||||
modifierTips.add("");
|
||||
|
||||
|
||||
|
||||
@@ -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("");
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user