mirror of
https://github.com/GTNewHorizons/IguanaTweaksTConstruct.git
synced 2026-11-25 22:34:38 +00:00
Add excessive logging to the override module for debugging for people who mess with that stuff.
This commit is contained in:
1 parent
9f83da8fd9
commit
533bead8e8
6 files changed
+34
-2
No files matched your search
@@ -1,5 +1,7 @@
|
||||
package iguanaman.iguanatweakstconstruct.harvestlevels;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.LoaderState;
|
||||
import iguanaman.iguanatweakstconstruct.reference.Config;
|
||||
import iguanaman.iguanatweakstconstruct.util.HarvestLevels;
|
||||
import iguanaman.iguanatweakstconstruct.util.Log;
|
||||
@@ -102,6 +104,10 @@ public final class HarvestLevelTweaks {
|
||||
Log.debug(String.format("Changed Harvest Level of %s from %d to %d", stack.getUnlocalizedName(), block.getHarvestLevel(stack.getItemDamage()), harvestLevel));
|
||||
}
|
||||
|
||||
if(Config.logOverrideChanges && Loader.instance().isInState(LoaderState.POSTINITIALIZATION))
|
||||
Log.info(String.format("Block Override: Changed Harvest Level of %s to %d", stack.getUnlocalizedName(), harvestLevel));
|
||||
|
||||
|
||||
// gravelore gets shovel level instead of pickaxe.
|
||||
if(block instanceof GravelOre)
|
||||
block.setHarvestLevel("shovel", harvestLevel, stack.getItemDamage());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package iguanaman.iguanatweakstconstruct.override;
|
||||
|
||||
import iguanaman.iguanatweakstconstruct.harvestlevels.HarvestLevelTweaks;
|
||||
import iguanaman.iguanatweakstconstruct.reference.Config;
|
||||
import iguanaman.iguanatweakstconstruct.reference.Reference;
|
||||
import iguanaman.iguanatweakstconstruct.util.HarvestLevels;
|
||||
import iguanaman.iguanatweakstconstruct.util.Log;
|
||||
@@ -124,9 +125,13 @@ public class BlockOverride implements IOverride {
|
||||
int lvl = prop.getInt();
|
||||
if(meta == -1) {
|
||||
block.setHarvestLevel(tool, prop.getInt());
|
||||
if(Config.logOverrideChanges)
|
||||
Log.info(String.format("Block Override: Changed Harvest Level of %s:%d to %d", block.getUnlocalizedName(), meta, lvl));
|
||||
}
|
||||
else {
|
||||
block.setHarvestLevel(tool, prop.getInt(), meta);
|
||||
if(Config.logOverrideChanges)
|
||||
Log.info(String.format("Block Override: Changed Harvest Level of %s:%d to %d", block.getUnlocalizedName(), meta, lvl));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package iguanaman.iguanatweakstconstruct.override;
|
||||
|
||||
import iguanaman.iguanatweakstconstruct.reference.Config;
|
||||
import iguanaman.iguanatweakstconstruct.util.HarvestLevels;
|
||||
import iguanaman.iguanatweakstconstruct.util.Log;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@@ -73,6 +74,9 @@ public class MaterialOverride implements IOverride {
|
||||
// we cannot replace the material while cycling through, since it'd cause a ConcurrentModificationException
|
||||
newMaterials.put(entry.getKey(), newMat);
|
||||
|
||||
if(Config.logOverrideChanges)
|
||||
Log.info(String.format("Material Override: Changed Material %s", mat.materialName));
|
||||
|
||||
if(cleanup && isEqual(mat, newMat))
|
||||
config.removeCategory(config.getCategory(category));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package iguanaman.iguanatweakstconstruct.override;
|
||||
|
||||
import iguanaman.iguanatweakstconstruct.leveling.RandomBonuses;
|
||||
import iguanaman.iguanatweakstconstruct.reference.Config;
|
||||
import iguanaman.iguanatweakstconstruct.util.Log;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
@@ -49,6 +50,8 @@ public class ModifierOverride implements IOverride {
|
||||
config.setCategoryComment("UsageBonus", "Tools gain a bonus for specific modifiers on doing specific things.\nThe value below determines how much weight is added (on average) to a modifier if only that action is done for the whole level.\nAn example: Mining blocks increases the chance to obtain the redstone modifier. If you'd only mine stone blocks from 0xp to levelup, the weigth of the redstone modifier woudl be increased by that amount. (That's why it's relatively low by default)");
|
||||
|
||||
RandomBonuses.usageBonusWeight = config.get("UsageBonus", "bonusWeight", RandomBonuses.usageBonusWeight, "The average amount of weight added if a tool does one action for a whole levelup.").getInt();
|
||||
if(Config.logOverrideChanges)
|
||||
Log.info(String.format("Bonus Modifier Override: Set bonus weight to %d", RandomBonuses.usageBonusWeight));
|
||||
|
||||
// tool weights
|
||||
doWeightUpdate(config, "ToolWeights", RandomBonuses.toolWeights);
|
||||
@@ -71,6 +74,9 @@ public class ModifierOverride implements IOverride {
|
||||
try {
|
||||
RandomBonuses.Modifier mod = RandomBonuses.Modifier.getEnumByString(prop.getName());
|
||||
map.put(mod, prop.getInt());
|
||||
|
||||
if(Config.logOverrideChanges)
|
||||
Log.info(String.format("Bonus Modifier Override: [%s] Changed Weight of %s to %d", categoryName, mod.toString(), prop.getInt()));
|
||||
} catch(IllegalArgumentException e)
|
||||
{
|
||||
Log.error(String.format("Found invalid entry when parsing %s: %s", categoryName, prop.getName()));
|
||||
@@ -81,10 +87,16 @@ public class ModifierOverride implements IOverride {
|
||||
private void doUsefulnessUpdate(Configuration config, String category, RandomBonuses.Modifier mod, Set<RandomBonuses.Modifier> set)
|
||||
{
|
||||
boolean useful = config.get(category, mod.toString(), set.contains(mod)).getBoolean();
|
||||
if(useful)
|
||||
if(useful) {
|
||||
set.add(mod);
|
||||
else
|
||||
if(Config.logOverrideChanges)
|
||||
Log.info(String.format("Bonus Modifier Override: [%s] Added useful modifier %s", category, mod.toString()));
|
||||
}
|
||||
else {
|
||||
set.remove(mod);
|
||||
if(Config.logOverrideChanges)
|
||||
Log.info(String.format("Bonus Modifier Override: [%s] Removed modifier %s from useful modifiers", category, mod.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package iguanaman.iguanatweakstconstruct.override;
|
||||
|
||||
import iguanaman.iguanatweakstconstruct.harvestlevels.HarvestLevelTweaks;
|
||||
import iguanaman.iguanatweakstconstruct.reference.Config;
|
||||
import iguanaman.iguanatweakstconstruct.reference.Reference;
|
||||
import iguanaman.iguanatweakstconstruct.util.HarvestLevels;
|
||||
import iguanaman.iguanatweakstconstruct.util.Log;
|
||||
@@ -80,6 +81,8 @@ public class ToolOverride implements IOverride {
|
||||
// update tool
|
||||
if(level != newLevel) {
|
||||
HarvestLevelTweaks.updateToolHarvestLevel(item, tool, newLevel);
|
||||
if(Config.logOverrideChanges)
|
||||
Log.info(String.format("Tool Override: Changed harvest level of %s to %d", item.getUnlocalizedName(), newLevel));
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ public class Config {
|
||||
public static boolean logMiningLevelChanges;
|
||||
public static boolean logToolMaterialChanges;
|
||||
public static boolean logBonusExtraChance;
|
||||
public static boolean logOverrideChanges;
|
||||
|
||||
|
||||
public void init(File file) {
|
||||
@@ -247,6 +248,7 @@ public class Config {
|
||||
logMiningLevelChanges = configfile.getBoolean("logToolMiningLevelChange", CATEGORY_Debug, true, "Logs when the mining level of a (non-tinker) tool is changed");
|
||||
logToolMaterialChanges = configfile.getBoolean("logTinkerMaterialChange", CATEGORY_Debug, true, "Logs when the mining level of a tinkers tool material is changed");
|
||||
logBonusExtraChance = configfile.getBoolean("logBonusExtraChance", CATEGORY_Debug, true, "Logs how much the extra-chance from doing stuff you had when getting a random bonus on levelup.");
|
||||
logOverrideChanges = configfile.getBoolean("logExcessiveOverrideChanges", CATEGORY_Debug, false, "Logs every single thing done by the Override module. Use at your own risk. ;)");
|
||||
|
||||
|
||||
configfile.save();
|
||||
|
||||
Reference in new issue
Block a user