Mekanism Additions

Mekanism Additions

21M Downloads

console log spam

dewboy3d opened this issue ยท 11 comments

commented

Issue description

The console and log file are filled with the following

[09:39:21] [pool-11-thread-1/WARN] [ne.ne.fm.co.ConfigTracker/CONFIG]: Configuration file /private/var/opt/minecraft/crafty/crafty-4/servers/053e9b66-96e1-45bd-811b-f7b36f4d204f/config/Mekanism/tools-materials-startup.toml is not correct. Correcting
[09:39:21] [pool-11-thread-1/WARN] [ne.ne.ne.co.ModConfigSpec/CORE]: Configuration LoadedConfig[config=SynchronizedConfig{DataHolder:{materials=SynchronizedConfig{DataHolder:{wood=SynchronizedConfig{DataHolder:{woodPaxelDamage=7.0, woodPaxelAtkSpeed=-2.4000000953674316, woodPaxelEfficiency=2.0, woodPaxelEnchantability=15, woodPaxelDurability=118}}, stone=SynchronizedConfig{DataHolder:{stonePaxelDamage=8.0, stonePaxelAtkSpeed=-2.4000000953674316, stonePaxelEfficiency=4.0, stonePaxelEnchantability=5, stonePaxelDurability=262}}, gold=SynchronizedConfig{DataHolder:{goldPaxelDamage=7.0, goldPaxelAtkSpeed=-2.4000000953674316, goldPaxelEfficiency=12.0, goldPaxelEnchantability=22, goldPaxelDurability=64}}, iron=SynchronizedConfig{DataHolder:{ironPaxelDamage=7.0, ironPaxelAtkSpeed=-2.4000000953674316, ironPaxelEfficiency=6.0, ironPaxelEnchantability=14, ironPaxelDurability=500}}, diamond=SynchronizedConfig{DataHolder:{diamondPaxelDamage=6.0, diamondPaxelAtkSpeed=-2.4000000953674316, diamondPaxelEfficiency=8.0, diamondPaxelEnchantability=10, diamondPaxelDurability=3122}}, netherite=SynchronizedConfig{DataHolder:{netheritePaxelDamage=6.0, netheritePaxelAtkSpeed=-2.4000000953674316, netheritePaxelEfficiency=9.0, netheritePaxelEnchantability=15, netheritePaxelDurability=4062}}, lapis_lazuli=SynchronizedConfig{DataHolder:{lapis_lazuliToolDurability=128, lapis_lazuliEfficiency=9.0, lapis_lazuliAttackDamage=1.0, lapis_lazuliEnchantability=32, lapis_lazuliShieldDurability=224, lapis_lazuliSwordDamage=3.0, lapis_lazuliSwordAtkSpeed=-2.4000000953674316, lapis_lazuliShovelDamage=1.5, lapis_lazuliShovelAtkSpeed=-3.0, lapis_lazuliAxeDamage=4.0, lapis_lazuliAxeAtkSpeed=-2.9000000953674316, lapis_lazuliPickaxeDamage=1.0, lapis_lazuliPickaxeAtkSpeed=-2.799999952316284, lapis_lazuliHoeDamage=-1.0, lapis_lazuliHoeAtkSpeed=-2.0, lapis_lazuliPaxelDamage=5.0, lapis_lazuliPaxelAtkSpeed=-2.4000000953674316, lapis_lazuliPaxelEfficiency=9.0, lapis_lazuliPaxelEnchantability=32, lapis_lazuliPaxelDurability=256, lapis_lazuliToughness=0.0, lapis_lazuliKnockbackResistance=0.0, lapis_lazuliBootDurability=130, lapis_lazuliBootArmor=1, lapis_lazuliLeggingDurability=150, lapis_lazuliLeggingArmor=3, lapis_lazuliChestplateDurability=160, lapis_lazuliChestplateArmor=4, lapis_lazuliHelmetDurability=110, lapis_lazuliHelmetArmor=1}}, bronze=SynchronizedConfig{DataHolder:{bronzeToolDurability=375, bronzeEfficiency=7.0, bronzeAttackDamage=2.0, bronzeEnchantability=10, bronzeShieldDurability=403, bronzeSwordDamage=3.0, bronzeSwordAtkSpeed=-2.4000000953674316, bronzeShovelDamage=1.5, bronzeShovelAtkSpeed=-3.0, bronzeAxeDamage=7.0, bronzeAxeAtkSpeed=-3.0, bronzePickaxeDamage=1.0, bronzePickaxeAtkSpeed=-2.799999952316284, bronzeHoeDamage=-2.0, bronzeHoeAtkSpeed=-1.0, bronzePaxelDamage=8.0, bronzePaxelAtkSpeed=-2.4000000953674316, bronzePaxelEfficiency=7.0, bronzePaxelEnchantability=10, bronzePaxelDurability=750, bronzeToughness=1.0, bronzeKnockbackResistance=0.0, bronzeBootDurability=234, bronzeBootArmor=2, bronzeLeggingDurability=270, bronzeLeggingArmor=6, bronzeChestplateDurability=288, bronzeChestplateArmor=7, bronzeHelmetDurability=198, bronzeHelmetArmor=3}}, osmium=SynchronizedConfig{DataHolder:{osmiumToolDurability=350, osmiumEfficiency=4.0, osmiumAttackDamage=4.0, osmiumEnchantability=14, osmiumShieldDurability=672, osmiumSwordDamage=3.0, osmiumSwordAtkSpeed=-2.4000000953674316, osmiumShovelDamage=1.5, osmiumShovelAtkSpeed=-3.0, osmiumAxeDamage=8.0, osmiumAxeAtkSpeed=-3.299999952316284, osmiumPickaxeDamage=1.0, osmiumPickaxeAtkSpeed=-2.799999952316284, osmiumHoeDamage=-4.0, osmiumHoeAtkSpeed=1.0, osmiumPaxelDamage=9.0, osmiumPaxelAtkSpeed=-2.4000000953674316, osmiumPaxelEfficiency=4.0, osmiumPaxelEnchantability=14, osmiumPaxelDurability=700, osmiumToughness=3.0, osmiumKnockbackResistance=0.10000000149011612, osmiumBootDurability=250, osmiumBootArmor=3, osmiumLeggingDurability=300, osmiumLeggingArmor=6, osmiumChestplateDurability=300, osmiumChestplateArmor=7, osmiumHelmetDurability=250, osmiumHelmetArmor=3}}, steel=SynchronizedConfig{DataHolder:{steelToolDurability=500, steelEfficiency=7.0, steelAttackDamage=3.0, steelEnchantability=16, steelShieldDurability=448, steelSwordDamage=3.0, steelSwordAtkSpeed=-2.4000000953674316, steelShovelDamage=1.5, steelShovelAtkSpeed=-3.0, steelAxeDamage=7.0, steelAxeAtkSpeed=-3.0, steelPickaxeDamage=1.0, steelPickaxeAtkSpeed=-2.799999952316284, steelHoeDamage=-3.0, steelHoeAtkSpeed=0.0, steelPaxelDamage=8.0, steelPaxelAtkSpeed=-2.4000000953674316, steelPaxelEfficiency=8.0, steelPaxelEnchantability=16, steelPaxelDurability=1000, steelToughness=2.0, steelKnockbackResistance=0.0, steelBootDurability=300, steelBootArmor=3, steelLeggingDurability=350, steelLeggingArmor=6, steelChestplateDurability=350, steelChestplateArmor=8, steelHelmetDurability=300, steelHelmetArmor=3}}, refined_glowstone=SynchronizedConfig{DataHolder:{refined_glowstoneToolDurability=384, refined_glowstoneEfficiency=13.0, refined_glowstoneAttackDamage=2.0, refined_glowstoneEnchantability=20, refined_glowstoneShieldDurability=381, refined_glowstoneSwordDamage=3.0, refined_glowstoneSwordAtkSpeed=-2.4000000953674316, refined_glowstoneShovelDamage=1.5, refined_glowstoneShovelAtkSpeed=-3.0, refined_glowstoneAxeDamage=6.0, refined_glowstoneAxeAtkSpeed=-2.9000000953674316, refined_glowstonePickaxeDamage=1.0, refined_glowstonePickaxeAtkSpeed=-2.799999952316284, refined_glowstoneHoeDamage=-2.0, refined_glowstoneHoeAtkSpeed=-1.0, refined_glowstonePaxelDamage=7.0, refined_glowstonePaxelAtkSpeed=-2.4000000953674316, refined_glowstonePaxelEfficiency=13.0, refined_glowstonePaxelEnchantability=20, refined_glowstonePaxelDurability=768, refined_glowstoneToughness=0.0, refined_glowstoneKnockbackResistance=0.0, refined_glowstoneBootDurability=221, refined_glowstoneBootArmor=3, refined_glowstoneLeggingDurability=255, refined_glowstoneLeggingArmor=6, refined_glowstoneChestplateDurability=272, refined_glowstoneChestplateArmor=7, refined_glowstoneHelmetDurability=187, refined_glowstoneHelmetArmor=3}}, refined_obsidian=SynchronizedConfig{DataHolder:{refined_obsidianAttackDamage=5.0, refined_obsidianShieldDurability=1680, refined_obsidianSwordDamage=3.0, refined_obsidianSwordAtkSpeed=-2.4000000953674316, refined_obsidianShovelDamage=1.5, refined_obsidianShovelAtkSpeed=-3.0, refined_obsidianAxeDamage=7.0, refined_obsidianAxeAtkSpeed=-2.9000000953674316, refined_obsidianPickaxeDamage=1.0, refined_obsidianPickaxeAtkSpeed=-2.799999952316284, refined_obsidianHoeDamage=-8.0, refined_obsidianHoeAtkSpeed=5.0, refined_obsidianEfficiency=10.0, refined_obsidianPaxelDamage=8.0, refined_obsidianPaxelAtkSpeed=-2.4000000953674316, refined_obsidianPaxelEfficiency=10.0, refined_obsidianPaxelEnchantability=18, refined_obsidianEnchantability=18, refined_obsidianToughness=3.0, refined_obsidianKnockbackResistance=0.20000000298023224, refined_obsidianBootDurability=429, refined_obsidianLeggingDurability=495, refined_obsidianChestplateDurability=528, refined_obsidianHelmetDurability=363, refined_obsidianBootArmor=5, refined_obsidianLeggingArmor=7, refined_obsidianChestplateArmor=9, refined_obsidianHelmetArmor=5, refined_obsidianToolDurability=1000, refined_obsidianPaxelDurability=2000}}}}}}, path=/private/var/opt/minecraft/crafty/crafty-4/servers/053e9b66-96e1-45bd-811b-f7b36f4d204f/config/Mekanism/tools-materials-startup.toml, modConfig=net.neoforged.fml.config.ModConfig@2b6a1b9] is not correct. Correcting
[09:39:21] [pool-11-thread-1/WARN] [ne.ne.ne.co.ModConfigSpec/CORE]: Incorrect key materials.refined_obsidian.refined_obsidianHoeDamage was corrected from -8.0 to its default, -8.0. This seems to be an error.

