[Bug]: Just Enough Professions crashed with everlasting abilities
dnk1234567 opened this issue ยท 5 comments
General Info
- I am running a modpack
- I can reproduce this issue consistently in single-player
- I can reproduce this issue consistently in multi-player
- I have searched for this issue previously and it was either (1) not previously reported, or (2) previously fixed and I am having the same problem.
- I am crashing and can provide my crash report(s)
- I am using the latest version of the mod
Loader version
Forge 47.2.6
Minecraft version
1.20.1
Mod version
3.0.1
Java version
Java 17.0.11 GraalVM
Issue Description
Mainly reported in
CyclopsMC/EverlastingAbilities#256
Additional Information
No response
Hey @rubensworks , could you point to where I'm calling random? All I'm doing is rendering an entity ๐
Could it have to do with which level I feed the villager I construct to render? https://github.com/Mrbysco/JustEnoughProfessions/blob/multi/1.20/common/src/main/java/com/mrbysco/justenoughprofessions/jei/ProfessionEntry.java#L24
Hmm, not sure to be honest, I hoped you'd know ๐
It could also be one of the entities you're rendering that is calling random somewhere in an off-thread somehow?
In which case it would be impossible to fix here as well...
I managed to reproduce this by adding this code (in NeoForgePlatformHelper):
@SubscribeEvent
public static void thingytestthingy(LevelTickEvent.Post event) {
if (event.getLevel() instanceof ServerLevel sl) {
for (int i = 0; i < 100; i++)
sl.random.nextDouble();
sl.getServer().sendSystemMessage(Component.literal("Generated lots of random numbers!"));
}
}
@SubscribeEvent
public static void otherthingtestthing(RenderLivingEvent.Post event) {
for (int i = 0; i < 100; i++)
event.getEntity().level().random.nextDouble();
}
It seems that you use the server level to make the entity, and only fallback to the client level if the server level isn't available. You should always use the client level here cause you are on the client thread. I'll make a PR to fix this.