Solved Can't teleport entities right after you spawn it

Discussion in 'Plugin Development' started by Lupus_Z, Dec 15, 2016.

Thread Status:
Not open for further replies.
  1. For the same reason of the bug that I mentioned in my last thread, I'm spawning an entity (Ghast), give him invisibility and then teleporting it. But it's just not working, the entity will not teleport. This will not happen if you wait 1 tick using the bukkit's Scheduler. So... my question is: why is this happening?
     
  2. Offline

    Zombie_Striker

    @Lupus_Z
    Well, you can't teleport the entity the same tick it is created because it does not 'really' exist yet. You have to wait a tick before the entity spawn event is triggered and the packet is even sent. You will have to wait at least 1 tick before you can use the teleport method.
     
  3. @Lupus_Z Just out of interest, why would you need to teleport it as soon as it spawns?
     
  4. Offline

    Lordloss

    Why dont you spawn it at the position where you would teleport it to?
     
  5. @Lordloss look at the sentence I wrote at the beginning of this thread
    If I spawn an entity, and then I give him invisibility, I can see it for something like 1 tick. This problem affects me because I'm spawning invis. entities every tick.
     
Thread Status:
Not open for further replies.

Share This Page