Solved Respawning Mobs from Stored UUID's?

Discussion in 'Plugin Development' started by ipodtouch0218, Nov 5, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    ipodtouch0218

    I've had the idea to create a golden lasso (from mods) into MC using Slimefun (to manage it etc, not important).
    Anyway, I was wondering if I can store the UUID of the mob inside of the lore, to have it respawned with the same UUID, data, etc.

    I didn't see anything with Bukkit or Spigot methods (maybe I missed it), but maybe there's a NMS solution to this.

    EDIT: If not, what important things would I have to store in the lore to be able to re-create the mob perfectly? EntityType, Health, etc.
     
  2. Offline

    Zombie_Striker

  3. Offline

    ipodtouch0218

    @Zombie_Striker
    I didn't explain the golden lasso's function, did I? When you right-click on an LivingEntity, the entity gets killed, and all it's data is inside the lasso. Then, clicking again, will respawn the entity in the new location like nothing ever happened, same stats as the last time.

    I wanted to know if I can use just the UUID to respawn the entity and it will keep all it's data from the server remembering it, or I will have to store all the data separately inside the Lasso's lore.

    I'm using lores to store the entity's UUID so I can manually restore them with commands if something happens to a player's inventory.
     
  4. Offline

    Zombie_Striker

    @ipodtouch0218
    In that case, you will need to devise your own way of storing all the data. The easiest way to do this would be to clone the entity's meta data and either A)Store all the data tags inside the item or B) Store the list in a Map, where the keys are the entity's UUID and the value is all the metadata. Either way, when re-creating the entity, just set the new entity's metadata equal to the stored metadata.
     
    ipodtouch0218 likes this.
  5. Offline

    ipodtouch0218

Thread Status:
Not open for further replies.

Share This Page