Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.10.2] ForgeRegistries.ITEMS.register or GameRegistry.register(item)?
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
mooL

[1.10.2] ForgeRegistries.ITEMS.register or GameRegistry.register(item)?

By mooL, January 5, 2018 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

mooL    0

mooL

mooL    0

  • Tree Puncher
  • mooL
  • Members
  • 0
  • 21 posts
Posted January 5, 2018 (edited)

Hello I came across ForgeRegistries.ITEMS.register, ForgeRegistries.BLOCKS.register, etc and I was wondering, Is there a difference between that and GameRegistry.register(item)? Do they both do the same thing? Which one should I use? 

Edited January 5, 2018 by mooL
  • Quote

Share this post


Link to post
Share on other sites

LeoCTH    0

LeoCTH

LeoCTH    0

  • Stone Miner
  • LeoCTH
  • Members
  • 0
  • 58 posts
Posted January 5, 2018

GameRegistry.register() is now private and internal.

Use register events, or ForgeRegistries above.

  • Quote

Share this post


Link to post
Share on other sites

mooL    0

mooL

mooL    0

  • Tree Puncher
  • mooL
  • Members
  • 0
  • 21 posts
Posted January 5, 2018

what do you mean by private and internal? as in only minecraft itself uses it, and not modders?

  • Quote

Share this post


Link to post
Share on other sites

Abastro    123

Abastro

Abastro    123

  • World Shaper
  • Abastro
  • Forge Modder
  • 123
  • 1075 posts
Posted January 5, 2018
5 minutes ago, mooL said:

what do you mean by private and internal? as in only minecraft itself uses it, and not modders?

Minecraft Forge uses it internally, if I recall correctly.

It's recommended to use register events: https://mcforge.readthedocs.io/en/latest/concepts/registries/

  • Quote

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Share this post


Link to post
Share on other sites

LeoCTH    0

LeoCTH

LeoCTH    0

  • Stone Miner
  • LeoCTH
  • Members
  • 0
  • 58 posts
Posted January 5, 2018
7 hours ago, Abastro said:

Minecraft Forge uses it internally, if I recall correctly.

It's recommended to use register events: https://mcforge.readthedocs.io/en/latest/concepts/registries/

yes exactly...

but in my own personal case I use ForgeRegistries: LINK

and GameRegistry.register is REALLY private access, and it's javadocs also says it's internal.

  • Quote

Share this post


Link to post
Share on other sites

Matryoshika    118

Matryoshika

Matryoshika    118

  • Dragon Slayer
  • Matryoshika
  • Forge Modder
  • 118
  • 523 posts
Posted January 5, 2018

It's not just "recommended".
There are multiple issues just these last weeks where people are registering though ForgeRegistries.
As per the JavaDoc for ForgeRegistries "..but queries and iterations can use this".


Why should one use the RegistryEvents when you can be lazy and register objects like this?
Well, registration has to happen during a specific interval in Minecraft's life-cycle, which the RegistryEvents were made specifically for, or you may end up with "The object [name] is being added too late" because Forge has called ForgeRegistry::freeze because whoops, time's up, and you shouldn't be messing with this stuff now.

  • Quote

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Share this post


Link to post
Share on other sites

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15995 posts
Posted January 5, 2018 (edited)
10 hours ago, LeoCTH said:

ForgeRegistries above.

No. And if anyone can point me at a tutorial that is saying to do this, link it, so I can go punch that person in the face for being an idiot.

Problematic Code Issue #1

Edited January 5, 2018 by Draco18s
  • Like 2
  • Quote

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.

Share this post


Link to post
Share on other sites

LexManos    1620

LexManos

LexManos    1620

  • Reality Controller
  • LexManos
  • Forge Code God
  • 1620
  • 8954 posts
Posted January 5, 2018

Seriously, Use the event not the static registries. Timing of registration is important. So stop doing it in random places. I was tempted to name the event 'RegisterYourStuffHereAndStopBreakingEverythingElseSeriouslyStopRegisteringYourCrapInRandomPlacesItBreaksThingsAndHoldsUsBackFromBeingAbleToDoCoolThingsThatWeveBeenWantingToDoForFourYearsNow' but I decided against that as it was a bit long ;)

  • Like 5
  • Quote

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Patreon: http://www.patreon.com/lexmanos
Paypal: http://paypal.me/LexManos

BitCoin: 1Q8rWvUNMM2T1ZfDaFeeYQyVXtYoeT6tTn

