Kombat Kitten Posted September 16, 2017 Posted September 16, 2017 Hey guys, I'm pretty confused by the new registry system. All the tutorials and example mods I could find still do it the old way. Even the ones that claim to be 1.12 still often use GameRegistry.register(), wich doesn't exist anymore (or am I blind?). Does anyone know a good tutorial or example mod that explains the new system? Thanks Quote
Draco18s Posted September 16, 2017 Posted September 16, 2017 On 9/16/2017 at 4:15 PM, Kombat Kitten said: Even the ones that claim to be 1.12 still often use GameRegistry.register(), wich doesn't exist anymore (or am I blind?). Expand It's private. Please link any 1.12 tutorials that are still doing it that way so that we can inform them that they're either doing it wrong or falsely claiming to be a 1.12 tutorial. The new way feels oddly roundabout to me, but there are certain advantages to it (namely that the game can do a full rebuild of blocks and items while the game is running, should it need to). Essentially you need to subscribe to the RegistryEvent.Register<T> events (and you'll put the type of object you want to register where the T is, e.g. RegistryEvent.Register<Block>) and call event.getRegistry().register(...) on all of your things. Note that you will have to register item forms of your blocks yourself if you want your blocks to exist as items (i.e. pickup-able). You will also need to subscribe to the ModelRegistryEvent in order to register item models (though you still call ModelLoader.setCustomModelResourceLocation(...)) If you would like, I have set up two classes that I call my Easy Registry. It is essentially a wrapper around these things the way GameRegistry used to wrap around vanilla and forge internals. https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/EasyRegistry.java https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/client/ClientEasyRegistry.java Note that the EasyRegistry classes are effectively both event handler (for the aforementioned events) and the proxy classes for my library: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/HardLib.java#L44 You do not need to clone all of HardLib to make this work, you can re-point the references to your own library or main mod class, although there are some helpful interfaces you might want (that handle things like custom IStateMappers and so on). Usage is very simple and easy. It is also advised that you use @ObjectHolder annotations on your block/item fields (which I am not currently doing) in order to allow other mods to override your own (the "Substitution Alias" system wrought 1.12), see Lex's comments here: 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.
Kombat Kitten Posted September 16, 2017 Author Posted September 16, 2017 Thanks! This is really helpfull. I closed the tabs with the useless tutorials so I can't find them anymore. If I come across one I'll post it here. Quote
Draco18s Posted September 16, 2017 Posted September 16, 2017 Bad tutorials is a thing we do our best to fight against, letting their authors know about the problems so they can be fixed. No worries if you can't find them again, it just would have been helpful. 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.
Kokkie Posted September 16, 2017 Posted September 16, 2017 Kombat Kitten you can look at your browser history (if it is safe to look at right now ( ͡° ͜ʖ ͡°)) Quote Classes: 94 Lines of code: 12173 Other files: 206 Github repo: https://github.com/KokkieBeer/DeGeweldigeMod
Kombat Kitten Posted September 16, 2017 Author Posted September 16, 2017 On 9/16/2017 at 7:22 PM, Kokkie said: Kombat Kitten you can look at your browser history (if it is safe to look at right now ( ͡° ͜ʖ ͡°)) Expand Haha it is... though I've visited a few hundred websites today (learning to mod = using the internet, as you might know). Further I have some problems with registering my texture. This is the code I have now: https://github.com/KombatKitten/Collision/tree/Forums-Question/src Does anyone know what I'm doing wrong? Quote
Draco18s Posted September 16, 2017 Posted September 16, 2017 Not related to your problem, but: https://github.com/KombatKitten/Collision/blob/Forums-Question/src/main/java/com/github/KombatKitten/dimensionalMagic/CommonProxy.java#L43-L44 You shouldn't do this. You should set the unlocalized name to the registry name so that your mod ID appears in the unlocalized name (this avoids conflicts with two mods naming their item the same thing). Post your log file. 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.
Kombat Kitten Posted September 17, 2017 Author Posted September 17, 2017 On 9/16/2017 at 9:10 PM, Draco18s said: Not related to your problem, but: https://github.com/KombatKitten/Collision/blob/Forums-Question/src/main/java/com/github/KombatKitten/dimensionalMagic/CommonProxy.java#L43-L44 You shouldn't do this. You should set the unlocalized name to the registry name so that your mod ID appears in the unlocalized name (this avoids conflicts with two mods naming their item the same thing). Post your log file. Expand like this? SIMPLEBLOCKI.setRegistryName(Reference.MODID, "simpleblock"); SIMPLEBLOCKI.setUnlocalizedName(SIMPLEBLOCKI.getRegistryName().toString()); I changed unlocalized name of the block too. console output (if that's what you mean): https://pastebin.com/G1Ha0F2T Quote
loordgek Posted September 17, 2017 Posted September 17, 2017 @Kombat Kitten this one https://www.youtube.com/watch?v=pdzTukOnDbI ?? lets see what is wrong w/ it using GameRegistry.register() - check the old way of register the render - check getUnlocalizedName().substring(5) - check Quote
loordgek Posted September 17, 2017 Posted September 17, 2017 https://github.com/KombatKitten/Collision/blob/Forums-Question/src/main/java/com/github/KombatKitten/dimensionalMagic/DimensionalMagic.java#L38-L45 remove this Quote
Kombat Kitten Posted September 17, 2017 Author Posted September 17, 2017 I removed it. Still not working. Quote
Draco18s Posted September 17, 2017 Posted September 17, 2017 On 9/17/2017 at 10:12 AM, Kombat Kitten said: like this? SIMPLEBLOCKI.setRegistryName(Reference.MODID, "simpleblock"); SIMPLEBLOCKI.setUnlocalizedName(SIMPLEBLOCKI.getRegistryName().toString()); I changed unlocalized name of the block too. Expand Yep. 5 hours ago, Kombat Kitten said: console output (if that's what you mean): https://pastebin.com/G1Ha0F2T Expand Huh, I don't see anything in there. 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.
Kombat Kitten Posted September 17, 2017 Author Posted September 17, 2017 On 9/17/2017 at 3:49 PM, Draco18s said: Huh, I don't see anything in there. Expand you mean it's empty? Quote
Draco18s Posted September 17, 2017 Posted September 17, 2017 On 9/17/2017 at 3:52 PM, Kombat Kitten said: you mean it's empty? Expand No, I mean I don't see any errors being logged. 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.
Kombat Kitten Posted September 17, 2017 Author Posted September 17, 2017 that's what suprised me too Quote
Draco18s Posted September 17, 2017 Posted September 17, 2017 @Choonster Can we get your eyes on this? You seem to be more adept than anyone in finding issues with item model problems. 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.
Choonster Posted September 17, 2017 Posted September 17, 2017 @Mod.EventBusSubscriber registers the Class with the event bus, so only static @SubscribeEvent methods will be called. Your RegistryEvent.Register handlers in CommonProxy and ClientProxy are non-static, so they will never be called. There's no need to handle Block/Item registration in your proxies, do it in common classes (e.g. DMBlocks/DMItems). There's no reason to have a common proxy class, since proxies are for sided code. Common code belongs in your @Mod class or other common classes. Always annotate override methods with @Override so you get a compilation error if they don't actually override/implement a super method. Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
Draco18s Posted September 17, 2017 Posted September 17, 2017 On 9/17/2017 at 5:02 PM, Choonster said: @Mod.EventBusSubscriber registers the Class with the event bus, so only static @SubscribeEvent methods will be called. Your RegistryEvent.Register handlers in CommonProxy and ClientProxy are non-static, so they will never be called. Expand Ah ha. I still have trouble spotting this even though I know to look for it. 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.
Kombat Kitten Posted September 17, 2017 Author Posted September 17, 2017 On 9/17/2017 at 5:02 PM, Choonster said: @Mod.EventBusSubscriber registers the Class with the event bus, so only static @SubscribeEvent methods will be called. Your RegistryEvent.Register handlers in CommonProxy and ClientProxy are non-static, so they will never be called. Expand Yeah, I already changed them to static because I got an error. Now the error is gone but the block and the item are still using the basic textures (the item is acquirable through /give and the creative tab and the block is placable). I have pushed all the changes to GitHub. Btw, the display name of the block/item is still equal to the unlocalized name, even though I have set up a .lang file. Maybe this could have something to do with de model not loading? Something could be wrong with the registering of the block and item. Quote
Draco18s Posted September 17, 2017 Posted September 17, 2017 On 9/17/2017 at 6:07 PM, Kombat Kitten said: Btw, the display name of the block/item is still equal to the unlocalized name, even though I have set up a .lang file. Maybe this could have something to do with de model not loading? Something could be wrong with the registering of the block and item. Expand https://github.com/KombatKitten/Collision/tree/Forums-Question/src/main/resources/assets/dimensional_magic/lang Your langfile is incorrectly named. It should be en_us.lang (all lower case). 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.
Kombat Kitten Posted September 18, 2017 Author Posted September 18, 2017 On 9/17/2017 at 5:02 PM, Choonster said: @Mod.EventBusSubscriber registers the Class with the event bus, so only static @SubscribeEvent methods will be called. Your RegistryEvent.Register handlers in CommonProxy and ClientProxy are non-static, so they will never be called. Expand I changed them to static, but it's still not working. I don't think the problem is in the java code so could you take a look at the .json files? I might have made a mistake there Quote
Kombat Kitten Posted September 18, 2017 Author Posted September 18, 2017 I redid the whole project. I didn't really change anything, but somehow it works now. Thanks for the help everyone! 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.