This is making monitoring console very difficult. this is happening constantly.

Steps to reproduce

  1. Launch single player or server
  2. watch the console

Minecraft version

1.21.1 (Latest)

NeoForge version

21.1.72

Mekanism version

10.7.7 (Latest)

Other relevant versions

Mekanism-1.21.1-10.7.7.64

If a (crash)log is relevant for this issue, link it here: (It's almost always relevant)

No response

commented

I may have figured out why the boundary is -5.0. Here is the predicate that validates those config values:

Predicate<Object> damageModifierPredicate = value -> {
    if (value instanceof Double) {
        double val = (double) value;
        float actualValue;
        if (val > Float.MAX_VALUE) {
            actualValue = Float.MAX_VALUE;
        } else if (val < -Float.MAX_VALUE) {
            //Note: Float.MIN_VALUE is the smallest positive value a float can represent
            // the smallest value a float can represent overall is -Float.MAX_VALUE
            actualValue = -Float.MAX_VALUE;
        } else {
            actualValue = (float) val;
        }
        float baseDamage = attackDamage.getOrDefault();
        return actualValue >= -baseDamage && actualValue <= Float.MAX_VALUE - baseDamage;
    }
    return false;
};

Notice that baseDamage derives from the attackDamage. Since refined_obsidianAttackDamage is 5.0 (logged above), all other tool values for this tier must be -5.0 or greater. Thus, refined_obsidianHoeDamage is invalidated, because it has a value of -7.0.

commented

Notably, obsidian is the only tool tier where hoe damage isn't equal to negated attack damage. This could be an oversight, perhaps a typo somewhere.

commented

Okay, your refined_obsidianAttackDamage (5) is not the default value. Due to how the config is validated, this isn't compatible with the value of refined_obsidianHoeDamage you have right now (which is the default). This means, as an alternative solution, you can reset refined_obsidianAttackDamage back to the default value, which is (as of now) 8.

It is unfortunate that the configuration loader is not able to detect this inadequacy, and instead makes a futile bid to correct a value which is already the default, and not the root cause of the problem. There may be some room for improvement here.

commented

As a workaround, can you please try setting refined_obsidianHoeDamage to be at least -5.0 in .minecraft/config/Mekanism/tools-materials-startup.toml?

		#Attack damage modifier of Refined Obsidian hoes.
		refined_obsidianHoeDamage = -5.0

The default value -8.0 appears to be outside the valid domain, causing the relevant config option to be marked invalid and reset approximately twice per second.

commented

That works as a workaround, but does the default config need fixed or does the allowed range need fixed? Where is the range even defined?

commented

Looks like there's not much we can do here, as the message is from the config system built into the loader. Let me know if I've misinterpreted this and we can reopen.

commented

The problem is much more than a message. An incorrect config on load triggers a rewrite of the config to fix the problem, which triggers the file watcher, which reloads and revalidates it. But if it is still broken, it can trigger the cycle again, which causes infinite rewrites to the configuration files (at least the number of bak files appear capped, but it still is creating/deleting files at least once a second) and seemingly prevents graceful server shutdown a large portion of the time requiring the jvm to be manually killed. So overall these errors are really bad, especially when a mod's default config doesn't even self-validate which is the most common case, though not this time.

The underlying problem here appears to be the dependency on the materialAttackDamage and materialToolDamage configs via the validation function. Having interdependencies between config values kind of breaks the automatic config correction from forge because it tries to use a default value that may now be out of range due to the dependency on something else. If the config spec can take a function/supplier to provide a dynamic default value rather than a constant, and use the value of materialAttackDamage as part of its calculation for that acceptable default, that would be ideal. Although commenting/documenting the dependency between the values might be sufficient.

commented

Good point, will see if we can get it documented.

The rest of it is on the config system, which is largely out of our control

commented

Hrm, it seems ModConfigSpec.Builder.define can take a default value supplier to provide a dynamic value, so it should be possible to write a supplier that returns -AttackDamage if you opt for that route over a comment or both?

Some people from the above linked Craftoria issue seem to favor a fix that would always use a good default. While that would perhaps be ideal, I'm of the mind that if you incorrectly tweak a mod's config, and you ignore the log spam that ensues that's on you not the mod.

commented

hmmm i could have sworn that wasn't a thing last I looked. Good spotting!

commented

I'm of the mind that if you incorrectly tweak a mod's config

I tend to agree, but sometimes you gotta account for the silly users.

Solution seems to work quite well, sadly config files don't get the new description until they're wiped and re-created, but ehhh