I can give a player a status effect when they enter a certain area and remove it when they leave no problem, but when I try to do the same thing with the game mode, nothing happens. In my mind these are the same thing. I can get the game mode to change for everyone or one person when I flip a switch, but not in a certain area. See below. I’m running Forge for 1.16.4 and putting these commands in Repeating Command Blocks buried in the ground, in the area they affect.
Why does this NOT work:
execute if entity @p[x=94,y=50,z=85,dx=26,dy=33,dz=27] run gamemode adventure @p
When this does?
execute if entity @p[x=10020,y=80,z=10142,dx=30,dy=20,dz=43] run effect give @p minecraft:jump_boost 1 10 true
So much for minecraft’s “autofill guided prompts” which says it’s valid in like 10 different iterations, but then it just doesn’t do anything. It prompted me to put the @p
at the end but I don't know why it's there and it won't let me add any target selector arguments to it, which makes me feel it's superfluous. I've tried adding:
as @p
and
at @p
to the front, and back, and still nothing. What am I missing or putting too much of?
I have been testing that command and works perfectly fine. There is only one problem, the area of effect is inverted for the destination cords (I don't really know why). Try inverting destination cords, like this:
execute if entity @p[x=94,y=50,z=85,dx=-26,dy=33,dz=-27] run gamemode adventure @p