GiantLuigi4 / Smaller-Units

A small blocks mod, inspired by little blocks
MIT License
8 stars 7 forks source link

Crash with Pokecube AIO #99

Open WenXin20 opened 3 years ago

WenXin20 commented 3 years ago

Minecraft v1.16.5 Forge v36.0.43 Smaller Units v1.0 Pokecube AIO v3.10.1

When the mod Pokecube AIO is installed, the game will crash when a world is loaded. Crash Report

Thutmose commented 3 years ago

The particular details of the crash is as follows:

Pokecube initializes some stuff when the overworld is first constructed, this is done via the AttachCapabilitiesEvent, and it checks if getDimensionKey() for the world is overworld. In this case, your dimension key is null, so it crashes.

This particular case is fixed on pokecube's side by reversing the equality check, but you might still consider returning something for getDimensionKey() incase something else calls it later, that isn't listed as a nullable return value.

GiantLuigi4 commented 3 years ago

I'm running the attach capabilities event before the tile entity has a world attached to it, which means that there is nothing that the fake world is capable of returning as the tile entity does not have access to the world it's in Easiest solution for me would just to offset the attach capabilities event to first tick instead of initialization of the tile entity, as I do have getDimensionKey filled out

GiantLuigi4 commented 3 years ago

turns out this isn't the only thing which causes crashes when pokecube is installed with smaller units:

Caused by: java.lang.NullPointerException
    at pokecube.core.database.worldgen.WorldgenHandler.addDimensionalSpacing(WorldgenHandler.java:482) ~[?:3.10.1]
    at net.minecraftforge.eventbus.ASMEventHandler_34_WorldgenHandler_addDimensionalSpacing_Load.invoke(.dynamic) ~[?:?]

more mods for me to look into the code of too see what I overlooked, nice

Thutmose commented 3 years ago

ahh, ya, it is probably also checking the dimension key there as well (to see if that dimension is supposed to have structures added)

In that case, it is listening for the WorldEvent.Load. There it is crashing on trying to get the chunk generator for this "server world".

GiantLuigi4 commented 3 years ago

yep, currently working on #101 but I think I have the generator done now, so once I finish #101 I'll go back to fixing issues between SU and PokeCube

GiantLuigi4 commented 3 years ago

image apparently that was the last issue for this or so it seems

GiantLuigi4 commented 3 years ago

places small pokecenter and has game crash welp that'd be why I left this open

Thutmose commented 3 years ago

If any of the crashes do appear to be on my end, just let me know and I can look into fixes!

GiantLuigi4 commented 3 years ago

image using a temporary solution until I make a fake client world, I've gotten it to a point where the game seems to not crash, and the guis do work

WenXin20 commented 3 years ago

This is the crash I now get with Pokecube v3.10.2 when a 1/8 Unit Block is placed. https://gist.github.com/WenXin20/a403c1e7cdc1ac1f832c7ff6e390a454

GiantLuigi4 commented 3 years ago

@Thutmose I just wanna ask, why exactly are you checking if the world is an instance of server world instead of checking if it's not remote? Sure they're basically the same, but there is a chance that I'm not the only mod dev who might wind up getting thrown off due to not being bothered to make a FakeClientWorld class, as the constructor is more specific then the constructor for ServerWorld.

Thutmose commented 3 years ago

I can probably change to isRemote checks now, but it was from earlier issues with mods that would make fake worlds, which were not ServerWorlds, yet isRemote was false for

GiantLuigi4 commented 3 years ago

maybe make a check for (!world.isRemote && world instanceof ServerWorld)?

Thutmose commented 3 years ago

Also, in my cases, I need ServerWorld based functions, so the world instanceof ServerWorld was generally a sufficient check, I can change over to adding the extra check as well, though the hopefully now there won't be issues showing up from null worlds as well :D

Thutmose commented 3 years ago

Note that this crash was still on the event.getObject().getDimensionKey() call, which other things might have issues with later anyway

Thutmose commented 3 years ago

Also note that was a second copy of the same exact crash that started this issue in the first place

GiantLuigi4 commented 3 years ago

yea, that was just due to when I called the event, I've already moved it to first tick as the world is not null then smallerunits-1.16.zip (extract the jar from here)

WenXin20 commented 3 years ago

turns out this isn't the only thing which causes crashes when pokecube is installed with smaller units:

Caused by: java.lang.NullPointerException
  at pokecube.core.database.worldgen.WorldgenHandler.addDimensionalSpacing(WorldgenHandler.java:482) ~[?:3.10.1]
  at net.minecraftforge.eventbus.ASMEventHandler_34_WorldgenHandler_addDimensionalSpacing_Load.invoke(.dynamic) ~[?:?]

~more mods for me to look into the code of too see what I overlooked, nice~

The zip file crashes with the same message as the above comment. https://gist.github.com/WenXin20/dd1f91f1d15877632c899457f7c00156

GiantLuigi4 commented 3 years ago

yep, the temp solution I had put in apparently also caused issues with create, so I'm afraid this issue is just gonna have to wait until I do things properly

Thutmose commented 3 years ago

I will also add in a few isRemote checks, though I cannot guarentee that it will fix all of the related issues, as some places use ServerWorld checks for other things which need doing only on ServerWorlds

Thutmose commented 3 years ago

Other similar issues are liable to occur from calling a load event from a world without a registry key however.

GiantLuigi4 commented 3 years ago

again, that issue has been fixed, just not on the cf release

GiantLuigi4 commented 3 years ago

heh, tcon apparently also seems to just check instanceof ServerWorld based off the fact that I just got the same second crash with tcon as I get with pokecube

Thutmose commented 3 years ago

Ya, probably quite a few that do :D

I have included several isRemote() checks in with my instanceof ServerWorld checks, but there might still be other problems around the place

GiantLuigi4 commented 3 years ago

I’ve implemented fake client world, granted this build with fake client world is not on cf yet, so tcon shouldn’t have issues other than the thing where the game crashes if you place small faucet and the entire invtentory freaking out if you use a small tcon block’s gui... cuz those were things which happened last I tested and pokecube should work fully afaik