SevTech: Ages of the Sky

SevTech: Ages of the Sky

1M Downloads

Null sanity checks are missing

kereis opened this issue ยท 1 comments

commented

Context

Some friends and I attempted to add some mods to this modpack but we've encountered a problem regarding crafting recipes not longer working. We've pinned it down to NuclearCraft and EnderIO + EnderTweaker.

Config/Script Details (if desired)

Affecting Tinkers.zs and Utils.zs

When taking a look into crafttweaker.log after adding the two mentioned mods above, this exception occurs:

[INITIALIZATION][CLIENT][ERROR] [crafttweaker]: Error executing {[-100:crafttweaker]: crafttweaker\postInit.zs}: null
java.lang.NullPointerException
    at crafttweaker\Utils.getHighestStage(crafttweaker\utils.zs:147)
    at crafttweaker\staging\Tinkers.init(crafttweaker\staging\tinkers.zs:263)
    at crafttweaker\PostInit.initSpecificStaging(crafttweaker\postInit.zs:59)
    at crafttweaker\PostInit.__script__(crafttweaker\postInit.zs:19)
    at __ZenMain__.run(crafttweaker\PostInit)
    at crafttweaker.runtime.CrTTweaker.loadScript(CrTTweaker.java:225)
    at crafttweaker.runtime.CrTTweaker.loadScript(CrTTweaker.java:105)
    at crafttweaker.mc1120.events.CommonEventHandler.registerRecipes(CommonEventHandler.java:73)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_1203_CommonEventHandler_registerRecipes_Register.invoke(.dynamic)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
    at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:144)
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)
    at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:857)
    at net.minecraftforge.common.crafting.CraftingHelper.loadRecipes(CraftingHelper.java:636)
    at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:747)
    at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:336)
    at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:535)
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:378)
    at net.minecraft.client.main.Main.main(SourceFile:123)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

According to at crafttweaker\Utils.getHighestStage(crafttweaker\utils.zs:147), it's caused by this line when retrieving stage names in Utils.getHighestStage:

var secondStageName as string = secondStage.stage;

caused by Tinkers.init:263 passing a null object:

var materialStage as Stage = ZenStager.getTiCMaterialStage(subItemMaterial); // This has to be null
var materialPartStage as Stage = scripts.crafttweaker.utils.getHighestStage(partStage, materialStage);

Either possible fixes for this would be:

  • Add missing items/materials to Tinkers' stages
  • Check if materialStage is null and skip its stage assignments

Affecting itemModifiers/descriptions.zs and itemModifiers/tooltips.zs

After temporarily fixing the bugs detailed above, another stack trace appeared:

[INITIALIZATION][SERVER][ERROR] [crafttweaker]: Error executing {[-100:crafttweaker]: crafttweaker/postInit.zs}: null
java.lang.NullPointerException
	at crafttweaker.mods.jei.JEI.addDescription(JEI.java:86)
	at crafttweaker\itemModifiers\Descriptions.init(crafttweaker/itemModifiers/descriptions.zs:278)
	at crafttweaker\PostInit.initItemModifiers(crafttweaker/postInit.zs:320)
	at crafttweaker\PostInit.__script__(crafttweaker/postInit.zs:22)
	at __ZenMain__.run(crafttweaker\PostInit)
	at crafttweaker.runtime.CrTTweaker.loadScript(CrTTweaker.java:225)
	at crafttweaker.runtime.CrTTweaker.loadScript(CrTTweaker.java:105)
	at crafttweaker.mc1120.events.CommonEventHandler.registerRecipes(CommonEventHandler.java:73)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_1016_CommonEventHandler_registerRecipes_Register.invoke(.dynamic)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
	at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:144)
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)
	at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:857)
	at net.minecraftforge.common.crafting.CraftingHelper.loadRecipes(CraftingHelper.java:636)
	at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:747)
	at net.minecraftforge.fml.server.FMLServerHandler.finishServerLoading(FMLServerHandler.java:108)
	at net.minecraftforge.fml.common.FMLCommonHandler.onServerStarted(FMLCommonHandler.java:338)
	at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:219)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:486)
	at java.lang.Thread.run(Thread.java:748)

Something that I noticed as well in crafttweaker.log are these line for descriptions.zs:

[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/descriptions.zs:15: Could not resolve <environmentaltech : solar_cont_1 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/descriptions.zs:21: Could not resolve <environmentaltech : solar_cont_2 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/descriptions.zs:27: Could not resolve <environmentaltech : solar_cont_3 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/descriptions.zs:33: Could not resolve <environmentaltech : solar_cont_4 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/descriptions.zs:39: Could not resolve <environmentaltech : solar_cont_5 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/descriptions.zs:45: Could not resolve <environmentaltech : solar_cont_6 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/descriptions.zs:98: Could not resolve <environmentaltech : void_ore_miner_cont_1 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/descriptions.zs:105: Could not resolve <environmentaltech : void_ore_miner_cont_2 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/descriptions.zs:113: Could not resolve <environmentaltech : void_ore_miner_cont_3 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/descriptions.zs:121: Could not resolve <environmentaltech : void_ore_miner_cont_4 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/descriptions.zs:129: Could not resolve <environmentaltech : void_ore_miner_cont_5 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/descriptions.zs:137: Could not resolve <environmentaltech : void_ore_miner_cont_6 : 0>

similar to tooltips.zs:

[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/tooltips.zs:168: Could not resolve <environmentaltech : solar_cont_1 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/tooltips.zs:171: Could not resolve <environmentaltech : solar_cont_2 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/tooltips.zs:174: Could not resolve <environmentaltech : solar_cont_3 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/tooltips.zs:177: Could not resolve <environmentaltech : solar_cont_4 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/tooltips.zs:180: Could not resolve <environmentaltech : solar_cont_5 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/tooltips.zs:183: Could not resolve <environmentaltech : solar_cont_6 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/tooltips.zs:208: Could not resolve <environmentaltech : void_ore_miner_cont_1 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/tooltips.zs:211: Could not resolve <environmentaltech : void_ore_miner_cont_2 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/tooltips.zs:214: Could not resolve <environmentaltech : void_ore_miner_cont_3 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/tooltips.zs:217: Could not resolve <environmentaltech : void_ore_miner_cont_4 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/tooltips.zs:220: Could not resolve <environmentaltech : void_ore_miner_cont_5 : 0>
[INITIALIZATION][SERVER][ERROR] crafttweaker/itemModifiers/tooltips.zs:223: Could not resolve <environmentaltech : void_ore_miner_cont_6 : 0>

For some reason, I'm not able to print the item which item modifiers to be added but after introducing a null check in the script files respectively, the stack trace disappeared. As all of the log's mentioned item have a dictionary entry in tooltips.zs and descriptions.zs, I suspect that descriptions and tooltips set on unresolved IItemStacks cause these issues. Maybe definition of Environmental Tech's IItemStacks have changed?

Pull request

If you want to see my current fixes, you can lookup the linked pull request. There are some // TODO comments as well. Feel free to discuss the suggested solution.

commented

As discussed on the linked PR, null checks here are not necessarily appropriate. Hiding errors is not beneficial to development as it allows for mistakes to slip into the released pack. The scripts are written to work in the modpack as shipped; any modifications to the mod list may require changes to the scripts.

I do not have any issues with tooltips or descriptions when loading 3.2.1 unmodified, which is why I have marked this as Cannot Reproduce.