Jump to content

[1.9.4]Stuck On Game Regisrty


Sgurtler

Recommended Posts

I've Just started trying to make

this is the Mod file I think pretty sure lol :-[

package io.github.SamGurtler;import io.github.SamGurtler.Item_Red_Dyed_Water_Bottle;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.fml.common.Mod.EventHandler;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

import net.minecraftforge.fml.common.registry.GameRegistry;

 

@Mod(modid = CRSoda.MODID, version = CRSoda.VERSION)

public class CRSoda

{

    public static final String MODID = "CRSoda";

    public static final String VERSION = "1.0";

    public static Item Red_Dyed_Water_Bottle;

   

    @EventHandler

    public void preinit(FMLPreInitializationEvent event)

    {

     

      CRSoda.register(Red_Dyed_Water_Bottle);

      CRSoda.init();

      /*

      // some example code

      Red_Dyed_Water_Bottle = new Item_Red_Dyed_Water_Bottle().setRegistryName(CRSoda.MODID, "Red Dyed Water Bottle");

      GameRegistry.register(Red_Dyed_Water_Bottle.setRegistryName(Red_Dyed_Water_Bottle.getRegistryName()));

      //GameRegistry.registerItem(Red_Dyed_Water_Bottle,"Red Dyed Water Bottle");

      //GameRegistry.register(Red_Dyed_Water_Bottle.)

      */

    }

    public static final void init() {

      Red_Dyed_Water_Bottle = new Item_Red_Dyed_Water_Bottle().setRegistryName(CRSoda.MODID, "Red Dyed Water Bottle");

 

      register(Red_Dyed_Water_Bottle);

  }

 

  private static final void register(Item i) {

      GameRegistry.register(i.setUnlocalizedName(i.getRegistryName().toString()));

  }

  /*

    @EventHandler

    public void init(FMLInitializationEvent event)

    {

        // some example code

      ItemStack Water_Bottle = new ItemStack(Items.GLASS_BOTTLE.)

      GameRegistry.addShapelessRecipe(ItemStack (Items.Red_Dyed_Water_Bottle), Items.);

      GameRegistry.registerItem(Red_Dyed_Water_Bottle,"Red_Dyed_Water_Bottle");

     

    }*/

}

and this is the Item file that I think might be the problem

package io.github.SamGurtler;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.Item;

import net.minecraftforge.fml.common.registry.GameRegistry;

 

 

public class Item_Red_Dyed_Water_Bottle extends Item

{

  public Item_Red_Dyed_Water_Bottle()

    {

     

      setUnlocalizedName(CRSoda.MODID+"_"+"Red Dyed Water Bottle");

      // my book says to do this again and I'm not sure why

      GameRegistry.registerItem(this,CRSoda.MODID+":"+"Red Dyed Water Bottle");

      setCreativeTab(CreativeTabs.MISC);

     

    }

 

 

 

}

Here is the crash report

 

---- Minecraft Crash Report ----

// But it works on my machine.

 

Time: 7/21/16 12:57 PM

Description: Initializing game

 

java.lang.NullPointerException: Initializing game

  at io.github.SamGurtler.CRSoda.register(CRSoda.java:42)

  at io.github.SamGurtler.CRSoda.preinit(CRSoda.java:25)

  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.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:568)

  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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

  at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

  at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

  at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

  at com.google.common.eventbus.EventBus.post(EventBus.java:275)

  at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:228)

  at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:206)

  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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

  at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

  at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

  at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

  at com.google.common.eventbus.EventBus.post(EventBus.java:275)

  at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135)

  at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:586)

  at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:249)

  at net.minecraft.client.Minecraft.startGame(Minecraft.java:475)

  at net.minecraft.client.Minecraft.run(Minecraft.java:384)

  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:26)

 

 

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

---------------------------------------------------------------------------------------

 

-- Head --

Thread: Client thread

