Solved "Refresh" An entity for a player.

Discussion in 'Plugin Development' started by Lightspeed, Apr 14, 2016.

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

    Lightspeed

    I would like to know any way to simply refresh a entity for a player to updates it's rotation.

    If you did not know item frames are wierd and don't face the right direction at first until you reload the chunk.

    I need anyway to send a packet or anything to refresh any Entity object for a player.

    Things I've tried:

    Code:
    //Loop to unload chunk(I already deleted code)
    
    enLoc.getChunk().unload(true, false);
    enLoc.getChunk().load();
    The both don't work nor would I like to use them as I JUST want to refresh the entity.

    Ideas: Somehow spawning an entity with a nbt tag that I choose.
    Removing then Adding the entity(Is there a packet for all entities types?) packets
    Thats all the ideas I got. '-'
     
  2. Offline

    mcdorli

    Quote from the minecraft wiki's entity nbt list:

    It's pretty straight forward in my opinion.
     
  3. Offline

    Lightspeed

    Before everyone hates me(I know you will a bit) I get great ideas when I ask a question on bukkit.
    Whenever I ask a question I get amazing ideas and they seem to work.
    I'm very sorry for that. ^

    So here we go. . .

    Code:
    CraftWorld cw = ((CraftWorld)loc);
    Entity en cw.createEntity(loc, EntityType.ITEM_FRAME);
    //Set nbt and everything else
    cw.addEntity(ce, SpawnReason.CUSTOM);
    This should allow anyone to create an entity and expect it to do exactly what you want without ANY need for updates.

    @mcdorli Also that wouldn't work as great as I would have to check the entity type first right?
     
  4. Offline

    mcdorli

    No, you need to set an nbt tag for the spawned entity.
     
Thread Status:
Not open for further replies.

Share This Page