Tetra

Tetra

12M Downloads

Can't modify non-vanilla materials with datapacks

Zangdorx opened this issue ยท 1 comments

commented

Bug Report

Observed Behaviour
When I create a file "iron.json" or "gold.json" with only some fields, it either adds or replace only these fields to the material, and succeeds to load. However, when I create a file "silver.json" or "copper.json", weither I have another mod adding these materials or not, the datapack loading fails with the traceback below.

Datapack reloading failed log:

[24Dec2020 14:38:11.928] [Render thread/WARN] [net.minecraft.client.Minecraft/]: Failed to load datapacks, can't proceed with server load
java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.util.concurrent.CompletableFuture.reportGet(Unknown Source) ~[?:1.8.0_271]
	at java.util.concurrent.CompletableFuture.get(Unknown Source) ~[?:1.8.0_271]
	at net.minecraft.client.Minecraft.func_238189_a_(Minecraft.java:1859) ~[?:?]
	at net.minecraft.client.Minecraft.func_238195_a_(Minecraft.java:1711) ~[?:?]
	at net.minecraft.client.Minecraft.func_238191_a_(Minecraft.java:1681) ~[?:?]
	at net.minecraft.client.gui.screen.WorldSelectionList$Entry.func_214443_e(SourceFile:407) ~[?:?]
	at net.minecraft.client.gui.screen.WorldSelectionList$Entry.func_214438_a(SourceFile:317) ~[?:?]
	at net.minecraft.client.gui.screen.WorldSelectionList$Entry.func_231044_a_(SourceFile:254) ~[?:?]
	at net.minecraft.client.gui.widget.list.AbstractList.func_231044_a_(AbstractList.java:309) ~[?:?]
	at net.minecraft.client.gui.INestedGuiEventHandler.func_231044_a_(SourceFile:27) ~[?:?]
	at net.minecraft.client.MouseHelper.lambda$mouseButtonCallback$0(MouseHelper.java:87) ~[?:?]
	at net.minecraft.client.gui.screen.Screen.func_231153_a_(Screen.java:427) ~[?:?]
	at net.minecraft.client.MouseHelper.func_198023_a(MouseHelper.java:85) ~[?:?]
	at net.minecraft.client.MouseHelper.lambda$null$4(MouseHelper.java:175) ~[?:?]
	at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(SourceFile:94) ~[?:?]
	at net.minecraft.client.MouseHelper.lambda$registerCallbacks$5(MouseHelper.java:174) ~[?:?]
	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar:build 10]
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar:build 10]
	at org.lwjgl.glfw.GLFW.glfwWaitEventsTimeout(GLFW.java:3174) ~[lwjgl-glfw-3.2.2.jar:build 10]
	at com.mojang.blaze3d.systems.RenderSystem.limitDisplayFPS(SourceFile:127) ~[?:?]
	at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:999) ~[?:?]
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607) ~[?:?]
	at net.minecraft.client.main.Main.main(Main.java:184) ~[minecraft-1.16.4-client.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_271]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_271]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_271]
	at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) ~[forge-1.16.4-35.1.4-launcher.jar:35.1]
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.6.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.6.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.6.jar:?]
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.6.jar:?]
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.6.jar:?]
	at io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:50) [ForgeWrapper-1.4.2.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_271]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_271]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_271]
	at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:196) [NewLaunch.jar:?]
	at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:231) [NewLaunch.jar:?]
	at org.multimc.EntryPoint.listen(EntryPoint.java:143) [NewLaunch.jar:?]
	at org.multimc.EntryPoint.main(EntryPoint.java:34) [NewLaunch.jar:?]