Share this post


Link to post
Share on other sites

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15995 posts
Posted January 6, 2018
2 hours ago, LexManos said:

Seriously, Use the event not the static registries. Timing of registration is important. So stop doing it in random places. I was tempted to name the event 'RegisterYourStuffHereAndStopBreakingEverythingElseSeriouslyStopRegisteringYourCrapInRandomPlacesItBreaksThingsAndHoldsUsBackFromBeingAbleToDoCoolThingsThatWeveBeenWantingToDoForFourYearsNow' but I decided against that as it was a bit long ;)

RegisterShitHereAndStopBreakingStuffEvent would have worked just fine.

 

  • Like 1
  • Quote

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.

Share this post


Link to post
Share on other sites

LeoCTH    0

LeoCTH

LeoCTH    0

  • Stone Miner
  • LeoCTH
  • Members
  • 0
  • 58 posts
Posted January 6, 2018
6 hours ago, LexManos said:

Seriously, Use the event not the static registries. Timing of registration is important. So stop doing it in random places. I was tempted to name the event 'RegisterYourStuffHereAndStopBreakingEverythingElseSeriouslyStopRegisteringYourCrapInRandomPlacesItBreaksThingsAndHoldsUsBackFromBeingAbleToDoCoolThingsThatWeveBeenWantingToDoForFourYearsNow' but I decided against that as it was a bit long ;)

Okokokokok guys

I'm just gonna make a new thread cuz I don't want to spam at other's threads again

lol

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • JayNeedsHelp
      How can I fix this encoding issue?

      By JayNeedsHelp · Posted 35 minutes ago

      Hey so I'm creating a forge mod and I'm trying to use the "§" character but I'm getting an illegal character error in the compiler. I've tried using the -encoding option in the compiler, I've also tried converting the file to UTF-8 without BOM, but it wasn't UTF-8 BOM in the first place. I was making a jar mod with mcp in eclipse and everything was working just fine with these characters, which I'm now moving to a forge mod. I'm using IntelliJ Community IDEA currently.   Here's a link to part of the error list: https://jay-hosts-a.dark-web.store/6AXsbJqG. Obviously the other errors were due to the illegal character error but I thought I might as well show it. I'm making a forge mod for 1.12.2, forgegradle is version 2.3-SNAPSHOT and I'm using mixingradle-0.6-SNAPSHOT.   I'm not sure how to fix this and any help would be greatly appreciated.
    • mchase
      Forge crashing

      By mchase · Posted 44 minutes ago

      I downloaded and installed forge for 1.16.4 and it shows up in my installations and will start to open but then crashes and gives me "exit code 255". I am on MacOS if that makes a difference. it says The game crashed whilst initializing game Error: java.lang.IllegalStateException: GLFW error before init: [0x10008]Cocoa: Failed to find service port for display Exit Code: 255 does forge just not work on Mac? am I missing something? please help
    • MiToKonndria
      cant download pixelmon

      By MiToKonndria · Posted 1 hour ago

      when i click install on the Pixelmon modpack it gets to 42% and mod 3 out of 7 and then gives me the error message: Timeout attempting to download: "https://edge.forgecdn.net/files/3072/298/pixelmon-1.12.2-8.1.2-universal.jar"
    • lupicus
      can someone help with server crashing

      By lupicus · Posted 1 hour ago

      Looks like Wonderful Enchantments has problems, try and remove it.
    • Draco18s
      can someone help with server crashing

      By Draco18s · Posted 1 hour ago

      Surprise, accessing the client thread from the server thread isn't possible. Bitch at the author of wonderfulenchantments.
  • Topics

    • JayNeedsHelp
      0
      How can I fix this encoding issue?

      By JayNeedsHelp
      Started 35 minutes ago

    • mchase
      0
      Forge crashing

      By mchase
      Started 45 minutes ago

    • MiToKonndria
      0
      cant download pixelmon

      By MiToKonndria
      Started 1 hour ago

    • IRONDALEK
      3
      can someone help with server crashing

      By IRONDALEK
      Started 6 hours ago

    • Twu
      0
      Need help with Potion Brewing recipes

      By Twu
      Started 1 hour ago

  • Who's Online (See full list)

    • ehbean
    • NotAPotato
    • MagmaMan
    • JayNeedsHelp
    • Uncreative
    • mchase
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.10.2] ForgeRegistries.ITEMS.register or GameRegistry.register(item)?
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community