[Bug]: Setting the percentage of vanilla villages is not working in MC 1.20.1
akra73 opened this issue ยท 5 comments
Describe the bug you're experiencing
With "hostilevillages-1.20.1-5.3.jar" installed for MC 1.20.1 I've been setting the "vanillaVillageChance" to values between 0-100 and only getting all hostile or all vanilla villages based on what is set for "allowVanillaVillagerSpawn". The Bug Report UI here only allowed me to choose up to MC 1.19.
I've been using this mod in the past for some previous MC versions and it worked correctly.
Reproducability
To reproduce the issue generate a new world (without any other mods installed). In the case of seed "1" and "Single Biome" world type set to "Plains", two villages will be near the world spawn location. Their X/Z coordinates are 200/200 and 300/600.
If "allowVanillaVillagerSpawn" is set to "false" then both villages will be hostile, if it is set to "true" then both will be vanilla. The value for "vanillaVillageChance" is ignored, it can be tested for any value from 0-100.
Mod up to date
- Before submitting this issue I updated to the newest version and reproduced it
Minecraft version
1.19
Modloader version
Forge
Logs
https://gist.github.com/akra73/3a8d02bd704dddb05bc9c55de5404183
fixed in 5.4
Modded villages would need to be get specific compat for each one, not sure how doable that is
Issue is found in line 137 of the following file: HostileVillages/src/main/java/com/hostilevillages/config/CommonConfiguration.java.
Pre-1.20.1:
- vanillaVillageChance = builder.defineInRange("vanillaVillageChance", 0, 0, 100);
Patch 1.20.1 removes the reference to "builder" and so uses a different implementation.
- vanillaVillageChance = Math.min(100, data.get("vanillaVillageChance").getAsJsonObject().get("vanillaVillageChance").getAsInt());
Likely Math.min is returning 100 everytime causing only villagers to spawn.
Nevermind, even hard-coding the variable did not change behavior. I think it's something to do with the code re-write that 1.20.1 of this mod had, which is harder to troubleshoot.
@rjeb Thanks for checking it out, anyway.