Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

interactable gui like an inventory but not for items [1.12.2]


eatthenight
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

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

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.

Link to comment
Share on other sites

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.

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

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 ^^

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.