Possibly incorrect lighting calculations
Destructor-Ben opened this issue ยท 0 comments
Based on this snippet of code from MInecraft 1.20.4 from Monster.java:
public static boolean isDarkEnoughToSpawn(ServerLevelAccessor serverLevelAccessor, BlockPos blockPos, RandomSource randomSource) {
if (serverLevelAccessor.getBrightness(LightLayer.SKY, blockPos) > randomSource.nextInt(32)) {
return false;
}
DimensionType dimensionType = serverLevelAccessor.dimensionType();
int i = dimensionType.monsterSpawnBlockLightLimit();
if (i < 15 && serverLevelAccessor.getBrightness(LightLayer.BLOCK, blockPos) > i) {
return false;
}
int j = serverLevelAccessor.getLevel().isThundering() ? serverLevelAccessor.getMaxLocalRawBrightness(blockPos, 10) : serverLevelAccessor.getMaxLocalRawBrightness(blockPos);
return j <= dimensionType.monsterSpawnLightTest().sample(randomSource);
}
It appears that the calculations to determine whether a monster will spawn in this mod are incorrect. minecraft.wiki and minecraft.fandom.com are also both wrong in multiple places so I wouldn't blame you if they are wrong (I'm still not sure if I'm right), since they are inconsistent between each other, have misinformation around both of them (that monsters spawn below light level 7, which is not true), and inconsistencies within each wiki (light level vs block light and sky light, lots of others that i cbf listing).
If the calculations for the crosses is changed to be based upon the code above, then it might make sense to remove a lot of the config options too, since there is no reason to allow customization the crosses if the spawn rules stay the same - It could be good though to add different presets for different types of mobs, e.g. regular monsters, drowns, piglins, slimes, etc.
I have made a fork of this repo and will change it myself for personal use, and if you want to merge it then you can. I also might be wrong, but thought I should mention it since monster spawning from light levels is more complicated than what most people think, especially when there are a lot of changes and reverts done to it as well as misinformation.