Stacktrace:

  at io.github.SamGurtler.CRSoda.register(CRSoda.java:42)

  at io.github.SamGurtler.CRSoda.preinit(CRSoda.java:25)

  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.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:568)

  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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

  at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

  at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

  at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

  at com.google.common.eventbus.EventBus.post(EventBus.java:275)

  at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:228)

  at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:206)

  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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

  at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

  at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

  at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

  at com.google.common.eventbus.EventBus.post(EventBus.java:275)

  at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135)

  at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:586)

  at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:249)

  at net.minecraft.client.Minecraft.startGame(Minecraft.java:475)

 

-- Initialization --

Details:

Stacktrace:

  at net.minecraft.client.Minecraft.run(Minecraft.java:384)

  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:26)

 

-- System Details --

Details:

  Minecraft Version: 1.9.4

  Operating System: Windows 10 (amd64) version 10.0

  Java Version: 1.8.0_91, Oracle Corporation

  Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

  Memory: 851784208 bytes (812 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)

  JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

  IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

  FML: MCP 9.28 Powered by Forge 12.17.0.1976 7 mods loaded, 7 mods active

  States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

  UCH  mcp{9.19} [Minecraft Coder Pack] (minecraft.jar)

  UCH  FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.9.4-12.17.0.1976.jar)

  UCH  Forge{12.17.0.1976} [Minecraft Forge] (forgeSrc-1.9.4-12.17.0.1976.jar)

  UCH  examplemod{1.0} [Example Mod] (bin)

  UCE  CRSoda{1.0} [CRSoda] (bin)

  UCH  Flint Sharpener{0.1} [Flint Sharpener] (bin)

  UCH  Sam's mod test code{0.01} [sam's mod test code] (bin)

  Loaded coremods (and transformers):

  GL info: ' Vendor: 'Intel' Version: '4.3.0 - Build 10.18.15.4256' Renderer: 'Intel® HD Graphics'

  Launched Version: 1.9.4

  LWJGL: 2.9.4

  OpenGL: Intel® HD Graphics GL version 4.3.0 - Build 10.18.15.4256, 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: No

  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: net.minecraft.client.Minecraft$15@3f3e6c03

I've made sure that my file path (I think is what it's called) is my modid

\src\main\resources\assets\CRSoda\lang

and I think I have my texture in the right spot I think

\src\main\resources\assets\CRSoda\textures

so what am I doing wrong?

also sorry If I posted in the wrong spot this I my first time posting modding and I'm really stuck.

[/size]

Link to comment
Share on other sites

Yea An item that does nothing as of right now is what I'm going for I'm just trying to make an item before I make it do anything getting stuck on the first step.

So what do I need to do? To get an item that does nothing ? Do I need a crafting recipe,Can't I just access it from the creative miscellaneous tab?

 

You don't need to be rude I'm 18,and legitimately trying to learn how to make mods I'm following tutorials and trying some things on my own and am just looking for help.

Link to comment
Share on other sites

what do you mean by the field? Like do I have to have the item do something to work ,add a crafting recipe to a FMLInitializationEvent Event Handler?

And sorry I was defensive I was reading you Quote didn't realize you have it under every post.

Link to comment
Share on other sites

Yeah I took two years of It but never payed attention to terms Like I know how to make my own object I use arrays I know what int floats string short long boolean and char are.

Anyway thanks for trying to help me I think I'm going to refresh myself on java, btw so cool to talk to you I've used you camera mod before that's crazy.

 

One more thing before I give up umm what is the water bottle in forge called is it like WATER_BOTTLE or is it GLASS_BOTTLE

GameRegistry.addShapelessRecipe(new ItemStack(Red_Dyed_Water_Bottle),new ItemStack(Items.GLASS_BOTTLE),new ItemStack(Items.DYE,1,1));

Link to comment
Share on other sites

public static Item Red_Dyed_Water_Bottle;

Oh good! We have a spot in memory for an

Item

! It is currently null. ^..^

