Sophisticated Backpacks

Sophisticated Backpacks

89M Downloads

[1.19.2] Crash with ic2 classic in dev environment

Trinsdar opened this issue ยท 2 comments

commented

Describe the bug
The mod crashes if I add this as a dep to a dev environment with ic2 classic also as a dep

Expected behavior
Not crash

Versions
1.19.2-3.20.2.1035

crash-2024-09-07_16.06.39-fml.txt

According to speiger (the author of ic2 classic), this is caused from using server configs in "common code":
Screenshot_20240907_161354

Edit: apparently this is the line of code causing the issue:
https://github.com/P3pp3rF1y/SophisticatedBackpacks/blob/1.19.x/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackItem.java#L317

commented

Looks like ic2 is making stack cache and as part of it tries to figure out some fluid stuff on backpack stack and that's where backpacks need to look at config to understand how space is in them. Apparently ic2 does this cahching way too early in the process before configs are loaded. So yeah you will need to remove something here. Also this is 1.19.2 which I haven't supported for a very long time and it's likely the same for ic2

commented

@P3pp3rF1y what part about the "FMLLoadCompleteEvent" (the last event forge for the modloading process) is to early?
The only reason you should be using a Server config for piece of code is when ONLY the server can access it.

The moment anything on the client tries to access the Fluid function the game simply crashes in development if no world is loaded.

Anyways. IC2Classic is still supported. Even 1.7.10 is, but the only way we can fix this is simply by introduce a mixin/asm that deletes/replaces your check.

For future reference:

public void example(Item item) {
    ItemStack stack = new ItemStack(item);
    FluidStack fluid = FluidUtil.getFluidContained(stack)
}

If this code is capable of crashing after the game is loaded but before you enter a world you have done something very wrong.