mooL Posted January 5, 2018 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
LeoCTH Posted January 5, 2018 Posted January 5, 2018 GameRegistry.register() is now private and internal. Use register events, or ForgeRegistries above. Quote
mooL Posted January 5, 2018 Author Posted January 5, 2018 what do you mean by private and internal? as in only minecraft itself uses it, and not modders? Quote
Abastro Posted January 5, 2018 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.
LeoCTH Posted January 5, 2018 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
Matryoshika Posted January 5, 2018 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.
Draco18s Posted January 5, 2018 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 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.
LexManos Posted January 5, 2018 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 5 Quote I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
Draco18s Posted January 6, 2018 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. 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.
LeoCTH Posted January 6, 2018 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
Recommended Posts
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.