mirror of
https://github.com/GTNewHorizons/IguanaTweaksTConstruct.git
synced 2026-11-26 06:43:05 +00:00
Added a config option for a minimal xp tooltip. Ironed out a few flaws.
This commit is contained in:
1 parent
62c1f7780c
commit
5371cb7fc2
5 files changed
+26
-16
No files matched your search
@@ -41,6 +41,7 @@ public abstract class IguanaLevelingLogic {
|
||||
public static long getXp(NBTTagCompound tags) { return tags.getLong(TAG_EXP); }
|
||||
public static long getBoostXp(NBTTagCompound tags) { return tags.getLong(TAG_BOOST_EXP); }
|
||||
public static boolean isBoosted(NBTTagCompound tags) { return tags.getBoolean(TAG_IS_BOOSTED); }
|
||||
public static boolean isMaxLevel(NBTTagCompound tags) { return getLevel(tags) >= MAX_LEVEL; }
|
||||
|
||||
/**
|
||||
* Add the leveling specific NBT.
|
||||
|
||||
@@ -2,12 +2,9 @@ package iguanaman.iguanatweakstconstruct.leveling;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import iguanaman.iguanatweakstconstruct.reference.IguanaConfig;
|
||||
import iguanaman.iguanatweakstconstruct.util.IguanaLog;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import tconstruct.items.tools.Hammer;
|
||||
@@ -36,7 +33,7 @@ public class ToolTipHandler {
|
||||
// does the user hold shift?
|
||||
boolean advanced = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
|
||||
// only allow advanced (xp) tooltip if config option is set
|
||||
advanced &= IguanaConfig.detailedXpTooltip;
|
||||
advanced &= IguanaConfig.showTooltipXP;
|
||||
|
||||
|
||||
ToolCore tool = (ToolCore)event.itemStack.getItem();
|
||||
@@ -49,14 +46,14 @@ public class ToolTipHandler {
|
||||
int hLevel = tags.getInteger("HarvestLevel");
|
||||
String mLvl = IguanaLevelingTooltips.getMiningLevelTooltip(hLevel);
|
||||
// add minimal xp if config option is set
|
||||
//if(!advanced && IguanaConfig.showTooltipXP)
|
||||
//mLvl += " (123%)"; // todo: implement
|
||||
if(!advanced && IguanaConfig.showMinimalTooltipXP && !IguanaLevelingLogic.isBoosted(tags))
|
||||
mLvl += " (" + IguanaLevelingTooltips.getBoostXpString(stack, tags, false) + ")";
|
||||
inserter.add(mLvl);
|
||||
|
||||
// advanced mining level boost progress info
|
||||
if(advanced && IguanaConfig.levelingPickaxeBoost && IguanaConfig.showTooltipXP)
|
||||
{
|
||||
if(tags.hasKey(IguanaLevelingLogic.TAG_IS_BOOSTED))
|
||||
if(IguanaLevelingLogic.isBoosted(tags))
|
||||
inserter.add(IguanaLevelingTooltips.getBoostedTooltip());
|
||||
else
|
||||
inserter.add(IguanaLevelingTooltips.getBoostXpToolTip(stack, tags));
|
||||
@@ -64,11 +61,14 @@ public class ToolTipHandler {
|
||||
}
|
||||
|
||||
// add skill level
|
||||
int level = tags.getInteger(IguanaLevelingLogic.TAG_LEVEL);
|
||||
inserter.add(IguanaLevelingTooltips.getLevelTooltip(level));
|
||||
int level = IguanaLevelingLogic.getLevel(tags);
|
||||
String lvl = IguanaLevelingTooltips.getLevelTooltip(level);
|
||||
if(!advanced && IguanaConfig.showMinimalTooltipXP && !IguanaLevelingLogic.isMaxLevel(tags))
|
||||
lvl += " (" + IguanaLevelingTooltips.getXpString(stack, tags, false) + ")";
|
||||
inserter.add(lvl);
|
||||
|
||||
// skill level progress
|
||||
if(advanced && IguanaConfig.showTooltipXP)
|
||||
if(advanced && IguanaConfig.showTooltipXP && !IguanaLevelingLogic.isMaxLevel(tags))
|
||||
inserter.add(IguanaLevelingTooltips.getXpToolTip(stack, tags));
|
||||
|
||||
// since we added at least one line we'll add an empty spacing line at the end
|
||||
|
||||
@@ -159,7 +159,7 @@ public class IguanaModRedstone extends ItemModifier {
|
||||
int level = tags.getInteger("ToolLevel");
|
||||
if (level <= 5)
|
||||
{
|
||||
tips.add(IguanaLevelingTooltips.getXpString(tool, false));
|
||||
//tips.add(IguanaLevelingTooltips.getXpString(tool, false));
|
||||
modifierTips.add("");
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ public class IguanaModRedstone extends ItemModifier {
|
||||
&& !tags.hasKey("HarvestLevelModified")
|
||||
&& (tool.getItem() instanceof Pickaxe || tool.getItem() instanceof Hammer))
|
||||
{
|
||||
tips.add(IguanaLevelingTooltips.getXpString(tool, true));
|
||||
//tips.add(IguanaLevelingTooltips.getXpString(tool, true));
|
||||
modifierTips.add("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,12 +283,14 @@ public class IguanaModUpgrade extends ItemModifier {
|
||||
|
||||
if (tags.hasKey("HeadEXP"))
|
||||
{
|
||||
/*
|
||||
int requiredXp = IguanaLevelingLogic.getRequiredXp(tool, tags, true);
|
||||
long currentXp = tags.getLong("HeadEXP");
|
||||
float xpPercentage = (float)currentXp / (float)requiredXp;
|
||||
int newRequiredXp = IguanaLevelingLogic.getRequiredXp(newTool, newTags, true);
|
||||
long newXp = Math.round(newRequiredXp * xpPercentage);
|
||||
tags.setLong("HeadEXP", newXp);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -400,6 +402,7 @@ public class IguanaModUpgrade extends ItemModifier {
|
||||
|
||||
if (IguanaConfig.showTooltipXP)
|
||||
{
|
||||
/*
|
||||
if (level <= 5)
|
||||
{
|
||||
tips.add(IguanaLevelingTooltips.getXpString(tool, false));
|
||||
@@ -422,6 +425,7 @@ public class IguanaModUpgrade extends ItemModifier {
|
||||
modifierTips.add("");
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//get and remove tooltips
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package iguanaman.iguanatweakstconstruct.reference;
|
||||
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
|
||||
|
||||
public class IguanaConfig {
|
||||
@@ -30,6 +30,7 @@ public class IguanaConfig {
|
||||
public static int[] toolModifiersAtLevels;
|
||||
public static boolean toolLevelingRandomBonuses;
|
||||
public static boolean showTooltipXP;
|
||||
public static boolean showMinimalTooltipXP;
|
||||
public static boolean showDebugXP;
|
||||
public static int xpRequiredToolsPercentage;
|
||||
public static int xpRequiredWeaponsPercentage;
|
||||
@@ -166,6 +167,10 @@ public class IguanaConfig {
|
||||
showTooltipXPProperty.comment = "Current XP is shown when hovering over a tool (requires 'toolLeveling=true')";
|
||||
showTooltipXP = showTooltipXPProperty.getBoolean(true);
|
||||
|
||||
Property showMinimalTooltipXPProperty = config.get("leveling", "showMinimalTooltipXP", false);
|
||||
showMinimalTooltipXPProperty.comment = "Current XP% is shown after the level (requires 'toolLeveling=true')";
|
||||
showMinimalTooltipXP = showMinimalTooltipXPProperty.getBoolean(true);
|
||||
|
||||
Property showDebugXPProperty = config.get("leveling", "showDebugXP", false);
|
||||
showDebugXPProperty.comment = "Current XP is shown as debug (F3) text (requires 'toolLeveling=true')";
|
||||
showDebugXP = showDebugXPProperty.getBoolean(false);
|
||||
|
||||
Reference in new issue
Block a user