Immersive Petroleum

Immersive Petroleum

47M Downloads

[1.16.5] Crash when using official mappings in development environment

MrCrayfish opened this issue ยท 0 comments

commented

When using this mod in a development environment that has be deobfuscated with official mappings, a crash will occur when loading a world. This is because setDirty is the name of a method in WorldSavedData, however there is a static method in IPSaveData with the exact same name, parameters, and return type. Java is prefering to pick the non-static method when calling IPSaveData.setDirty() in CommonEventHandler but obviously that does not work without an instance.

Suggested solutions:

  • Add a getInstance() method to IPSaveData and directly call setDirty rather than using a static method.
  • Rename the static setDirty method to a name that doesn't conflict with MCP and Official mappings

Just trying to add support for the fuel in my vehicle mod :)

java.lang.IncompatibleClassChangeError: Expecting non-static method flaxbeard.immersivepetroleum.common.IPSaveData.setDirty()V
	at flaxbeard.immersivepetroleum.common.IPSaveData.setDirty(IPSaveData.java:69)
	at flaxbeard.immersivepetroleum.common.CommonEventHandler.onSave(CommonEventHandler.java:66)
	at net.minecraftforge.eventbus.ASMEventHandler_92_CommonEventHandler_onSave_Save.invoke(.dynamic)
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85)
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302)
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283)
	at net.minecraft.world.server.ServerWorld.save(ServerWorld.java:697)
	at net.minecraft.server.MinecraftServer.saveAllChunks(MinecraftServer.java:532)
	at net.minecraft.server.integrated.IntegratedServer.tickServer(IntegratedServer.java:73)
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:642)
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:232)
	at java.lang.Thread.run(Thread.java:748)