Jump to content

Recommended Posts

Posted

I have the error above. It says the error is on line 72 which says

Public void init (FMLInitializationEvent e){

registerItems ();

}

The registerItems method is made with this code 

Public void registerItems (RegistryEvent.Register <Item> event){

       event.getRegistry ().register (new Item ().setRegistryName ("testmod", "testitem"));

        event.getRegistry ().register (new ItemSword (Item.ToolMaterial.DIAMOND).setRegistryName ("flashmod", "flash_sword"));

Posted (edited)

Do not manually call registerItems. Just annotate it with SubscribeEvent and its class with Mod#EventBusSubscriber and it will automatically be called as long as it's static (it currently isn't).

Edited by That_Martin_Guy
Posted
public void registerItems(RegistryEvent.Register<Item>event)

You wrote the type and parameter name in the same word twice in different classes. This will never work. Also, you need to store the items in variables, you can't just do create new objects and be done with it. If you ever want to check if the player is holding your sword, for example, you can't because you don't have it stored in a variable.

Posted

I do know java. I had commented that part out in main and moved to init.

14 minutes ago, That_Martin_Guy said:

public void registerItems(RegistryEvent.Register<Item>event)

You wrote the type and parameter name in the same word twice in different classes. This will never work. Also, you need to store the items in variables, you can't just do create new objects and be done with it. If you ever want to check if the player is holding your sword, for example, you can't because you don't have it stored in a variable.

How do I do that?

Posted (edited)

I KNOW FRICKIN JAVA. I HAVE BEEN DOING FOR YEARS I AM NEW TO MODDING , THIS WOULD GO ALOT FASTER IF PEOPLE WOULD HELP NOT JUDGE PEOPLE ON HOW THEY THINK THEIR LEVEL OF JAVA IS.

Edited by Chuckinator
Posted
27 minutes ago, Chuckinator said:
Quote

Also, you need to store the items in variables, you can't just do create new objects and be done with it.

How do I do that?

 

6 minutes ago, Chuckinator said:

I KNOW FRICKIN JAVA.

That doesn't look like you know java, and people don't want to waste their time teaching people basic java concepts, so please try to explain exactly what you are struggling with, rather than just complaining that people are judging you. The more information you give, the more we can help.

Posted
30 minutes ago, Chuckinator said:

I KNOW FRICKIN JAVA. I HAVE BEEN DOING FOR YEARS

No you don't, not when you ask questions like "how do I make a variable?"

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

Ah, now I see that variable. Your code is all over the place as far as I can tell from these files, and it's a bit hard to find them.

 

All you should have to do, besides the things we've already told you about, is pass the variable into event#getRegistry#register.

 

Also, not directly related, but don't use Item#registerItems. This is minecraft code to be used on minecraft items only. Do not call this method yourself. You should not even import it.

 

Also also, correct me if I'm wrong, but you don't need/should use GameRegistry#ObjectHolder. It just makes the code look ugly AFAIK (again, could be wrong).

Posted (edited)
1 hour ago, That_Martin_Guy said:

Also also, correct me if I'm wrong, but you don't need/should use GameRegistry#ObjectHolder. It just makes the code look ugly AFAIK (again, could be wrong).

I think using @ObjectHolder is the intended way of using registries, and seeing that every test mod using registries uses them @ObjectHolder, it would make sense to use it as well. Also, the docs say this is the recommended way.

Edited by larsgerrits
  • Like 1

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted
2 hours ago, That_Martin_Guy said:

Ah, now I see that variable. Your code is all over the place as far as I can tell from these files, and it's a bit hard to find them.

 

All you should have to do, besides the things we've already told you about, is pass the variable into event#getRegistry#register.

 

Also, not directly related, but don't use Item#registerItems. This is minecraft code to be used on minecraft items only. Do not call this method yourself. You should not even import it.

 

Also also, correct me if I'm wrong, but you don't need/should use GameRegistry#ObjectHolder. It just makes the code look ugly AFAIK (again, could be wrong).

Whats with the hastags?

And I dont know what passing a variable through is?

Posted
9 minutes ago, Chuckinator said:

Whats with the hastags?

It means a field/method etc. is static.

 

10 minutes ago, Chuckinator said:

And I dont know what passing a variable through is?

You need to call

2 hours ago, That_Martin_Guy said:

event#getRegistry#register

using the variable as a parameter.

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Posted
20 minutes ago, Kokkie said:

It means a field/method etc. is static

No, no it does not. It means the exact opposite. 

  • Like 1

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 (edited)

RegisterEvent.Register#getRegistry() is a method. You need to call it like a method.

Edited by larsgerrits

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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.