Jump to content

Own Mod crashes in FMLInitializationEvent


mOi!terei

Recommended Posts

Good Evening,
I'm new in minecraft-modding and I have a Problem with register my Entity. I'm sure that this problem is very simple, but I can't find the mistake, maybe course I can't find an actual examble ffor this in Version 1.12.2.
 

---- Minecraft Crash Report ----
// Quite honestly, I wouldn't worry myself about that.

Time: 1/15/19 8:40 PM
Description: There was a severe problem during mod loading that has caused the game to fail

net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from autonomous Villages (vm)
Caused by: java.lang.NullPointerException
    at net.minecraftforge.fml.common.registry.EntityRegistry.doModEntityRegistration(EntityRegistry.java:211)
    at net.minecraftforge.fml.common.registry.EntityRegistry.registerModEntity(EntityRegistry.java:173)
    at com.mOIterei.EntityMod.Main.init(Main.java:76)
    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.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:626)
    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 com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
    at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
    at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
    at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
    at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
    at com.google.common.eventbus.EventBus.post(EventBus.java:217)
    at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:218)
    at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:196)
    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 com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
    at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
    at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
    at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
    at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
    at com.google.common.eventbus.EventBus.post(EventBus.java:217)
    at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135)
    at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:744)
    at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:336)
    at net.minecraft.client.Minecraft.init(Minecraft.java:581)
    at net.minecraft.client.Minecraft.run(Minecraft.java:421)
    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.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:
---------------------------------------------------------------------------------------

