#Saving Data to Vanila Blocks

6 messages · Page 1 of 1 (latest)

small pendant
#

I need some way to save a certain data on the vanilla bed (like last slept player UUID). Currently I try to write NBT to a BedBlockEntity via mixin of BedBlock injecting into onUse method.

Unfortunately, it works only once per session, since relogging into the game rather deletes the bed with no warnings/errors in the runtime log, or leaves non rendered block, without a block entity.

So, what might be the cause of relogging issue and why just writing NBT to a vanilla block entity doesn't work? Is there is a better way to do it than mixining BedBlockEntity?

Thank you very much!

austere mango
#

You should consider a data attachment

small pendant
#

Well, I try to write NBT to default BedBlockEntity, so is blockEntity a type of Data Attachment?

Even though, it seams that I have figured it out, issue was that for some reason I decided to add read/writeNBT in the BedBlockEntity, which tried to write an UUID from variable which was never declared. So scrapping down this entire mixin fixed it :D.

Thank you for your help!

median shoal
small pendant
median shoal