McJtyMods / InControl

Be In Control of Mob Spawns and others
MIT License
44 stars 16 forks source link

java.lang.IllegalStateException: No world found! #340

Closed SenZ01 closed 1 year ago

SenZ01 commented 1 year ago

Incompatability between Apotheosis and InControl

MC 1.16.5 Forge - 36.2.33 InControl - 1.16-5.2.11

After placing down an Apotheosis spawner and rightclicking it with a soul lantern which is supposed to make said spawner ignore light levels both client and server crashed.

Crashreport Server

Here as a quick explanation on what is happening from the Apotheosis Dev.

When you use the soul lantern I have to use a "fake world" where I can forcibly control the light levels to evaluate if the mob can spawn given all conditions except the light level

Whatever InControl is doing is not prepared to receive the fake world likely doing an unsafe cast from SeverLevelAccessor to Level

they're doing the thing they shouldn't be doing, which is just instanceof/casting https://github.com/McJtyMods/InControl/blob/1.16/src/main/java/mcjty/incontrol/tools/varia/Tools.java#L164

realistically though all they need to change are these lines

        } else if (world instanceof WorldGenRegion) {
            sw = ((WorldGenRegion) world).getLevel();

->

        } else if (world instanceof ServerLevelAccessor) {
            sw = ((ServerLevelAccessor) world).getLevel();
McJty commented 1 year ago

This solution works fine on 1.18 and 1.19 but not on 1.16. 1.16 doesn't have ServerLevelAccessor

McJty commented 1 year ago

I fixed this for 1.18 and 1.19. Still no idea what to do on 1.16 though

Shadows-of-Fire commented 1 year ago

1.16 does have it, it was just called IServerWorld then

McJty commented 1 year ago

Aha thanks. So problem is fixed now