Tweaking copper ore Crashes on world gen
Cracks777 opened this issue ยท 11 comments
Minecraft Version
1.18.2
Forge Version
forge-1.18.2-40.0.36
Mod Version
OreTweaker-1.18.2-3.1.0
Describe the bug
When editing the config to lower copper ore gen it crashes the game when creating a new world
How to reproduce
change "maxVeinSize": 10 and"spawnRate": 8.0,, create new world and it will crash
**Link to [crashlog]
Can you send me a link to a pastbin of your copper json file?
it only happens when changing the values for dripstone caves.
I will look into it first thing after I get home from work.
But it looks like there could be an issue with TerraBlender.
OreTweaker does not really like mods that change to much things about world generation.
Okey, good to know. Then its not Terrablenders fault.
I will do some testing once and get back to you.
Ok did some more testing, if you change values for both entries it will crash, if you only change one or the other it does not crash, here the json that causes the crash
i removed bop and terrablender and still get the crash, thank you for looking into this.
Found the issue @Cracks777.
Ore Tweaker uses the properties in the copper_ore.json
๐ to generate a unique name for the ore object being registered to the game.
The exact alogritem for creating a unique name I use is:
String registryName = String.format("%s_%s_%s_%s_%s_%s_feature",
Objects.requireNonNull(ore.getRegistryName()).getPath(),
fillerName,
minY,
maxY,
spawnRate,
maxVeinSize
);
But since both your entries have the exact same values for these probs the second entry ends up with a duplicated name of the first one. I am releasing a simple fix to check if a name is available, if not it will auto append a number behind it to not collide with the name of the first entry. This was a design flaw when I designed this system.
Thanks for finding it.
Will prob have to backport this to 1.16, 1,17, and 1.18. Working on a fix now. Until then you can change one of these probs to make it magically work again ๐ฅณ๐ฅณ
Created a test build if you want to validate that it works for you now.
https://github.com/EwyBoy/OreTweaker/releases/tag/v1.18.2-Fix-Test
If its stable I will release it on CurseForge tomorrow for 1.16, 1.17 and 1.18.1/2
New code should make it impossible to create duplicates.
private static String makeRegistryNameUnique(String name) {
if (registryNames.contains(name)) {
int i = 1;
while (registryNames.contains(name + "_" + i)) {
i++;
}
return name + "_" + i;
}
return name;
}
private static final List<String> registryNames = new ArrayList<>();
private static String createUniqueRegistryName(Block block, String filler, int minY, int maxY, float spawnRate, int maxVeinSize, float discardChanceOnAirExposure, String distribution, boolean isDeepSlate, String featureType) {
String registryName;
if (isDeepSlate) {
registryName = String.format("deepslate_%s_%s_%s_%s_%s_%s_%s_%s_%s_feature",
Objects.requireNonNull(block.getRegistryName()).getPath(),
filler,
minY,
maxY,
spawnRate,
maxVeinSize,
discardChanceOnAirExposure,
distribution,
featureType
);
} else {
registryName = String.format("ore_%s_%s_%s_%s_%s_%s_%s_%s_%s_feature",
Objects.requireNonNull(block.getRegistryName()).getPath(),
filler,
minY,
maxY,
spawnRate,
maxVeinSize,
discardChanceOnAirExposure,
distribution,
featureType
);
}
registryName = makeRegistryNameUnique(registryName);
ModLogger.debug("Registry Name: " + registryName);
registryNames.add(registryName);
return registryName;
}
Fixed for 1.16, 1.18.1 and 1.18.2
https://www.curseforge.com/minecraft/mc-mods/ore-tweaker/files