WTHIT

WTHIT

10M Downloads

NPE Crash when running data generators

AnonymousHacker1279 opened this issue ยท 0 comments

commented

Describe the issue

When trying to run the runData task in Forge, WTHIT tries to access the options field of Minecraft. However, Minecraft.getInstance() is null during data generation, causing a NPE crash. It looks like this is during keybind registration:

Caused by: java.lang.NullPointerException: Cannot read field "options" because the return value of "net.minecraft.client.Minecraft.getInstance()" is null
	at net.minecraftforge.client.ClientRegistry.registerKeyBinding(ClientRegistry.java:29) ~[forge-1.18.2-40.0.19_mapped_parchment_2022.03.13-1.18.2.jar%2375%2381!/:?] {re:classloading}
	at mcp.mobius.waila.forge.ForgeClientService.createKeyBind(ForgeClientService.java:17) ~[wthit-forge-4.7.3_mapped_parchment_2022.03.13-1.18.2.jar%2383!/:4.7.3] {re:classloading}
	at mcp.mobius.waila.WailaClient.<clinit>(WailaClient.java:22) ~[wthit-forge-4.7.3_mapped_parchment_2022.03.13-1.18.2.jar%2383!/:4.7.3] {re:classloading}
	... 14 more

I haven't encountered this issue before upgrading to 1.18.x. Previously, I was on version 4.4.1 of WTHIT. Right now, I am on version 4.7.3. My Forge version is 40.0.19.

My build.gradle defines the dependency like so,

dependencies {
        [other dependencies]

	compileOnly fg.deobf("mcp.mobius.waila:wthit-api:${wthit_version}")
	runtimeOnly fg.deobf("mcp.mobius.waila:wthit:${wthit_version}")
}

where wthit_version is forge-4.7.3.

If it helps, this is how I define my runData configuration:

data {
		workingDirectory project.file('run')

		property 'forge.logging.markers', 'REGISTRIES'

		property 'forge.logging.console.level', 'debug'

		// For Patchouli to work in-dev
		property 'mixin.env.remapRefMap', 'true'
		property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"

		args '--mod', 'immersiveweapons', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')

		mods {
			immersiveweapons {
				source sourceSets.main
			}
		}
	}

If you need it, I can post the entirety of my build.gradle.

Log output

https://gist.github.com/AnonymousHacker1279/369bb8ab8a1c6a19fa8e03d769075eef

Additional context

No response