Caused by: java.lang.NullPointerException
	at se.mickelus.tetra.module.data.MaterialVariantData.combine(MaterialVariantData.java:53) ~[tetra:3.4.0]
	at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[?:1.8.0_271]
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.ReferencePipeline$Head.forEach(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.ReferencePipeline$7$1.accept(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[?:1.8.0_271]
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.ReferencePipeline.forEach(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.ReferencePipeline$7$1.accept(Unknown Source) ~[?:1.8.0_271]
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.AbstractPipeline.evaluateToArrayNode(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.ReferencePipeline.toArray(Unknown Source) ~[?:1.8.0_271]
	at se.mickelus.tetra.module.ModuleRegistry.expandMaterialVariants(ModuleRegistry.java:100) ~[tetra:3.4.0]
	at se.mickelus.tetra.module.ModuleRegistry.setupModule(ModuleRegistry.java:120) ~[tetra:3.4.0]
	at se.mickelus.tetra.module.ModuleRegistry.lambda$setupModules$3(ModuleRegistry.java:43) ~[tetra:3.4.0]
	at java.util.stream.Collectors.lambda$toMap$58(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.ReduceOps$3ReducingSink.accept(Unknown Source) ~[?:1.8.0_271]
	at java.util.Collections$2.tryAdvance(Unknown Source) ~[?:1.8.0_271]
	at java.util.Collections$2.forEachRemaining(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.ReferencePipeline$Head.forEach(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.ReferencePipeline$7$1.accept(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) ~[?:1.8.0_271]
	at java.util.HashMap$EntrySpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:1.8.0_271]
	at java.util.stream.ReferencePipeline.collect(Unknown Source) ~[?:1.8.0_271]
	at se.mickelus.tetra.module.ModuleRegistry.setupModules(ModuleRegistry.java:41) ~[tetra:3.4.0]
	at se.mickelus.tetra.module.ModuleRegistry.lambda$new$0(ModuleRegistry.java:34) ~[tetra:3.4.0]
	at java.lang.Iterable.forEach(Unknown Source) ~[?:1.8.0_271]
	at se.mickelus.tetra.data.MergingDataStore.parseData(MergingDataStore.java:100) ~[tetra:3.4.0]
	at se.mickelus.tetra.data.DataStore.apply(DataStore.java:102) ~[tetra:3.4.0]
	at se.mickelus.tetra.data.DataStore.func_212853_a_(DataStore.java:28) ~[tetra:3.4.0]
	at net.minecraft.client.resources.ReloadListener.func_215269_a(SourceFile:13) ~[?:?]
	at java.util.concurrent.CompletableFuture.uniAccept(Unknown Source) ~[?:1.8.0_271]
	at java.util.concurrent.CompletableFuture$UniAccept.tryFire(Unknown Source) ~[?:1.8.0_271]
	at java.util.concurrent.CompletableFuture$Completion.run(Unknown Source) ~[?:1.8.0_271]
	at net.minecraft.resources.AsyncReloader.func_219557_a(SourceFile:71) ~[?:?]
	at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213166_h(SourceFile:144) ~[?:?]
	at net.minecraft.util.concurrent.RecursiveEventLoop.func_213166_h(SourceFile:23) ~[?:?]
	at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213168_p(SourceFile:118) ~[?:?]
	at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213161_c(SourceFile:127) ~[?:?]
	at net.minecraft.client.Minecraft.func_238189_a_(Minecraft.java:1858) ~[?:?]
	... 39 more

Expected Behaviour
I expected to be able to do the same with Copper or Silver as with Iron or Gold, which is to only have a few fields in the json file that would replace or be added to the default implementation for the material.

Minimal setup needed to reproduce

  • Forge version: 1.16.4 35.1.4
  • Tetra version: 1.16.4-3.4.0 (same behaviour in 1.16.4-3.3.1)
  • Tetra configuration: I have no idea what this is.
  • Other mods:
    • mgui-1.16.4-3.1.3

Steps to reproduce
1- Install Forge, Tetra, mgui.
2- Create a basic datapack with a data/tetra/materials/metal/iron.json, with the following content:

{
    "improvements": {
        "arrested": 0
    }
}

3- Create a world.
4- Add the datapack to its datapack folder.
5- Use the /reload command
6- Make a diamond sword, put it in a tetra table, replace its blade with iron.
7- Open your inventory and press shift on the sword, its blade will be Arrested.
8- Copy/paste the iron.json file from above, and name the copy copper.json.
9- Use the /reload command. It will fail.

commented

It works. But non-vanilla material are in a subfolder called compat/ inside the materials/ folder. In order for it to work, the same folder structure needs to be respected in the datapack as well. Thus, copper.json or silver.json need to be within compat/ for it to load properly.