#Teleportation like an Endermen

1 messages · Page 1 of 1 (latest)

clear compass
#

How can I create a function that randomly teleports entities to the safe place (not inside blocks), similar to an enderman?
"/spreadplayer" teleports everything to the surface level, but I want it to work correctly underground and in the Nether.

I have a couple ideas, but I think they pretty bad optimized.

Has anyone already done it? I don't want to reinvent the wheel if someone has already done it, and done it better.

scenic mango
#

Spread players has a max height argument.

I don't know why you think it must be the surface

#

You can use a macro to make this max height some value that is close to the current height of the player.

scenic mango
#

A function file with string interpolation.

Probably best if you read some guide/tutorial on the subject.

#

The true enderman/chorus fruit teleportation can't be mimicked easily with commands.

You can make any consumable teleport you randomly like a chorus fruit does however.

clear compass
scenic mango
#

short example of a macro:

execute store result score #max_height var run data get entity @s Pos[1]
# add a little to the max height score
scoreboard players #max_height var add 10
# save score to storage so we can use it in a macro
execute store result storage ns:example max_height int 1 run scoreboard players get #max_height var
# call macro
function ns:macro with storage ns:example```

Macro function:
```$say $(max_height)```
-# I am on mobile and rarely use spread players so I avoid making obvious typos and syntax errors in this macro
clear compass