GregTechCEu Modern

GregTechCEu Modern

6M Downloads

Calling `.addOreByproducts` in kubejs crashes if given a material also defined in kubejs.

tomprince opened this issue ยท 2 comments

commented

Checked for existing issues

  • I have checked for existing issues, and have found none.

Tested latest version

  • I have checked that this occurs on the latest version.

GregTech CEu Version

1.6.1

Minecraft Version

1.20.1 Forge

Recipe Viewer Installed

EMI

Environment

Singleplayer

Cross-Mod Interaction

Yes

Other Installed Mods

Monifactory.

Expected Behavior

The material to be registered as an ore byproduct.

Actual Behavior

The game crahses.

Exception ``` [23:52:59] [Render thread/ERROR] [ne.mi.fm.DeferredWorkQueue/]: Mod 'gtceu' encountered an error in a deferred task: java.lang.NullPointerException: Cannot invoke "com.gregtechceu.gtceu.api.data.chemical.material.Material.getProperties()" because "m" is null at com.gregtechceu.gtceu.api.data.chemical.material.properties.OreProperty.lambda$verifyProperty$1(OreProperty.java:149) ~[gtceu-1.20.1-1.6.1.jar%23241!/:1.6.1] {re:classloading} at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?] {re:mixin} at com.gregtechceu.gtceu.api.data.chemical.material.properties.OreProperty.verifyProperty(OreProperty.java:149) ~[gtceu-1.20.1-1.6.1.jar%23241!/:1.6.1] {re:classloading} at com.gregtechceu.gtceu.api.data.chemical.material.properties.MaterialProperties.lambda$verify$0(MaterialProperties.java:72) ~[gtceu-1.20.1-1.6.1.jar%23241!/:1.6.1] {re:classloading} at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?] {re:mixin} at com.gregtechceu.gtceu.api.data.chemical.material.properties.MaterialProperties.verify(MaterialProperties.java:72) ~[gtceu-1.20.1-1.6.1.jar%23241!/:1.6.1] {re:classloading} at com.gregtechceu.gtceu.api.data.chemical.material.Material.verifyMaterial(Material.java:519) ~[gtceu-1.20.1-1.6.1.jar%23241!/:1.6.1] {re:classloading} at com.gregtechceu.gtceu.api.data.chemical.material.Material.(Material.java:132) ~[gtceu-1.20.1-1.6.1.jar%23241!/:1.6.1] {re:classloading} at com.gregtechceu.gtceu.api.data.chemical.material.Material$Builder.buildAndRegister(Material.java:1239) ~[gtceu-1.20.1-1.6.1.jar%23241!/:1.6.1] {re:classloading} at com.gregtechceu.gtceu.api.data.chemical.material.Material$Builder.register(Material.java:1248) ~[gtceu-1.20.1-1.6.1.jar%23241!/:1.6.1] {re:classloading} at com.gregtechceu.gtceu.api.data.chemical.material.Material$Builder.register(Material.java:528) ~[gtceu-1.20.1-1.6.1.jar%23241!/:1.6.1] {re:classloading} at com.gregtechceu.gtceu.integration.kjs.GTRegistryInfo.registerFor(GTRegistryInfo.java:177) ~[gtceu-1.20.1-1.6.1.jar%23241!/:1.6.1] {re:classloading} at com.gregtechceu.gtceu.common.CommonProxy$KJSEventWrapper.materialRegistry(CommonProxy.java:291) ~[gtceu-1.20.1-1.6.1.jar%23241!/:1.6.1] {re:classloading} at com.gregtechceu.gtceu.common.CommonProxy.initMaterials(CommonProxy.java:205) ~[gtceu-1.20.1-1.6.1.jar%23241!/:1.6.1] {re:classloading} at com.gregtechceu.gtceu.common.CommonProxy.init(CommonProxy.java:120) ~[gtceu-1.20.1-1.6.1.jar%23241!/:1.6.1] {re:classloading} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {} at net.minecraftforge.fml.DeferredWorkQueue.lambda$makeRunnable$2(DeferredWorkQueue.java:81) ~[fmlcore-1.20.1-47.3.7.jar%23356!/:?] {} at net.minecraftforge.fml.DeferredWorkQueue.makeRunnable(DeferredWorkQueue.java:76) ~[fmlcore-1.20.1-47.3.7.jar%23356!/:?] {} at net.minecraftforge.fml.DeferredWorkQueue.lambda$runTasks$0(DeferredWorkQueue.java:60) ~[fmlcore-1.20.1-47.3.7.jar%23356!/:?] {} at java.util.concurrent.ConcurrentLinkedDeque.forEach(ConcurrentLinkedDeque.java:1650) ~[?:?] {re:mixin} at net.minecraftforge.fml.DeferredWorkQueue.runTasks(DeferredWorkQueue.java:60) ~[fmlcore-1.20.1-47.3.7.jar%23356!/:?] {} at net.minecraftforge.fml.core.ParallelTransition.lambda$finalActivityGenerator$2(ParallelTransition.java:35) ~[forge-1.20.1-47.3.7-universal.jar%23360!/:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraftforge.fml.ModWorkManager$SyncExecutor.driveOne(ModWorkManager.java:43) ~[fmlcore-1.20.1-47.3.7.jar%23356!/:?] {} at net.minecraftforge.fml.ModWorkManager$DrivenExecutor.drive(ModWorkManager.java:28) ~[fmlcore-1.20.1-47.3.7.jar%23356!/:?] {} at net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:224) ~[fmlcore-1.20.1-47.3.7.jar%23356!/:?] {re:mixin} at net.minecraftforge.fml.ModLoader.lambda$dispatchAndHandleError$20(ModLoader.java:210) ~[fmlcore-1.20.1-47.3.7.jar%23356!/:?] {re:mixin} at java.util.Optional.ifPresent(Optional.java:178) ~[?:?] {re:mixin} at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:210) ~[fmlcore-1.20.1-47.3.7.jar%23356!/:?] {re:mixin} at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$13(ModLoader.java:183) ~[fmlcore-1.20.1-47.3.7.jar%23356!/:?] {re:mixin} at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] {re:mixin} at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:183) ~[fmlcore-1.20.1-47.3.7.jar%23356!/:?] {re:mixin} at net.minecraftforge.client.loading.ClientModLoader.lambda$begin$1(ClientModLoader.java:69) ~[forge-1.20.1-47.3.7-universal.jar%23360!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraftforge.client.loading.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:89) ~[forge-1.20.1-47.3.7-universal.jar%23360!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraftforge.client.loading.ClientModLoader.begin(ClientModLoader.java:69) ~[forge-1.20.1-47.3.7-universal.jar%23360!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.(Minecraft.java:459) ~[client-1.20.1-20230612.114412-srg.jar%23355!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:computing_frames,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:mixins.hammerlib.json:client.MinecraftMixin,pl:mixin:APP:neat.mixins.json:MinecraftMixin,pl:mixin:APP:modernfix-common.mixins.json:bugfix.world_leaks.MinecraftMixin,pl:mixin:APP:modernfix-common.mixins.json:bugfix.concurrency.MinecraftMixin,pl:mixin:APP:modernfix-common.mixins.json:perf.blast_search_trees.MinecraftMixin,pl:mixin:APP:modernfix-common.mixins.json:perf.dedicated_reload_executor.MinecraftMixin,pl:mixin:APP:modernfix-common.mixins.json:feature.measure_time.MinecraftMixin,pl:mixin:APP:modernfix-forge.mixins.json:feature.measure_time.MinecraftMixin_Forge,pl:mixin:APP:balm.mixins.json:MinecraftMixin,pl:mixin:APP:mixins.oculus.json:MixinMinecraft_PipelineManagement,pl:mixin:APP:drippyloadingscreen.mixins.json:client.IMixinMinecraft,pl:mixin:APP:mixins/common/nochatreports.mixins.json:client.MixinMinecraft,pl:mixin:APP:alltheleaks.mixins.json:main.MinecraftMixin,pl:mixin:APP:emi.mixins.json:MinecraftClientMixin,pl:mixin:APP:immediatelyfast-common.mixins.json:core.MixinMinecraftClient,pl:mixin:APP:notenoughcrashes.mixins.json:client.MixinMinecraftClient,pl:mixin:APP:embeddiumplus.mixin.json:fps.GpuUsageMixin,pl:mixin:APP:konkrete.mixin.json:MixinMinecraft,pl:mixin:APP:architectury.mixins.json:MixinMinecraft,pl:mixin:APP:kubejs-common.mixins.json:MinecraftClientMixin,pl:mixin:APP:ichunutil.mixins.json:client.MinecraftMixin,pl:mixin:APP:configuration.mixins.json:MinecraftMixin,pl:mixin:APP:ae2.mixins.json:PickColorMixin,pl:mixin:APP:iceberg.mixins.json:MinecraftMixin,pl:mixin:APP:quark.mixins.json:client.MinecraftMixin,pl:mixin:APP:fancymenu.mixins.json:client.IMixinMinecraft,pl:mixin:APP:fancymenu.mixins.json:client.MixinMinecraft,pl:mixin:APP:no-telemetry.mixins.json:MinecraftClientMixin,pl:mixin:APP:embeddium.mixins.json:core.render.MinecraftAccessor,pl:mixin:APP:embeddium.mixins.json:core.MinecraftClientMixin,pl:mixin:A,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:182) ~[minecraft-1.20.1-client.jar:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:APP:notenoughcrashes.forge.mixins.json:client.MixinMain,pl:mixin:APP:smoothboot.mixins.json:client.MainMixin,pl:mixin:A,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {re:mixin} at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:111) ~[fmlloader-1.20.1-47.3.7.jar:?] {} at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.clientService(CommonLaunchHandler.java:99) ~[fmlloader-1.20.1-47.3.7.jar:?] {} at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$makeService$0(CommonClientLaunchHandler.java:25) ~[fmlloader-1.20.1-47.3.7.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) ~[modlauncher-10.0.9.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) ~[modlauncher-10.0.9.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) ~[modlauncher-10.0.9.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:108) ~[modlauncher-10.0.9.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) ~[modlauncher-10.0.9.jar:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) ~[modlauncher-10.0.9.jar:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) ~[modlauncher-10.0.9.jar:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[bootstraplauncher-1.1.2.jar:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {re:mixin} at io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:67) ~[?:?] {} at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:105) ~[?:?] {} at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129) ~[?:?] {} at org.prismlauncher.EntryPoint.main(EntryPoint.java:70) ~[?:?] {} ```

