#Cross-world non-player entity teleportation

1 messages · Page 1 of 1 (latest)

granite chasm
little crown
#

BlockPosition is double, double, double

#

not int

#

you can teleport as precise as you want

granite chasm
#

isn't it a BaseBlockPosition?

little crown
#

ah I see what you mean java public BaseBlockPosition(double d0, double d1, double d2) { this(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); }

granite chasm
#

yes, it actually happens in game if i try

#

it gets teleported to that corner and can sometimes suffocate if there's a wall near it

#

hmmm... what if i do the teleportation two times in a row?

little crown
#

in which case you'd have to adjust the posityion after

#

odd though

granite chasm
#

will the 2nd teleportation be considered in the same world?

#

two teleports in the same tick

little crown
#

after teh first it shoudl but you'd have to delay 1 tick

granite chasm
#

i wonder if they'll take 1 point of suffocation damage in that very tick

little crown
#

would have to try it an dsee

#

wierd that you can;t precise teleport across worlds

granite chasm
#

should i open a ticket on jira? this doesnt seem intended, idk

little crown
#

I would. At least you'd get an explanation.

#

same world it uses absMoveTo

granite chasm
#

doesnt take any damage at all

#

thankfully

little crown
#

nice

#

I looked at teh code, it uses Minecrafts teleportTo method for cross world which takes a BlockPosition

#

in the same workd is a move abs call so not a teleport

granite chasm
#

hmm, then CraftPlayer must do something similar to teleporting twice then

#

or not use teleportTo

little crown
#

I don't think so. I've never actually tried setting a world spawn to a non BlockPosition

granite chasm
#

well, something must happen to teleport the player precisely to the intended coordinates

little crown
#

oh yes it does

#

if its a different world it calls teleportTo first (Minecraft method), then it uses teh move abs call

#

if its same world it only uses teh move abs method

granite chasm
little crown
#

so the teleportTo is just to switch worlds, then it moves teh Entity to the correct location

#

well its good to know for the future.