Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Alterations to expected functionality of KubeJS #19

Open
gigawhip opened this issue Mar 7, 2023 · 1 comment
Open

Bug: Alterations to expected functionality of KubeJS #19

gigawhip opened this issue Mar 7, 2023 · 1 comment

Comments

@gigawhip
Copy link

gigawhip commented Mar 7, 2023

Steps to Reproduce

MC 1.19.2, Forge 43.2.0, most recent Create, KubeJS, and Create Mechanical Extruder

Add the following script:

// kubejs/server_scripts/foo.js

ServerEvents.recipes((event) => {
  event.remove({ input: "foo:bar" });
});

If Create Mechanical Extruder is not installed, this will do nothing if "foo:bar" is not a known input of any recipe. With Create Mechanical Extruder installed in the same circumstance, this will instead fail loudly, throwing the following errors.

Upon entering a world, Kube says in Minecraft chat: KubeJS errors found [2]! Run '/kubejs errors' for more info

Kube's server.log shows:

show/hide log
! [20:39:53] [ERR] #4: Error occurred while handling event 'ServerEvents.recipes': java.lang.NullPointerException: Cannot invoke "net.minecraft.world.item.ItemStack.m_41619_()" because "item" is null
[20:39:53] [ERR  ] java.lang.NullPointerException: Cannot invoke "net.minecraft.world.item.ItemStack.m_41619_()" because "item" is null
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.kubejs.recipe.IngredientMatch.contains(IngredientMatch.java:42)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/com.oierbravo.createmechanicalextruder.compat.kubejs.ExtrudingRecipeJS.hasInput(ExtrudingRecipeJS.java:103)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.kubejs.recipe.RecipeJS.kjs$hasInput(RecipeJS.java:136)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.kubejs.recipe.filter.InputFilter.test(InputFilter.java:18)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.kubejs.recipe.filter.InputFilter.test(InputFilter.java:9)
[20:39:53] [ERR  ] 	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
[20:39:53] [ERR  ] 	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
[20:39:53] [ERR  ] 	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
[20:39:53] [ERR  ] 	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
[20:39:53] [ERR  ] 	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
[20:39:53] [ERR  ] 	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
[20:39:53] [ERR  ] 	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[20:39:53] [ERR  ] 	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.kubejs.recipe.RecipesEventJS.forEachRecipe(RecipesEventJS.java:410)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.kubejs.recipe.RecipesEventJS.forEachRecipeAsync(RecipesEventJS.java:415)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.kubejs.recipe.RecipesEventJS.remove(RecipesEventJS.java:448)
[20:39:53] [ERR  ] 	at jdk.internal.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
[20:39:53] [ERR  ] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[20:39:53] [ERR  ] 	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.rhino.MemberBox.invoke(MemberBox.java:160)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.rhino.NativeJavaMethod.call(NativeJavaMethod.java:463)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.rhino.Interpreter.interpretLoop(Interpreter.java:1086)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.rhino.Interpreter.interpret(Interpreter.java:423)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.rhino.InterpretedFunction.call(InterpretedFunction.java:72)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.rhino.Context.doTopCall(Context.java:1197)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.rhino.ScriptRuntime.doTopCall(ScriptRuntime.java:2619)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.rhino.InterpretedFunction.call(InterpretedFunction.java:70)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.rhino.ArrowFunction.call(ArrowFunction.java:42)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.rhino.InterfaceAdapter.invokeImpl(InterfaceAdapter.java:129)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.rhino.InterfaceAdapter.invoke(InterfaceAdapter.java:88)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.rhino.VMBridge.lambda$newInterfaceProxy$0(VMBridge.java:70)
[20:39:53] [ERR  ] 	at TRANSFORMER/jdk.proxy3/jdk.proxy3.$Proxy88.onEvent(Unknown Source)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.kubejs.event.EventHandlerContainer.handle(EventHandlerContainer.java:33)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.kubejs.event.EventHandler.postToHandlers(EventHandler.java:206)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.kubejs.event.EventHandler.post(EventHandler.java:191)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.kubejs.event.EventHandler.post(EventHandler.java:158)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.kubejs.event.EventHandler.post(EventHandler.java:151)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/dev.latvian.mods.kubejs.recipe.RecipesEventJS.post(RecipesEventJS.java:262)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.world.item.crafting.RecipeManager.handler$zbg000$customRecipesHead(RecipeManager.java:2527)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.world.item.crafting.RecipeManager.m_5787_(RecipeManager.java)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.world.item.crafting.RecipeManager.m_5787_(RecipeManager.java:34)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.server.packs.resources.SimplePreparableReloadListener.m_10789_(SimplePreparableReloadListener.java:13)
[20:39:53] [ERR  ] 	at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718)
[20:39:53] [ERR  ] 	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.server.packs.resources.SimpleReloadInstance.m_143940_(SimpleReloadInstance.java:69)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.util.thread.BlockableEventLoop.m_6367_(BlockableEventLoop.java:157)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.util.thread.ReentrantBlockableEventLoop.m_6367_(ReentrantBlockableEventLoop.java:23)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.util.thread.BlockableEventLoop.m_7245_(BlockableEventLoop.java:131)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.util.thread.BlockableEventLoop.m_18701_(BlockableEventLoop.java:140)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.worldselection.WorldOpenFlows.m_233096_(WorldOpenFlows.java:130)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.worldselection.WorldOpenFlows.m_233122_(WorldOpenFlows.java:109)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.worldselection.WorldOpenFlows.doLoadLevel(WorldOpenFlows.java:148)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.worldselection.WorldOpenFlows.m_233145_(WorldOpenFlows.java:136)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.worldselection.WorldOpenFlows.m_233133_(WorldOpenFlows.java:58)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.worldselection.WorldSelectionList$WorldListEntry.m_101744_(WorldSelectionList.java:586)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.worldselection.WorldSelectionList$WorldListEntry.m_101704_(WorldSelectionList.java:448)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.worldselection.WorldSelectionList$WorldListEntry.m_6375_(WorldSelectionList.java:378)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.gui.components.AbstractSelectionList.m_6375_(AbstractSelectionList.java:336)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.gui.components.events.ContainerEventHandler.m_6375_(ContainerEventHandler.java:27)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.MouseHandler.m_168084_(MouseHandler.java:88)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.Screen.m_96579_(Screen.java:522)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.MouseHandler.m_91530_(MouseHandler.java:85)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.MouseHandler.m_168091_(MouseHandler.java:185)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:103)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.MouseHandler.m_91565_(MouseHandler.java:184)
[20:39:53] [ERR  ] 	at MC-BOOTSTRAP/[email protected]+7/org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:43)
[20:39:53] [ERR  ] 	at MC-BOOTSTRAP/[email protected]+7/org.lwjgl.system.JNI.invokeV(Native Method)
[20:39:53] [ERR  ] 	at MC-BOOTSTRAP/[email protected]+7/org.lwjgl.glfw.GLFW.glfwWaitEventsTimeout(GLFW.java:3474)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/com.mojang.blaze3d.systems.RenderSystem.m_69830_(RenderSystem.java:222)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1146)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.Minecraft.m_91374_(Minecraft.java:700)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.main.Main.m_239872_(Main.java:212)
[20:39:53] [ERR  ] 	at TRANSFORMER/[email protected]/net.minecraft.client.main.Main.main(Main.java:51)
[20:39:53] [ERR  ] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[20:39:53] [ERR  ] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[20:39:53] [ERR  ] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[20:39:53] [ERR  ] 	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[20:39:53] [ERR  ] 	at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:27)
[20:39:53] [ERR  ] 	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30)
[20:39:53] [ERR  ] 	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53)
[20:39:53] [ERR  ] 	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71)
[20:39:53] [ERR  ] 	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:106)
[20:39:53] [ERR  ] 	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:77)
[20:39:53] [ERR  ] 	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26)
[20:39:53] [ERR  ] 	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23)
[20:39:53] [ERR  ] 	at [email protected]/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141)

