Jump to content

Why i can't compile and run my mod?


TunaFish2K

Recommended Posts

It display :

 

---- Minecraft Crash Report ----
// I bet Cylons wouldn't have this problem.

Time: 6/12/21 6:24 PM
Description: Initializing game

java.lang.NullPointerException: Can't use a null-name for the registry, object space.tunafish2k.utech.item.ItemUPiece@19f811a2.
    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 space.tunafish2k.utech.item.ItemRegisterHandler.onRegistery(ItemRegisterHandler.java:15)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_4_ItemRegisterHandler_onRegistery_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:852)
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:630)
    at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:252)
    at net.minecraft.client.Minecraft.init(Minecraft.java:467)
    at net.minecraft.client.Minecraft.run(Minecraft.java:378)
    at net.minecraft.client.main.Main.main(Main.java:118)
    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.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(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraftforge.legacydev.Main.start(Main.java:86)
    at net.minecraftforge.legacydev.MainClient.main(MainClient.java:29)


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 space.tunafish2k.utech.item.ItemRegisterHandler.onRegistery(ItemRegisterHandler.java:15)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_4_ItemRegisterHandler_onRegistery_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:852)
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:630)
    at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:252)
    at net.minecraft.client.Minecraft.init(Minecraft.java:467)

-- Initialization --
Details:
Stacktrace:
    at net.minecraft.client.Minecraft.run(Minecraft.java:378)
    at net.minecraft.client.main.Main.main(Main.java:118)
    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.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(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraftforge.legacydev.Main.start(Main.java:86)
    at net.minecraftforge.legacydev.MainClient.main(MainClient.java:29)

-- System Details --
Details:
    Minecraft Version: 1.12.2
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_291, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 287538248 bytes (274 MB) / 974651392 bytes (929 MB) up to 3787980800 bytes (3612 MB)
    JVM Flags: 0 total; 
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP 9.42 Powered by Forge 14.23.5.2855 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    | forge-1.12.2-14.23.5.2855_mapped_snapshot_20171003-1.12-recomp.jar | None      |
    | LCH   | forge     | 14.23.5.2855 | forge-1.12.2-14.23.5.2855_mapped_snapshot_20171003-1.12-recomp.jar | None      |
    | LCH   | u_tech    | 1.0          | main                                                               | None      |

    Loaded coremods (and transformers): 
    GL info: ' Vendor: 'Intel' Version: '4.6.0 - Build 27.20.100.8729' Renderer: 'Intel(R) UHD Graphics'
    Launched Version: ${MC_VERSION}
    LWJGL: 2.9.4
    OpenGL: Intel(R) UHD Graphics GL version 4.6.0 - Build 27.20.100.8729, 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: 简体中文 (中国)
    Profiler Position: N/A (disabled)
    CPU: 16x Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz

 

Here are my codes:

 

ItemUPiece.java:

package space.tunafish2k.utech.item;

import net.minecraft.item.Item;

import space.tunafish2k.utech.UTech;

public class ItemUPiece extends Item

{

    public void ItemUpiece()

    {

        this.setUnlocalizedName(UTech.MODID + ".u_piece");

        this.setRegistryName("u_tech","u_piece");

        this.setMaxStackSize(64);

    }

}

 

ItemRegiserHandler:

package space.tunafish2k.utech.item;

import net.minecraft.item.Item;

import net.minecraftforge.event.RegistryEvent;

import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import net.minecraftforge.registries.IForgeRegistry;

@Mod.EventBusSubscriber

public class ItemRegisterHandler

{

    public static final ItemUPiece U_PIECE = new ItemUPiece();

    @SubscribeEvent

    public static void onRegistery(RegistryEvent.Register<Item> event)

    {

        IForgeRegistry<Item> registry = event.getRegistry();

        registry.register(U_PIECE);

    }

}

crash-2021-06-12_18.24.20-client.txt

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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