Started by
gorgin
on
Topic category: Troubleshooting, bugs, and solutions
I am testing if the block at x, y, z has a certain amount of energy. Nothing happens, but if I remove the testing for if the block at x, y, z has enough energy it works.
Edit:
It works if you are in the block, so I think it is testing your x, y, z
SOLUTION:
Set local number variables for x, y, and z with the blocks:
"Look X position of Event/TargetEntity with raytrace distance 5 fluid mode None block mode Outline"
"Look Y position..."
"Look Z position... "
respectively
replace all x, y, and z blocks with the local variables
Though if you move after you've opened the gui it won't work, but most of the time you shouldn't have moved so it should be fine.
Edited by gorgin on Wed, 06/26/2024 - 22:30
could you clarify what is triggering the procedure? sometimes just xyz blocks don't work, so please clarify
the "While this GUI is open tick" of the block's gui
I see the raytracing solution. As OP has said, the player might move after the gui is opened, which might cause problems with that solution. What you can do is store the block's coordinates in the player's scoreboard in a procedure where the x, y, and z are still accurate, such as in the procedure for the trigger "when block is right clicked". And then, in the GUI code, use the ones stored on the scoreboard rather than the ones passed to the GUI procedure.
I think the reason why the GUI values are incorrect is because it gets the x, y, and z from a "extraData" buffer instead of just taking them in as parameters for some reason: