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

[1.15.2] Storing identification of the player that placed the block


Chris5011
 Share

Recommended Posts

So, as the title already suggests, I need some help figuring out, how I would approach to save who placed my specific block in the world. I already tried coming up with a Block with such properties, which is in the native game but couldn’t think of one.

I already tested around with some tile-entities but scrapped the code afterwards, because I couldn’t make it work.

The Mod is being implemented in Minecraft-Version 1.15.2.

 

I am glad for every piece of advice you guys can give me!

Link to comment
Share on other sites

You'd want a tile entity with a UUID field that saves to NBT. Then, override onBlockPlacedBy in your Block class, get the tile entity, cast it to your TE type after an instanceof check, and set the uuid field to the provided player's UUID.

Link to comment
Share on other sites

7 hours ago, hiotewdew said:

You'd want a tile entity with a UUID field that saves to NBT. Then, override onBlockPlacedBy in your Block class, get the tile entity, cast it to your TE type after an instanceof check, and set the uuid field to the provided player's UUID.

I now got it working this way, thank you very much for the help!

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.