mojira.dev
MC-117747

Setblock command does not work with gameLoopfunction

I try to run a Setblock command using a function with this code

setblock ~ ~-1 ~ minecraft:cobblestone
#say hi

and then do this:

/gamerule gameLoopfunction example:example

And nothing happens. It works when run manually.

Attachments

Comments 3

Do not use relative coordinates in functions, which will be run by gameLoopfunction. If you use this gamerule, the function will be executed by the server, not by the executor of the gamerule command. And because the server has no coordinates, relative coordinates will not work. If you want to make this loop working, you have to use execute command.

execute @a ~ ~ ~ /setblock ~ ~-1 ~ minecraft:cobblestone
#say hi

This should work OK

Actually, the gamerule's origin coordinates are 0 0 0.

Makes it still invalid as the block gets attempted to be placed in the void... oopie 😃

Qwerty_101

(Unassigned)

Unconfirmed

Minecraft 1.12 Pre-Release 5

Retrieved