-- System Details --
Details:
    Minecraft Version: 1.12.2
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_191, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 812226280 bytes (774 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP 9.42 Powered by Forge 14.23.5.2768 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 |
    |:----- |:--------- |:------------ |:-------------------------------- |:--------- |
    | UCHI  | minecraft | 1.12.2       | minecraft.jar                    | None      |
    | UCHI  | mcp       | 9.42         | minecraft.jar                    | None      |
    | UCHI  | FML       | 8.0.99.99    | forgeSrc-1.12.2-14.23.5.2768.jar | None      |
    | UCHI  | forge     | 14.23.5.2768 | forgeSrc-1.12.2-14.23.5.2768.jar | None      |
    | UCHEE | vm        | 1.0          | bin                              | None      |

    Loaded coremods (and transformers): 
    GL info: ' Vendor: 'NVIDIA Corporation' Version: '3.3.0' Renderer: 'GeForce 8500 GT/PCIe/SSE2'

 

the refered Code-Line is: 

 EntityRegistry.registerModEntity(Berserker.ResLoc, , "Berserker", 2, Main.class, 50, 2, true);

 

I tried <EntityRegistry.registerModEntity(Berserker.ResLoc, , "Berserker", 2, Main.instance, 50, 2, true);>  too, but still the same exception;

 

 

the refered Class-Code with error is:

 

@Mod(modid = References.MOD_ID, name = References.NAME, version = References.VERSION)
@EventBusSubscriber
public class Main
{
    static int z = 0;
    public Main()
    {
        
    }

    @Mod.Instance("Main")
    public static Main instance;
    
    @SidedProxy(clientSide = References.CLIENT_PROXY_CLASS, serverSide = References.COMMON_PROXY_CLASS)
    public static CommonProxy proxy;
    
    @EventHandler
    public static void PreInit(FMLPreInitializationEvent event)
    {
    }
    
    @Mod.EventHandler
    public static void init(FMLInitializationEvent event)
    {
        System.out.println("++++++++++++++++++++++++++++++++++++++++++++++\n"
                +"INIT   START !!");
        proxy.register();

        EntityRegistry.registerModEntity(Berserker.ResLoc, , "Berserker", 2, Main.class, 50, 2, true);
        System.out.println("++++++++++++++++++++++++++++++++++++++++++++++\n"
                +"INIT   READY !!");
        
        
    }

 

 

Link to comment
Share on other sites

Ok thanks, that was a great Help.
Now the Game starts a the Mod do anything, but I'm not sure if this call of EntityEntryBuilder is right. Especially the 'int network' is something I can't understand. what does it mean? 
I'm not sure if my code is right. Or id I have to call more methods?
I removed the EntityRegistry and tried this:

        EntityEntryBuilder eeb = EntityEntryBuilder.create();
        eeb.entity(AbstractVillager.class);
        eeb.id(AbstractVillager.ressource, 1);

for the beginning I use a texture from Minecraft >public static final ResourceLocation ressource = new ResourceLocation("minecraft:textures/entity/villager/villager.png");<
but this is not the mistake, or is it?
I cath the EntityJoinWorldEvent and replace the spawned Villager with a Villager of mine. But in game I can hear the Villagers but dan't see them.

Link to comment
Share on other sites

     Oh ok, this is much shorter and this is my new Code:

 

        @Mod.EventHandler
        public static void registerEntity(RegistryEvent.Register<EntityEntry> event)
        {
//            create EntityEntry
        
            EntityEntry abstractVil = EntityEntryBuilder.create().id(AbstractVillager.ressource, 0).entity(AbstractVillager.class).build();
        
            
//            register EntityEntry
            event.getRegistry().registerAll(abstractVil);
            
        }

I Think it is it, but my problem still the same: I can hear the Villagers but can't see.

when I catch the spawned Villager and replace him I print out the old and the new Villager and the ID.
The Result during load a new Village:

[18:01:59] [main/INFO] [minecraft/GuiNewChat]: [CHAT] Player53 wurde zu 1112.5, 100.0, -135.5 teleportiert
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2683, l='Neue Welt', x=1119.50, y=65.00, z=-135.50] - ID: 2683
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2684, l='Neue Welt', x=1119.50, y=65.00, z=-135.50] - ID: 2684
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2685, l='Neue Welt', x=1120.50, y=65.00, z=-135.50] - ID: 2685
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2686, l='Neue Welt', x=1120.50, y=65.00, z=-135.50] - ID: 2686
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2687, l='Neue Welt', x=1127.50, y=65.00, z=-132.50] - ID: 2687
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2688, l='Neue Welt', x=1127.50, y=65.00, z=-132.50] - ID: 2688
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2689, l='Neue Welt', x=1127.50, y=65.00, z=-122.50] - ID: 2689
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2690, l='Neue Welt', x=1127.50, y=65.00, z=-122.50] - ID: 2690
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2691, l='Neue Welt', x=1112.50, y=65.00, z=-134.50] - ID: 2691
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2692, l='Neue Welt', x=1112.50, y=65.00, z=-134.50] - ID: 2692
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2693, l='Neue Welt', x=1112.50, y=65.00, z=-127.50] - ID: 2693
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2694, l='Neue Welt', x=1112.50, y=65.00, z=-127.50] - ID: 2694
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2695, l='Neue Welt', x=1114.50, y=65.00, z=-120.50] - ID: 2695
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2696, l='Neue Welt', x=1114.50, y=65.00, z=-120.50] - ID: 2696
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2697, l='Neue Welt', x=1104.50, y=65.00, z=-132.50] - ID: 2697
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2698, l='Neue Welt', x=1104.50, y=65.00, z=-132.50] - ID: 2698
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2700, l='Neue Welt', x=1119.50, y=65.00, z=-142.50] - ID: 2700
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2701, l='Neue Welt', x=1119.50, y=65.00, z=-142.50] - ID: 2701
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2702, l='Neue Welt', x=1126.50, y=64.00, z=-143.50] - ID: 2702
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2703, l='Neue Welt', x=1126.50, y=64.00, z=-143.50] - ID: 2703
[18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1
[18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1
[18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1
[18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2706, l='Neue Welt', x=1112.50, y=66.00, z=-159.50] - ID: 2706
[18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2707, l='Neue Welt', x=1112.50, y=66.00, z=-159.50] - ID: 2707
[18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1
[18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1
[18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1
[18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1
[18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1
[18:02:01] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2709, l='Neue Welt', x=1137.50, y=66.00, z=-107.50] - ID: 2709
[18:02:01] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2710, l='Neue Welt', x=1137.50, y=66.00, z=-107.50] - ID: 2710
[18:02:01] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1
[18:02:01] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1
[18:02:01] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2717, l='Neue Welt', x=1112.50, y=65.00, z=-170.50] - ID: 2717
[18:02:01] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2718, l='Neue Welt', x=1112.50, y=65.00, z=-170.50] - ID: 2718
[18:02:01] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2719, l='Neue Welt', x=1112.50, y=65.00, z=-169.50] - ID: 2719
[18:02:01] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2720, l='Neue Welt', x=1112.50, y=65.00, z=-169.50] - ID: 2720
[18:02:01] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2721, l='Neue Welt', x=1104.50, y=67.00, z=-172.50] - ID: 2721
[18:02:01] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2722, l='Neue Welt', x=1104.50, y=67.00, z=-172.50] - ID: 2722
[18:02:01] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1
[18:02:01] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1
[18:02:01] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1
[18:02:01] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1
[18:02:03] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game...
[18:02:03] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Neue Welt'/overworld



I can't understand the message because the console write out every time a ID != -1

 

Link to comment
Share on other sites

47F524FA-3460-4042-B911-E19163726AC1.jpeg.5c5956055542b0dc172a2d0c5815ba2c.jpeg

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

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.