eatthenight Posted August 22, 2019 Share Posted August 22, 2019 so basically i have a player capability which stores abilities/skills (not items) for every player ingame (array of 20) you have a hotbar with 5 skills these are the skills in your first five slots but now i want the player to change his skills in the hotbar with a custom gui. the player should be able to interact with the gui and switch the abilities in these slots just like in a inventory BUT i guess i have to use container so the player can interact with the gui and switch the abilities... the problem is container and slots work only with items as far as i know. do i have to completely rewrite my own container and slot class etc. or does anyone have an idea how i would go about this? my idea: i have a custom class for abilities -> create slots that store a object of my ability class by getting the value from the player capability (or an empty slot if the slot in the player capability is empty) -> container add slots with the abilities -> selecting 2 slots in the container will switch position of abilities -> change player capability data -> sync with client but as you see this is rly simplified and i dont know if there is a better way to do this thanks for any help Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 22, 2019 Share Posted August 22, 2019 1 hour ago, eatthenight said: but as you see this is rly simplified and i dont know if there is a better way to do this Nope this is exactly what you want to do if you don't want to create and item(s) for your abilities. Which might honestly be more work. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
eatthenight Posted August 22, 2019 Author Share Posted August 22, 2019 2 hours ago, Animefan8888 said: Nope this is exactly what you want to do if you don't want to create and item(s) for your abilities. Which might honestly be more work. i tried to make a custom inventory via player capability which stores all the abilities but i didnt like to have all my abilities as items it worked though. maybe i should go back and make a custom inventory which stores all the abilities but honestly dont know what approach would be better though. Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 22, 2019 Share Posted August 22, 2019 1 minute ago, eatthenight said: maybe i should go back and make a custom inventory which stores all the abilities but honestly dont know what approach would be better though. Well look at it this way. To store items in an inventory you must have an ItemStack correct. Which has a lot of extra data associated with it. You will probably already have an Ability class that stores information about the abilities. So therefore the most efficient way of doing this would be to extend Container and create your own mechanics for it/them. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
eatthenight Posted August 23, 2019 Author Share Posted August 23, 2019 21 hours ago, Animefan8888 said: Well look at it this way. To store items in an inventory you must have an ItemStack correct. Which has a lot of extra data associated with it. You will probably already have an Ability class that stores information about the abilities. So therefore the most efficient way of doing this would be to extend Container and create your own mechanics for it/them. got it workin fine ^^ Quote Link to comment Share on other sites More sharing options...
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.