public void preinit(FMLPreInitializationEvent event) {

Ooh! This got called! Yay!

CRSoda.register(Red_Dyed_Water_Bottle);

Lets register an item!

GameRegistry.register(i.setUnlocalizedName(i.getRegistryName().toString()));

OH GOD, THE ITEM WAS NULL! D:

 

The code never gets here:

CRSoda.init();

Red_Dyed_Water_Bottle = new Item_Red_Dyed_Water_Bottle().setRegistryName(CRSoda.MODID, "Red Dyed Water Bottle");

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • im stuck in a problem whit BlockEntities i cannot solve so im trying to work around it but in the less complex way possible  i think is posible to store data to the minecraft world  in older versions people talk about  WordDataSave i dont find anything about it for 1.20.4  i find a tutorial for player capability in 1.19    here is an event      //########## ########## ########## ##########     @SubscribeEvent     public static void onAttachCapabilitiesPlayer(AttachCapabilitiesEvent<Entity> event) {         if(event.getObject() instanceof Player) {             if(!event.getObject().getCapability(PlayerThirstProvider.PLAYER_THIRST).isPresent()) {                 event.addCapability(new ResourceLocation(mercmod.MOD_ID, "properties"), new PlayerThirstProvider());             }         }     }  soo i made this      //########## ########## ########## ##########     @SubscribeEvent     public static void onAttachCapabilitiesLevel(AttachCapabilitiesEvent<Level> event) {     } i think i can do some witchcraft  here  but is many things don't understand  to start whit i dont get yet how to recall the saved data from a BlockEntity  the handler still in progress the plan is to make a Map to store nbt data using the block coordinates as index later store that map as a big nbt      ########## any way the question is if theres alredy a tutorial for 1.20.4 for this ?? or some alredy working code from someone else doing something similar ?           
    • I tried this, and found out that Oculus is the mod that is crashing the game. I have removed it, and it now works fine! Thanks!
    • Hi @DanielderErbauer, I arrived here as I have the "as it does not exist in Block{minecraft:air}" error in a modpack I am trying to start. It's a long-shot, I know, but as the post that led this to being solved is missing, can I ask if you may recall what it said? Thanks in advance
    • Hm yeah sorry, not seeing anything else that's sticking out, I'd need to debug myself probably. Do you have a github or bitbucket repo? I could poke around when I have time to see what the problem might be.
    • looking around for the capabilities thing i found a piece of code and find this piece of code  //########## ########## ########## ########## @SubscribeEvent public static void addCustomTrades(VillagerTradesEvent event) { if(event.getType() == VillagerProfession.FLETCHER) { System.out.println("\n\n### VillagerProfession.FLETCHER \n\n");//<----------- Int2ObjectMap<List<VillagerTrades.ItemListing>> trades = event.getTrades(); ItemStack stack = new ItemStack(ItemInit.ARROW_STEEL.get(), 16); int villagerLevel = 1; trades.get(villagerLevel).add((trader, rand) -> new MerchantOffer( new ItemStack(Items.EMERALD, 2), stack,1,3,0.02F)); } if(event.getType() == VillagerProfession.TOOLSMITH) { System.out.println("\n\n### VillagerProfession.TOOLSMITH \n\n");//<----------- Int2ObjectMap<List<VillagerTrades.ItemListing>> trades = event.getTrades(); ItemStack stack = new ItemStack(ItemInit.INGOT_STEEL.get(), 1); int villagerLevel = 1; trades.get(villagerLevel).add((trader, rand) -> new MerchantOffer( new ItemStack(Items.EMERALD, 2), stack,10,8,0.02F)); } } //########## ########## ########## ########## the event is aknoledge and execute when the maps load  ### VillagerProfession.FLETCHER  ### VillagerProfession.TOOLSMITH  //########## But is not working      is a random piece of code is not working  could it be than this code is old 1.18 and no valid anymore for 1.20.4 or the thing are this numbers  stack,10,8,0.02F));  i dont know what this numbers means    ########## the question is ¿how to add things to the villager traders    thanks for your attention               
  • Topics

×
×
  • Create New...

Important Information

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