Jump to content

"Binding" entity


Flemmli97

Recommended Posts

So i have an entity, which when spawned a special way is "binded" to the player. Like a pet but the player can only have one of it. I save the reference to that entity in an capability and then i can manipulate that entity in various ways. That works fine.

The issue i have is with saving/loading. I currently save the entitys uuid and then during load search for that uuid. if found i then sets the players data to that entity. however of course if the entity is in an unloaded chunk during the nbt read progress it wont find it and so fails to "rebind" that entity to the player. 

I also do the same progress from the entity side (save player uuid and search for player) so then when the entity loads it does get rebind to the player.

however during the time when the entity is unloaded the data in the capability is of course null so i cant do anything to the entity.

is there ways to manipulate unloaded entitys (like tp them to you)? is it smart to save the chunk, the entity is saved and temporarily load that chunk to do stuff?

Link to comment
Share on other sites

11 minutes ago, Flemmli97 said:

in theory i should be able to edit the players data file when the entity is saved to disk. that way i can save the chunk, where the entity is saved even after the player is gone

It would probably be better to save this to the World instead of to the Player. And just map it to the players uuid.

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

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.