NolValue Posted May 27, 2018 Posted May 27, 2018 So, I've been looking around at various old forum posts and such after being unable to figure this out myself, aside from some github sources which implement their own capability system instead of using forge's which is way too much effort for me to do. I'm going to go ahead and ask this: What's the easiest way to implement a multiple capability system, IE Stats (Strength, Constitution, Dexterity, etc. . .) with each stat containing a value. Also, how would one inject it? The new capability system is way messier than IEEP for me to figure out. Other things I need to be able to do is read, set, and add to the stats. That's really it. I've been trying for the past 3 days to get a working code and was unable to. I don't need you to code the full thing out, just some pointers for what I need to do, seeing as the Forge Documentation is very limited in what it tells you. Quote
Cadiboo Posted May 27, 2018 Posted May 27, 2018 (edited) On 5/27/2018 at 5:22 AM, NolValue said: So, I've been looking around at various old forum posts and such after being unable to figure this out myself, aside from some github sources which implement their own capability system instead of using forge's which is way too much effort for me to do. I'm going to go ahead and ask this: What's the easiest way to implement a multiple capability system, IE Stats (Strength, Constitution, Dexterity, etc. . .) with each stat containing a value. Also, how would one inject it? The new capability system is way messier than IEEP for me to figure out. Other things I need to be able to do is read, set, and add to the stats. That's really it. I've been trying for the past 3 days to get a working code and was unable to. I don't need you to code the full thing out, just some pointers for what I need to do, seeing as the Forge Documentation is very limited in what it tells you. Expand Are you sure you need multiple capabilities? why not just one capability with all those values in it? What are you using your capability on? If your using Items/ItemStacks have a look at this code in my mod where I implement both the Energy Capability and my own Weapon Modules capability on my Item/ItemStack ItemGun This code is probably very messy and bad, but it was based on code written by one of Actually Additions authors, so I doubt its that horrible. Edited May 27, 2018 by Cadiboo Quote About Me Reveal hidden contents My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
NolValue Posted May 27, 2018 Author Posted May 27, 2018 (edited) On 5/27/2018 at 5:59 AM, Cadiboo said: Are you sure you need multiple capabilities? why not just one capability with all those values in it? What are you using your capability on? If your using Items/ItemStacks have a look at this code in my mod where I implement both the Energy Capability and my own Weapon Modules capability on my Item/ItemStack ItemGun Expand Well, I am attempting to use it on players, however I can still probably use your code to figure out how to do it for a player. Also I do want 1 capability with multiple values, sorry for wording it so poorly. Edited May 27, 2018 by NolValue Quote
Cadiboo Posted May 27, 2018 Posted May 27, 2018 On 5/27/2018 at 6:04 AM, NolValue said: Well, I am attempting to use it on players, however I can still probably use your code to figure out how to do it for a player. Expand This might be a good post to take a look at, and its relatively recent. http://www.minecraftforge.net/forum/topic/63654-capabilities/ Quote About Me Reveal hidden contents My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
NolValue Posted May 27, 2018 Author Posted May 27, 2018 On 5/27/2018 at 6:06 AM, Cadiboo said: This might be a good post to take a look at, and its relatively recent. http://www.minecraftforge.net/forum/topic/63654-capabilities/ Expand I actually have been through that post, several times actually. It uses an outdated method for Capabilities which is completely deprecated, otherwise, I would be using that. Quote
NolValue Posted May 27, 2018 Author Posted May 27, 2018 Well, it seems that the new system is far too big of a mess for me to even to begin to attempt to use, so I'm just gonna go ahead and drop modding once again. So thread closed I guess or whatever. Quote
Cadiboo Posted May 27, 2018 Posted May 27, 2018 On 5/27/2018 at 6:25 AM, NolValue said: Well, it seems that the new system is far too big of a mess for me to even to begin to attempt to use, so I'm just gonna go ahead and drop modding once again. So thread closed I guess or whatever. Expand They are hard, but once your heads round them they Just Work (aside from syncing) On 5/27/2018 at 6:16 AM, NolValue said: I actually have been through that post, several times actually. It uses an outdated method for Capabilities which is completely deprecated, otherwise, I would be using that. Expand What method is "completely deprecated"??? Quote About Me Reveal hidden contents My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
Draco18s Posted May 27, 2018 Posted May 27, 2018 Here, take a look at these three classes: https://github.com/Draco18s/ReasonableRealism/tree/1.12.1/src/main/java/com/draco18s/hardlib/api/capability The interface is here: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/api/interfaces/IMechanicalPower.java 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.
jabelar Posted May 27, 2018 Posted May 27, 2018 On 5/27/2018 at 6:25 AM, NolValue said: Well, it seems that the new system is far too big of a mess for me to even to begin to attempt to use, so I'm just gonna go ahead and drop modding once again. So thread closed I guess or whatever. Expand Capabilties are not a "mess" at all. They work quite well. They aren't really that complicated either. You just attach the capability to anything which is a capability provider and define the types of field you want it to contain. Regarding any deprecated methods you might encounter. Deprecated methods can firstly usually still be used, they are just not the best way. Secondly they are often commented with a note that tells you what the replacement method is. Lastly, you can use your IDE to look at he type hiearchy (or "structure") of the class to see a list of available methods and it is usually quite obvious what the new one might be -- often they are named the same but just have a different parameter list prototype. Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
NolValue Posted May 27, 2018 Author Posted May 27, 2018 On 5/27/2018 at 3:23 PM, jabelar said: Capabilties are not a "mess" at all. They work quite well. They aren't really that complicated either. You just attach the capability to anything which is a capability provider and define the types of field you want it to contain. Regarding any deprecated methods you might encounter. Deprecated methods can firstly usually still be used, they are just not the best way. Secondly they are often commented with a note that tells you what the replacement method is. Lastly, you can use your IDE to look at he type hiearchy (or "structure") of the class to see a list of available methods and it is usually quite obvious what the new one might be -- often they are named the same but just have a different parameter list prototype. Expand 6 Well, for someone like me who hasn't touched modding since all the way back in 1.7.10, it's been a huge pain in the butt to learn the capability system. You telling me the old method is still usable is nice, as I had no idea what the hell a factory was, haha. Anyways, I'm assuming what I need to do is to have an ENUM with the stats I need, then use an NBT compound to put the ENUM and the Stat's value into the Player, correct? Quote
Cadiboo Posted May 27, 2018 Posted May 27, 2018 On 5/27/2018 at 4:25 PM, NolValue said: Well, for someone like me who hasn't touched modding since all the way back in 1.7.10, it's been a huge pain in the butt to learn the capability system. You telling me the old method is still usable is nice, as I had no idea what the hell a factory was, haha. Anyways, I'm assuming what I need to do is to have an ENUM with the stats I need, then use an NBT compound to put the ENUM and the Stat's value into the Player, correct? Expand It doesn’t have to be an enum, it can be almost anything, however the most common things that are used are booleans, enum and integers. Remember you are going to have to be syncing your capability a lot, so yes enums are probably the best choice Quote About Me Reveal hidden contents My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
Draco18s Posted May 27, 2018 Posted May 27, 2018 (edited) On 5/27/2018 at 4:25 PM, NolValue said: You telling me the old method is still usable is nice, as I had no idea what the hell a factory was, haha. Expand A factory is a class that creates instances of another class. (What is a hammer factory? Why, its a building that builds hammers...) https://en.wikipedia.org/wiki/Factory_method_pattern Edited May 27, 2018 by Draco18s 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.
Daeruin Posted May 27, 2018 Posted May 27, 2018 I found capabilities very confusing at first, too. The Forge documentation didn't help me at all until I was already thoroughly familiar with capabilities. Try this tutorial. https://www.planetminecraft.com/blog/forge-tutorial-capability-system/ It will get you started with a single stat called Mana, but you can obviously extend that to anything you want. 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.