• Posts

    • I changed the code and it finally worked! Thank you for the fast response:>
    • Your registerBlocks method is never called, because it is static and it's containing class (TomasusToolkitmain) is not registered to the event bus. Therefor BlockList.lapiz_gem_block is null when TomasusToolkitmain.RegistryEvents.registerItems is called.
    • Hello! I'm very new to Minecraft modding and recently, I've encountered a problem regarding the load_registries event. I have checked other threads about the same issue but none of the solutions presented worked for me. Can you take a look on what's wrong? Thank you very much!   main java file package tomasukun.tomasustoolkit; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.ToolType; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import tomasukun.tomasustoolkit.lists.BlockList; import tomasukun.tomasustoolkit.lists.ItemList; @Mod("tomasukit") public class TomasusToolkitmain { public static TomasusToolkitmain instance; public static final String modid = "tomasukit"; private static final Logger logger = LogManager.getLogger(modid); public TomasusToolkitmain() { instance = this; FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries); MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { logger.info("Setup method registered successfully."); } private void clientRegistries(final FMLClientSetupEvent event) { logger.info("ClientRegistries method registered successfully."); } @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents{ @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll( ItemList.lapiz_gem = new Item(new Item.Properties().group(ItemGroup.MATERIALS)).setRegistryName(location("lapiz_gem")), ItemList.lapiz_gem_block = new BlockItem(BlockList.lapiz_gem_block, new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)).setRegistryName(BlockList.lapiz_gem_block.getRegistryName()) ); logger.info("Items registered."); } } @SubscribeEvent public static void registerBlocks(final RegistryEvent.Register<Block> event) { event.getRegistry().registerAll( BlockList.lapiz_gem_block = new Block(Block.Properties.create(Material.IRON).hardnessAndResistance(5F).harvestLevel(2).sound(SoundType.METAL).harvestTool(ToolType.PICKAXE)).setRegistryName(location("lapiz_gem_block")) ); logger.info("Blocks registered."); } public static ResourceLocation location(String name) { return new ResourceLocation(modid, name); } }   latest.log [11Dec2019 16:53:32.310] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmluserdevclient, --fml.mcpVersion, 20190829.143755, --fml.mcVersion, 1.14.4, --fml.forgeGroup, net.minecraftforge, --fml.forgeVersion, 28.1.104, --version, MOD_DEV, --assetIndex, 1.14, --assetsDir, C:\Users\tom\.gradle\caches\forge_gradle\assets, --username, Dev, --accessToken, ????????, --userProperties, {}] [11Dec2019 16:53:32.320] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 4.1.0+62+5bfa59b starting: java version 1.8.0_232 by AdoptOpenJDK [11Dec2019 16:53:33.315] [main/INFO] [net.minecraftforge.fml.loading.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust [11Dec2019 16:53:36.277] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'fmluserdevclient' with arguments [--version, MOD_DEV, --gameDir, ., --assetsDir, C:\Users\tom\.gradle\caches\forge_gradle\assets, --assetIndex, 1.14, --username, Dev, --accessToken, ????????, --userProperties, {}] [11Dec2019 16:53:57.008] [Client thread/INFO] [net.minecraft.client.Minecraft/]: Setting user: Dev [11Dec2019 16:54:25.334] [Client thread/WARN] [net.minecraft.client.GameSettings/]: Skipping bad option: lastServer: [11Dec2019 16:54:25.531] [Client thread/INFO] [net.minecraft.client.Minecraft/]: LWJGL Version: 3.2.2 build 10 [11Dec2019 16:54:35.283] [modloading-worker-1/INFO] [net.minecraftforge.common.ForgeMod/FORGEMOD]: Forge mod loading, version 28.1.104, for MC 1.14.4 with MCP 20190829.143755 [11Dec2019 16:54:35.283] [modloading-worker-1/INFO] [net.minecraftforge.common.MinecraftForge/FORGE]: MinecraftForge v28.1.104 Initialized [11Dec2019 16:54:36.880] [Client thread/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/]: Exception caught during firing event: null Index: 1 Listeners: 0: NORMAL 1: ASM: class tomasukun.tomasustoolkit.TomasusToolkitmain$RegistryEvents registerItems(Lnet/minecraftforge/event/RegistryEvent$Register;)V java.lang.NullPointerException at tomasukun.tomasustoolkit.TomasusToolkitmain$RegistryEvents.registerItems(TomasusToolkitmain.java:55) at net.minecraftforge.eventbus.ASMEventHandler_0_RegistryEvents_registerItems_Register.invoke(.dynamic) at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80) at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:106) at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65) at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65) at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112) at net.minecraftforge.fml.ModList.lambda$dispatchSynchronousEvent$5(ModList.java:125) at java.util.ArrayList.forEach(ArrayList.java:1257) at net.minecraftforge.fml.ModList.dispatchSynchronousEvent(ModList.java:125) at net.minecraftforge.fml.ModList.lambda$static$1(ModList.java:96) at net.minecraftforge.fml.LifecycleEventProvider.dispatch(LifecycleEventProvider.java:71) at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:197) at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$24(ModLoader.java:189) at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:969) at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:189) at net.minecraftforge.fml.client.ClientModLoader.lambda$begin$2(ClientModLoader.java:97) at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:113) at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:97) at net.minecraft.client.Minecraft.init(Minecraft.java:457) at net.minecraft.client.Minecraft.run(Minecraft.java:365) at net.minecraft.client.main.Main.main(Main.java:128) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101) [11Dec2019 16:54:37.070] [Client thread/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/LOADING]: Caught exception during event RegistryEvent.Register<minecraft:item> dispatch for modid tomasukit java.lang.NullPointerException: null at tomasukun.tomasustoolkit.TomasusToolkitmain$RegistryEvents.registerItems(TomasusToolkitmain.java:55) ~[main/:?] at net.minecraftforge.eventbus.ASMEventHandler_0_RegistryEvents_registerItems_Register.invoke(.dynamic) ~[?:?] at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80) ~[eventbus-1.0.0-service.jar:?] at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-1.0.0-service.jar:?] at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:106) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:28.1] at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65) ~[?:1.8.0_232] at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65) ~[?:1.8.0_232] at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraftforge.fml.ModList.lambda$dispatchSynchronousEvent$5(ModList.java:125) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at java.util.ArrayList.forEach(ArrayList.java:1257) ~[?:1.8.0_232] at net.minecraftforge.fml.ModList.dispatchSynchronousEvent(ModList.java:125) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraftforge.fml.ModList.lambda$static$1(ModList.java:96) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraftforge.fml.LifecycleEventProvider.dispatch(LifecycleEventProvider.java:71) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:197) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$24(ModLoader.java:189) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:969) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:189) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraftforge.fml.client.ClientModLoader.lambda$begin$2(ClientModLoader.java:97) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:113) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:97) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraft.client.Minecraft.init(Minecraft.java:457) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraft.client.Minecraft.run(Minecraft.java:365) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraft.client.main.Main.main(Main.java:128) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_232] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_232] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_232] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_232] at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-4.1.0.jar:?] at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-4.1.0.jar:?] at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-4.1.0.jar:?] at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-4.1.0.jar:?] at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-4.1.0.jar:?] at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101) [forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] [11Dec2019 16:54:37.299] [Client thread/FATAL] [net.minecraftforge.fml.ModLoader/LOADING]: Failed to complete lifecycle event LOAD_REGISTRIES, 1 errors found [11Dec2019 16:54:37.299] [Client thread/FATAL] [net.minecraftforge.eventbus.EventBus/EVENTBUS]: EventBus 0 shutting down - future events will not be posted. java.lang.Exception: stacktrace at net.minecraftforge.eventbus.EventBus.shutdown(EventBus.java:278) ~[eventbus-1.0.0-service.jar:?] at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:115) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:97) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraft.client.Minecraft.init(Minecraft.java:457) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraft.client.Minecraft.run(Minecraft.java:365) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at net.minecraft.client.main.Main.main(Main.java:128) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_232] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_232] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_232] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_232] at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-4.1.0.jar:?] at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-4.1.0.jar:?] at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-4.1.0.jar:?] at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-4.1.0.jar:?] at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-4.1.0.jar:?] at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101) [forge-1.14.4-28.1.104_mapped_snapshot_20190719-1.14.3-recomp.jar:?] [11Dec2019 16:54:46.055] [Client thread/INFO] [com.mojang.text2speech.NarratorWindows/]: Narrator library for x64 successfully loaded [11Dec2019 16:54:47.735] [Server-Worker-3/ERROR] [net.minecraftforge.fml.ModLoader/LOADING]: Skipping lifecycle event SETUP, 1 errors found. [11Dec2019 16:54:47.735] [Server-Worker-3/FATAL] [net.minecraftforge.fml.ModLoader/LOADING]: Failed to complete lifecycle event SETUP, 1 errors found [11Dec2019 16:54:47.736] [Server-Worker-3/FATAL] [net.minecraftforge.eventbus.EventBus/EVENTBUS]: EventBus 0 shutting down - future events will not be posted. java.lang.Exception: stacktrace at net.minecraftforge.eventbus.EventBus.shutdown(EventBus.java:278) ~[eventbus-1.0.0-service.jar:?] at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:115) ~[?:?] at net.minecraftforge.fml.client.ClientModLoader.startModLoading(ClientModLoader.java:123) ~[?:?] at net.minecraftforge.fml.client.ClientModLoader.lambda$onreload$3(ClientModLoader.java:105) ~[?:?] at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:113) ~[?:?] at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1640) [?:1.8.0_232] at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1632) [?:1.8.0_232] at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) [?:1.8.0_232] at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) [?:1.8.0_232] at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) [?:1.8.0_232] at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) [?:1.8.0_232] [11Dec2019 16:54:47.737] [Thread-1/FATAL] [net.minecraftforge.common.ForgeConfig/CORE]: Forge config just got changed on the file system! [11Dec2019 16:55:06.361] [Server-Worker-2/ERROR] [net.minecraftforge.fml.ModLoader/LOADING]: Skipping lifecycle event ENQUEUE_IMC, 1 errors found. [11Dec2019 16:55:06.416] [Server-Worker-2/FATAL] [net.minecraftforge.fml.ModLoader/LOADING]: Failed to complete lifecycle event ENQUEUE_IMC, 1 errors found [11Dec2019 16:55:06.416] [Server-Worker-2/FATAL] [net.minecraftforge.eventbus.EventBus/EVENTBUS]: EventBus 0 shutting down - future events will not be posted. java.lang.Exception: stacktrace at net.minecraftforge.eventbus.EventBus.shutdown(EventBus.java:278) ~[eventbus-1.0.0-service.jar:?] at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:115) ~[?:?] at net.minecraftforge.fml.client.ClientModLoader.finishModLoading(ClientModLoader.java:136) ~[?:?] at net.minecraftforge.fml.client.ClientModLoader.lambda$onreload$4(ClientModLoader.java:107) ~[?:?] at java.util.concurrent.CompletableFuture.uniRun(CompletableFuture.java:719) [?:1.8.0_232] at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:701) [?:1.8.0_232] at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:457) [?:1.8.0_232] at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) [?:1.8.0_232] at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) [?:1.8.0_232] at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) [?:1.8.0_232] at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) [?:1.8.0_232] [11Dec2019 16:55:06.479] [Client thread/WARN] [net.minecraft.client.GameSettings/]: Skipping bad option: lastServer: [11Dec2019 16:55:14.938] [Client thread/INFO] [net.minecraft.client.audio.SoundSystem/]: OpenAL initialized. [11Dec2019 16:55:14.955] [Client thread/INFO] [net.minecraft.client.audio.SoundEngine/SOUNDS]: Sound engine started [11Dec2019 16:55:15.422] [Client thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 512x512 textures-atlas [11Dec2019 16:55:17.932] [Client thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 256x256 textures/particle-atlas [11Dec2019 16:55:17.938] [Client thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 256x256 textures/painting-atlas [11Dec2019 16:55:17.940] [Client thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 128x128 textures/mob_effect-atlas  
    • While you can do that, there is a much simpler way to just get the block position "below": BlockPos#down(). There are many more helper methods like this on the BlockPos class which make your code more understandable.
    • IWorld#getMoonPhase is, yes. You have to replace it with IWorld#getDimension.getMoonPhase(IWorld#getWorldInfo().getDayTime()).   @GatoLeyo Please elaborate on what you want to achieve.
  • Topics

  • Who's Online (See full list)