Impact

When removing an item from a modpack via KubeJS, it is convenient to remove the recipes associated with the item, so that even if it was obtained nothing could be done with it. I encountered this issue with the mod Paragliders trying to remove recipes associated with the ID "paragliders:deku_leaf". This item has a cosmetic/dummy recipe - one which isn't implemented directly but shows up in JEI/REI for discoverability, because the actual recipe uses NBT data. (This pattern is not uncommon, for example you can find it in Map Atlases as well.) Using the script syntax shown above, you are able to delete this cosmetic/dummy recipe, even though no "real" recipe contains the ID, but with Create Mechanical Extruder this otherwise legitimate causes an error seemingly in an effort to be helpful.

This is very low impact except that the error does not help you determine which line of the script is triggering the problematic interaction. It took me 2 hours to track this all down because of this. For now I can comment out these types of lines in my scripts, and hopefully this issue helps someone else before a fix drops. Cheers!

@enigmaquip
Copy link

@oierbravo This is due to this line in hasInput https://github.com/oierbravo/create-mechanical-extruder/blob/mc1.19/dev/src/main/java/com/oierbravo/createmechanicalextruder/compat/kubejs/ExtrudingRecipeJS.java#L103
There's no sanity check for catalyst to not be null, it's not being initialized during declaration and when a recipe is deserialized it's only touching catalyst if there is one in the recipe
https://github.com/oierbravo/create-mechanical-extruder/blob/mc1.19/dev/src/main/java/com/oierbravo/createmechanicalextruder/compat/kubejs/ExtrudingRecipeJS.java#L66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants