Jump to content

java.lang.NullPointerException: Can't use a null-name for the registry, object null.


Recommended Posts

Posted

I'm getting this error when starting minecraft with my mod on:

java.lang.NullPointerException: Can't use a null-name for the registry, object null.

Full log:

Spoiler

[17:18:14] [main/INFO] [GradleStart]: Extra: []
[17:18:14] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/matth/.gradle/caches/minecraft/assets, --assetIndex, 1.12, --accessToken{REDACTED}, --version, 1.12.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
[17:18:14] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[17:18:14] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[17:18:14] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
[17:18:14] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker
[17:18:14] [main/INFO] [FML]: Forge Mod Loader version 14.23.5.2824 for Minecraft 1.12.2 loading
[17:18:14] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_201, running on Windows 10:amd64:10.0, installed at C:\Program Files\Java\jre1.8.0_201
[17:18:14] [main/ERROR] [FML]: Apache Maven library folder was not in the format expected. Using default libraries directory.
[17:18:14] [main/ERROR] [FML]: Full: C:\Users\matth\.gradle\caches\modules-2\files-2.1\org.apache.maven\maven-artifact\3.5.3\7dc72b6d6d8a6dced3d294ed54c2cc3515ade9f4\maven-artifact-3.5.3.jar
[17:18:14] [main/ERROR] [FML]: Trimmed: c:/users/matth/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/3.5.3/
[17:18:14] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[17:18:14] [main/INFO] [FML]: Detected deobfuscated environment, loading log configs for colored console logs.
2019-04-08 17:18:16,452 main WARN Disabling terminal, you're running in an unsupported environment.
[17:18:16] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLCorePlugin (net.minecraftforge.fml.relauncher.FMLCorePlugin), we are in deobf and it's a forge core plugin
[17:18:16] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLForgePlugin (net.minecraftforge.classloading.FMLForgePlugin), we are in deobf and it's a forge core plugin
[17:18:16] [main/INFO] [FML]: Searching C:\Users\matth\OneDrive\Desktop\UsefulEmeralds\run\.\mods for mods
[17:18:16] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
[17:18:16] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin
[17:18:16] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
[17:18:16] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[17:18:16] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[17:18:16] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[17:18:16] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[17:18:16] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[17:18:16] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[17:18:19] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[17:18:19] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[17:18:19] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[17:18:19] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[17:18:19] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[17:18:19] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[17:18:19] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
[17:18:20] [Client thread/INFO] [minecraft/Minecraft]: Setting user: Player322
[17:18:26] [Client thread/INFO] [minecraft/Minecraft]: LWJGL Version: 2.9.4
[17:18:27] [Client thread/INFO] [FML]: -- System Details --
Details:
    Minecraft Version: 1.12.2
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_201, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 335979448 bytes (320 MB) / 434634752 bytes (414 MB) up to 1623719936 bytes (1548 MB)
    JVM Flags: 0 total; 
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: 
    Loaded coremods (and transformers): 
    GL info: ' Vendor: 'Intel' Version: '4.0.0 - Build 10.18.10.4252' Renderer: 'Intel(R) HD Graphics 4000'
[17:18:27] [Client thread/INFO] [FML]: MinecraftForge v14.23.5.2824 Initialized
[17:18:27] [Client thread/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients.
[17:18:27] [Client thread/INFO] [FML]: Replaced 1036 ore ingredients
[17:18:28] [Client thread/INFO] [FML]: Searching C:\Users\matth\OneDrive\Desktop\UsefulEmeralds\run\.\mods for mods
[17:18:29] [Thread-3/INFO] [FML]: Using sync timing. 200 frames of Display.update took 169739500 nanos
[17:18:30] [Client thread/INFO] [FML]: Forge Mod Loader has identified 5 mods to load
[17:18:30] [Client thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, ue] at CLIENT
[17:18:30] [Client thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, ue] at SERVER
[17:18:31] [Client thread/INFO] [minecraft/SimpleReloadableResourceManager]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Useful Emeralds
[17:18:31] [Client thread/INFO] [FML]: Processing ObjectHolder annotations
[17:18:31] [Client thread/INFO] [FML]: Found 1168 ObjectHolder annotations
[17:18:31] [Client thread/INFO] [FML]: Identifying ItemStackHolder annotations
[17:18:31] [Client thread/INFO] [FML]: Found 0 ItemStackHolder annotations
[17:18:31] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[17:18:31] [Client thread/INFO] [STDOUT]: [com.matthyfamily.UsefulEmeralds:preInit:17]: ue:preInit
[17:18:31] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[17:18:31] [Client thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.RegistryEvent$Register@20a1c8a1:
java.lang.NullPointerException: Can't use a null-name for the registry, object null.
    at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:864) ~[guava-21.0.jar:?]
    at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:294) ~[ForgeRegistry.class:?]
    at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:288) ~[ForgeRegistry.class:?]
    at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:120) ~[ForgeRegistry.class:?]
    at net.minecraftforge.registries.ForgeRegistry.registerAll(ForgeRegistry.java:161) ~[ForgeRegistry.class:?]
    at com.matthyfamily.init.ModBlocks.registerBlocks(ModBlocks.java:30) ~[ModBlocks.class:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_4_ModBlocks_registerBlocks_Register.invoke(.dynamic) ~[?:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:144) ~[EventBus$1.class:?]
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) [EventBus.class:?]
    at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:807) [GameData.class:?]
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:628) [Loader.class:?]
    at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:252) [FMLClientHandler.class:?]
    at net.minecraft.client.Minecraft.init(Minecraft.java:514) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:422) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    at GradleStart.main(GradleStart.java:25) [start/:?]
[17:18:31] [Client thread/ERROR] [FML]: Index: 2 Listeners:
[17:18:31] [Client thread/ERROR] [FML]: 0: NORMAL
[17:18:31] [Client thread/ERROR] [FML]: 1: net.minecraftforge.fml.common.eventhandler.EventBus$1@ffa60c9
[17:18:31] [Client thread/ERROR] [FML]: 2: net.minecraftforge.fml.common.eventhandler.EventBus$1@646ba7be
[17:18:31] [Client thread/ERROR] [FML]: 3: net.minecraftforge.fml.common.eventhandler.EventBus$1@41194707
[17:18:31] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:629]: ---- Minecraft Crash Report ----
// There are four lights!

Time: 4/8/19 5:18 PM
Description: Initializing game

java.lang.NullPointerException: Can't use a null-name for the registry, object null.
    at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:864)
    at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:294)
    at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:288)
    at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:120)
    at net.minecraftforge.registries.ForgeRegistry.registerAll(ForgeRegistry.java:161)
    at com.matthyfamily.init.ModBlocks.registerBlocks(ModBlocks.java:30)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_4_ModBlocks_registerBlocks_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:807)
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:628)
    at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:252)
    at net.minecraft.client.Minecraft.init(Minecraft.java:514)
    at net.minecraft.client.Minecraft.run(Minecraft.java:422)
    at net.minecraft.client.main.Main.main(Main.java:118)
    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)
    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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:25)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Client thread
Stacktrace:
    at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:864)
    at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:294)
    at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:288)
    at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:120)
    at net.minecraftforge.registries.ForgeRegistry.registerAll(ForgeRegistry.java:161)
    at com.matthyfamily.init.ModBlocks.registerBlocks(ModBlocks.java:30)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_4_ModBlocks_registerBlocks_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:807)
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:628)
    at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:252)
    at net.minecraft.client.Minecraft.init(Minecraft.java:514)

-- Initialization --
Details:
Stacktrace:
    at net.minecraft.client.Minecraft.run(Minecraft.java:422)
    at net.minecraft.client.main.Main.main(Main.java:118)
    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)
    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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:25)

-- System Details --
Details:
    Minecraft Version: 1.12.2
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_201, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 227615832 bytes (217 MB) / 465567744 bytes (444 MB) up to 1623719936 bytes (1548 MB)
    JVM Flags: 0 total; 
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP 9.42 Powered by Forge 14.23.5.2824 5 mods loaded, 5 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

    | State | ID        | Version      | Source                           | Signature |
    |:----- |:--------- |:------------ |:-------------------------------- |:--------- |
    | LCH   | minecraft | 1.12.2       | minecraft.jar                    | None      |
    | LCH   | mcp       | 9.42         | minecraft.jar                    | None      |
    | LCH   | FML       | 8.0.99.99    | forgeSrc-1.12.2-14.23.5.2824.jar | None      |
    | LCH   | forge     | 14.23.5.2824 | forgeSrc-1.12.2-14.23.5.2824.jar | None      |
    | LCH   | ue        | 1.0          | bin                              | None      |

    Loaded coremods (and transformers): 
    GL info: ' Vendor: 'Intel' Version: '4.0.0 - Build 10.18.10.4252' Renderer: 'Intel(R) HD Graphics 4000'
    Launched Version: 1.12.2
    LWJGL: 2.9.4
    OpenGL: Intel(R) HD Graphics 4000 GL version 4.0.0 - Build 10.18.10.4252, Intel
    GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

    Using VBOs: Yes
    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Packs: 
    Current Language: English (US)
    Profiler Position: N/A (disabled)
    CPU: 4x Intel(R) Core(TM) i5-3360M CPU @ 2.80GHz
[17:18:31] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:629]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\matth\OneDrive\Desktop\UsefulEmeralds\run\.\crash-reports\crash-2019-04-08_17.18.31-client.txt
 

https://github.com/MatthyPlayz/usefulemeralds/ is my repo

i have no idea what to put here, so i'll just say you can edit your signature at https://www.minecraftforge.net/forum/settings/signature/

Posted

us is a terrible modid, you have 64 characters available to you, don't use just two since it could lead to name collision.

 

How did you upload your repository and why did you delete the .gitignore file? Your repository contains a ton of not needed stuff like the run directory.

 

I doubt you own matthyfamily.com. Use a different package name.

 

BlockBasic(or BlockBase really) is an antipattern. Do not abuse inheritance. Especially if thay may harm your project later.

 

Don't use static initializers. Instantinate your stuff in the appropriate registry event. This is the cause of your error.

Well, technically the cause of your issue is the fact that you never call the init method, but if you were doing things the conventional way you wouldn't need this method anyway.

Posted
1 hour ago, matthyplayz said:

1. Good idea

2. It isnt in my folder for some reason

3. I do.

4. Okay

5. What would the event be?

6. okay thanks

If you want to make a block, just make a class extending block, set the registryname and unlocalizedname in there.

Then make a class for registering them.

add @EventBusSubscriber over the line saying class (classname)

Then add this method:

@SubscribeEvent
public static void onBlockRegister(RegistryEvent.Register<Block> event) {
    event.getRegistry().registerAll(new YourBlock(), new YourOtherBlock());
}

Then add this too to register the itemblocks (items you hold):

@SubscribeEvent
public static void onItemRegister(RegistryEvent.Register<Item> event) {
	for (Block block : ForgeRegistries.BLOCKS.getValues()) {
    	if (block.getRegistryName().getResourceDomain().equals(MOD_ID)) {
      		event.getRegistry().register(new ItemBlock(block).setRegistryName(block.getRegistryName());
    }
}

 

If you want to get them just do /give @p modid:blockname.

(Substitute MOD_ID and modid with your modid, blockname with the block name)

Posted
2 hours ago, diesieben07 said:

I mean, it's great that you're trying to help and all, but... just copy-pasting what I tell other people to do is not really helpful unless you understand what's even going on.

In this case it works, yes. But please, if you want to help people help them using your knowledge.

I understand what is going on, you iterate through all registered blocks, check if the modid is equal to yours, and if so create a new itemblock using it and set the registry name. I saw the code from another response of your and started using it cause it's a good idea (might be slow with a lot of mods though). Also, didn't check and see that there was an updated version of getValues() and that it was only there for legacy support.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.