Jump to content

[1.12] Can not register to a locked registry


Chuckinator

Recommended Posts

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"));

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

4 minutes ago, That_Martin_Guy said:

Imports can be static. Also, let's not go out of our way to call out this guy on every mistake he makes. Whether he's new to java or not, we should not get abusive.

Sorry, didn't look well enough... And please don't talk about abusive... Sorry that was just.. Something...

Classes: 94

Lines of code: 12173

Other files: 206

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

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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/

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

    • If you're seeking an unparalleled solution to recover lost or stolen cryptocurrency, let me introduce you to GearHead Engineers Solutions. Their exceptional team of cybersecurity experts doesn't just restore your funds; they restore your peace of mind. With a blend of cutting-edge technology and unparalleled expertise, GearHead Engineers swiftly navigates the intricate web of the digital underworld to reclaim what's rightfully yours. In your moment of distress, they become your steadfast allies, guiding you through the intricate process of recovery with transparency, trustworthiness, and unwavering professionalism. Their team of seasoned web developers and cyber specialists possesses the acumen to dissect the most sophisticated schemes, leaving no stone unturned in their quest for justice. They don't just stop at recovering your assets; they go the extra mile to identify and track down the perpetrators, ensuring they face the consequences of their deceitful actions. What sets  GearHead Engineers apart is not just their technical prowess, but their unwavering commitment to their clients. From the moment you reach out to them, you're met with compassion, understanding, and a resolute determination to right the wrongs inflicted upon you. It's not just about reclaiming lost funds; it's about restoring faith in the digital landscape and empowering individuals to reclaim control over their financial futures. If you find yourself ensnared in the clutches of cybercrime, don't despair. Reach out to GearHead Engineers and let them weave their magic. With their expertise by your side, you can turn the tide against adversity and emerge stronger than ever before. In the realm of cybersecurity, GearHead Engineers reigns supreme. Don't just take my word for it—experience their unparalleled excellence for yourself. Your journey to recovery starts here.
    • Ok so this specific code freezes the game on world creation. This is what gets me so confused, i get that it might not be the best thing, but is it really so generation heavy?
    • Wizard web recovery has exhibited unparalleled strength in the realm of recovery. They stand out as the premier team to collaborate with if you encounter withdrawal difficulties from the platform where you’ve invested. Recently, I engaged with them to recover over a million dollars trapped in an investment platform I’d been involved with for months. I furnished their team with every detail of the investment, including accounts, names, and wallet addresses to which I sent the funds. This decision proved to be the best I’ve made, especially after realizing the company had scammed me.   Wizard web recovery ensures exemplary service delivery and ensures the perpetrators face justice. They employ advanced techniques to ensure you regain access to your funds. Understandably, many individuals who have fallen victim to investment scams may still regret engaging in online services again due to the trauma of being scammed. However, I implore you to take action. Seek assistance from Wizard Web Recovery today and witness their remarkable capabilities. I am grateful that I resisted their enticements, and despite the time it took me to discover Wizard web recovery, they ultimately fulfilled my primary objective. Without wizard web recovery intervention, I would have remained despondent and perplexed indefinitely.
    • I've tested the same code on three different envionrments (Desktop win10, desktop Linux and Laptop Linux) and it kinda blows up all the same. Gonna try this code and see if i can tune it
    • Minecraft version? Mod loader?
  • Topics

×
×
  • Create New...

Important Information

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