Jump to content

Recommended Posts

Posted (edited)

Ive just come back from a 3 year break and forge is different now, im back to the basics and struggling to register items/blocks. this is basically my setup for items and blocks

 

https://github.com/TheSlayerMC/Journey-1.12

 

Items:

	@EventBusSubscriber(modid=SlayerAPI.MOD_ID)
public class JourneyItems 
	 
	public static ArrayList<Item> items = new ArrayList<Item>();
	 
	public static final Item hellstoneIngot = new ItemMod("hellstoneIngot", "Bloodcrust Ingot");
	 
	@SubscribeEvent
    public static void registerItems(RegistryEvent.Register<Item> event) {
        for(Item i : items)
            event.getRegistry().registerAll(i);
    }
	

 

ItemMod:

	public ItemMod(String name, String finalName, CreativeTabs tab){
        LangRegistry.addItem(name, finalName);
        setUnlocalizedName(name);
        setCreativeTab(tab);
        setRegistryName(name);
        JourneyItems.itemNames.add(name);
        JourneyItems.items.add(this);
    }
	

 

CrashReport

  Reveal hidden contents
Edited by The_SlayerMC

Former developer for DivineRPG, Pixelmon and now the maker of Essence of the Gods

Posted (edited)

your kidding right? your sending in a null string for the registry name. Also use resource location with the base being your modid because if you don't it becomes minecraft:yourblock or make sure you auto fill in the base with joreney: + string sent in. Another thing is caps are no longer supported the string you send in gets turned into resource location later even if you use the string param

Edited by jredfox
Posted (edited)
  On 6/10/2018 at 7:04 AM, The_SlayerMC said:

just changed 

 

 

	for(int i = 0; i < items.size(); i++)
            event.getRegistry().registerAll(items.get(i));
	

 

Expand  

you need to debug it yourself but, that's what the crash report says. It also says all your resource location domains are minecraft not jorney fix it.

 

Literally print out the name of the item before the last crash it will tell you the one that is causing the null string hopefully.

Edit: it's going to crash on the moment of creating your object so print in your main block/item to find the one that's going to cause the crash

Edited by jredfox
Posted (edited)
  On 6/10/2018 at 5:30 AM, The_SlayerMC said:

 LangRegistry.addItem(name, finalName);

Expand  

You do not need this. Just use a lang file. (My assets are apparently still using an older format, the current format uses all lower case, so "en_us.lang" not "en_US.lang")

 

Problematic Code #10

Edited by Draco18s

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.

Posted
  On 6/10/2018 at 4:46 PM, Draco18s said:

You do not need this. Just use a lang file. (My assets are apparently still using an older format, the current format uses all lower case, so "en_us.lang" not "en_US.lang")

 

Problematic Code #10

Expand  

My lang registry file is auto generated, just same name as the old one sorry

https://github.com/TheSlayerMC/Journey-1.12/blob/master/main/java/net/journey/util/LangRegistry.java

Former developer for DivineRPG, Pixelmon and now the maker of Essence of the Gods

Posted (edited)
  On 6/11/2018 at 1:38 AM, The_SlayerMC said:

My lang registry file is auto generated, just same name as the old one sorry

https://github.com/TheSlayerMC/Journey-1.12/blob/master/main/java/net/journey/util/LangRegistry.java

Expand  

I recommend only generating lang files during dev unoptimized to do so otherwise I do the same thing. If your mod doesn't contian pack.mcmeta then you need en_US.lang instead of en_us.lang

Edited by jredfox
Posted
  On 6/11/2018 at 2:10 AM, jredfox said:

I recommend only generating lang files during dev unoptimized to do so otherwise I do the same thing. If your mod doesn't contian pack.mcmeta then you need en_US.lang instead of en_us.lang

Expand  

I only generate it during dev as it generates to the users desktop meaning mine or whoever downloads the source, ive got a booelan running for dev mode 

Former developer for DivineRPG, Pixelmon and now the maker of Essence of the Gods

Posted
  On 6/11/2018 at 7:20 AM, diesieben07 said:

The amount of effort people go through, it boggles my mind. Why in gods name do you not simply put these into a real .lang file? How is this giant, messy class in any way better?

Expand  

I made a config library anyways might as well put it to use

Posted
  On 6/11/2018 at 7:20 AM, diesieben07 said:

The amount of effort people go through, it boggles my mind. Why in gods name do you not simply put these into a real .lang file? How is this giant, messy class in any way better?

Expand  

because it automatically adds new items/blocks by itself so i dont have to do it, why would i do it manually if i scripted it to do it automatically 

Former developer for DivineRPG, Pixelmon and now the maker of Essence of the Gods

Posted
  On 6/11/2018 at 1:11 PM, The_SlayerMC said:

because it automatically adds new items/blocks by itself so i dont have to do it, why would i do it manually if i scripted it to do it automatically 

Expand  

exactly automation is key and they want static references to make you do the amount of lines you write * 5 when it should be one line

Posted
  On 6/11/2018 at 1:15 PM, diesieben07 said:

You have to write the name at some point.

Why is:

someConvolutedMethod(myItem, "mymod.myitem.name", "My Cool Item")

better than

mymod.myitem.name=My Cool Item

?

Expand  

so you don't have to write it constantly it autofills and you can change it via code rather then constantly going through files feeling like code is in vein and really your a resource pack maker rather then actual coding.

Posted
  On 6/11/2018 at 1:11 PM, The_SlayerMC said:

because it automatically adds new items/blocks by itself so i dont have to do it, why would i do it manually if i scripted it to do it automatically 

Expand  

No it doesn't. Yes, that code "automatically writes things to the lang file" but YOU the programmer still need to write the code that does that. And you spend more keystrokes writing your automatic writer than you would just writing things in the lang file.

 

Not having to write out "item.____.name" every time is why I have things like this in my lang files. Copy-paste the line, only change what's important.

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.

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.