Jump to content

Looking for help with assigning player data to the player entity!


Recommended Posts

Basically, I'm at a stage in my mod where I'd like to take a look at player data that persists upon leaving/dying and is loaded when the player joins or respawns. Only issue being that I can't find any up-to-date tutorials anywhere that help me in this particular area..


I'm hoping to implement a string data value called 'nentype' that has a randomized value from a list of strings that gets set upon joining the game for the first time, and then gets saved for future use.


Could anyone give me a run down on how I might be able to go about this, or link me a tutorial that's up to date with forge 1.12.2?


Link to comment
Share on other sites

On 3/23/2018 at 3:06 PM, That_Martin_Guy said:

Take a look at capabilities. Create one that stores a string, and set the string when the player joins.

So I took a look over at the capabilities section on the forge forum (Thanks for that by the way) but I seem to have run into an error...


    CapabilityManager.INSTANCE.register(INen.class, new NenStorage(), Nen.class);

line in my CommonProxy seems to have an error, though it's not entirely clear on how I can go about fixing it.


The error messages that come up are as follows;


Link to comment
Share on other sites

2 minutes ago, That_Martin_Guy said:

I can't really tell completely, but it looks like you're calling that outside a method, which you can't do. If it is inside of a method, post your code instead of showing the error.

Oh, I didn't think of that.


I managed to fix it by putting it within a method, thanks a bunch :)

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.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.