mojira.dev
MCPE-170091

"if block" and "unless block" don't work properly when using /execute in mcfunction files

Hi Mojang

I'm making an addon and I would like to run a command when the player walks on certain blocks. I'm using the /execute command with the new syntax, but it seems that "if" and "unless" don't work as intended : when using "if/unless block" the command will either ignore it and always run or stop working even when the conditions are matched.

It works fine with "if score" though, and i don't understand why.

My addon min engine is above 1.19.50 so the new syntax is the one to use.

I ran some tests you can find below :

1- The command should run when I'm standing in water but doesn't

2- The command should run only if i'm standig in an air block, but still works when I'm in a block of stone

 

I tried these commands directly in the game an they worked so i guess it's not the syntax...

 

I hope you will be able to help me soon, thanks !

Attachments

Comments 5

Thank you for your report!

However, this issue has been temporarily closed as Awaiting Response.

Could you please attach an example addon that showcases the issue?

This ticket will automatically reopen when you reply.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📓 Project Summary – 📧 Suggestions – 📖 Minecraft Wiki

You need to use at if you want the location of the player

You're absolutely right ! It works, my bad. Thanks a lot ! For your quick response 😃

Does this mean that the issue is resolved and the ticket can be closed?

This ticket will automatically reopen when you reply.

Seems fine to me. "if block" and "unless block" work properly when using "at @s" like tryashtar suggested, so I guess the issue resolved and you can close this ticket. Thank you !

Jean Hubert Gazon

(Unassigned)

Plausible

Windows

Windows 11

1.19.81 Hotfix

Retrieved