Jump to content

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


Recommended Posts

Posted

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!

Posted

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.

Posted
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!

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

Announcements



×
×
  • Create New...

Important Information

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