Steps to Reproduce

Put this in kubejs/startup_scripts/test.js:

GTCEuStartupEvents.registry('gtceu:material', event => {
      event.create('naquadah_hydroxide')
          .dust()
          .color(0x1941a6).iconSet('dull')
          .components('naquadah', '3x hydrogen', '3x oxygen')
27
      event.create("snowchestite") // Hardmode only
          .dust().ore()
          .color(0x274c9f).iconSet('shiny')
          .flags(GTMaterialFlags.DISABLE_DECOMPOSITION)
          .components('3x naquadah_oxide', 'pyromorphite')
  
+         .addOreByproducts('chalcopyrite', 'vanadium_magnetite', 'naquadah_hydroxide')
  })

Additional Information

No response

commented

do it in a separate registration event.

commented

I also tried

GTCEuStartupEvents.registry('gtceu:material', event => {                                                                          
                                                                                                                           
    event.create('naquadah_hydroxide')                                                                           
        .dust()                                                                                             
        .color(0x1941a6).iconSet('dull')                                                                                                      
        .components('naquadah', '3x hydrogen', '3x oxygen')                                                                
                                                                                                                                                     
});                                                                                                                                                              
                                                                                                                                                           
GTCEuStartupEvents.registry('gtceu:material', event => {                                                    
    event.create("snowchestite") // Hardmode only                                                                                           
        .dust().ore()                                                                                                      
        .color(0x274c9f).iconSet('shiny')                                                                                                            
        .flags(GTMaterialFlags.DISABLE_DECOMPOSITION)                                                                                                            
        .components('3x naquadah_oxide', 'pyromorphite')                                                                                                              
        .addOreByproducts('chalcopyrite', 'vanadium_magnetite', 'naquadah_hydroxide')                       
                                                                                                                                                  
});  

and got a similar exception.