Additional Lanterns

Additional Lanterns

14M Downloads

[Crash] Crash with NeoForge

Lolothepro opened this issue ยท 14 comments

commented

Version Info

  • Minecraft 1.20.4
  • Additional Lantern 1.1.1
  • SuperMartijn642's Core lib 1.1.17

Steps to Reproduce
Try to create a world

Crash report (~/logs/latest.log)

latest.log

commented

This seems to be caused by a combination with some other mod you have. Likely something to do with copper blocks.
Could you narrow down which other mods are needed to reproduce the issue?

commented

No, I only have two mods:
Additional Lantern 1.1.1
SuperMartijn642's Core lib 1.1.17

crash-2024-04-18_21.59.57-client.txt

commented

I cannot reproduce the issue, it seems to create a world just fine.
image

commented

It seems to happen only when you create the first world (like when the game has no world in the files) (like when the instance is new).

commented

just remove all folders/files in the "saves" folder

commented
java.lang.IllegalStateException: null
    at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.lambda$static$0(Suppliers.java:162) ~[guava-32.1.2-jre.jar#104!/:?] {}
    at com.supermartijn642.additionallanterns.AdditionalLanterns.lambda$init$3(AdditionalLanterns.java:105) ~[additionallanterns-1.1.1-neoforge-mc1.20.4.jar#173!/:?] {re:classloading}
    at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:181) ~[guava-32.1.2-jre.jar#104!/:?] {}
    at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:181) ~[guava-32.1.2-jre.jar#104!/:?] {}
    at net.minecraft.world.level.block.WeatheringCopper.getNext(WeatheringCopper.java:74) ~[client-1.20.4-20231207.154220-srg.jar#175!/:?] {re:classloading,pl:accesstransformer:B} 

Additional Lanterns is setting something to null, and it causes a null entry in the weathering copper map on a resource reload

Curle

commented

It seems to happen only when you create the first world (like when the game has no world in the files) (like when the instance is new).

just remove all folders/files in the "saves" folder

Both, after deleting the saves folder and after creating a completely new profile, I can still create a new world without any issue.

commented

My instance (CurseForge):
MyInstance.zip

commented

This code looks problematic to me:

// Weathering
delegateField = WeatheringCopper.NEXT_BY_BLOCK.getClass().getDeclaredField("delegate");
delegateField.setAccessible(true);
//noinspection unchecked
Supplier<BiMap<Block,Block>> oldWeathering = (Supplier<BiMap<Block,Block>>)delegateField.get(WeatheringCopper.NEXT_BY_BLOCK);
I suspect some other mod already queried the weathering map (perfectly valid AFAICT), so the delegate supplier you extract is actually the dummy supplier indicating that the value has already been computed.

commented

After some testing, it seems that you are correct. At some point between 1.20.1 and 1.20.4, either vanilla or NeoForge has changed such that vanilla's copper blocks initialize and access the weathering map before mods even get constructed.
My code was copied from Create https://github.com/Creators-of-Create/Create/blob/c92bbdda2d023d0c148c1afd271327fe4fdc7301/src/main/java/com/simibubi/create/foundation/block/CopperRegistries.java#L45-L60.
But I guess the same no longer works in newer versions.

Since I can no longer modify the map, I've opted to mixin into all the methods that access the map instead and simply check a map maintained by Additional Lanterns itself.

I am still unable to reproduce the crash, so @Lolothepro could you check if this jar fixes it? https://drive.google.com/file/d/1_dsiV3bOP-2zHmOItM3IbOl78KLjJdJP/view?usp=sharing

commented

it's fixed

commented

Just, can you release the jar?

commented

Yes, that was just to confirm I actually fixed the issue. I still have to check the other Minecraft versions/modloaders as well as some other issues.

commented

It is fixed now in the 1.1.1a version for NeoForge 1.20.4.
Thank you both for the help!