Skip to content

fix(experimental/particle_trail): toggle always resolved to on - #34

Merged
tickwarden merged 1 commit into
mainfrom
fix/experimental-particle-trail-toggle
Aug 19, 2026
Merged

fix(experimental/particle_trail): toggle always resolved to on#34
tickwarden merged 1 commit into
mainfrom
fix/experimental-particle-trail-toggle

Conversation

@IronCrest-sudo

@IronCrest-sudo IronCrest-sudo commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Problem

experimental/particle_trail/toggle.mcfunction was always getting stuck in the "on" state instead of actually toggling (reported on 1.21.2).

Root Cause

execute if entity @s[tag=...trail] run tag @s remove ...trail
execute if entity @s[tag=...trail] run return 0        <- this is ALWAYS false because the tag was just removed
execute unless entity @s[tag=...trail] run tag @s add ...trail

The tag is removed on the first line. The second line checks the same condition again, but since the tag no longer exists, the if condition can never match. Therefore, the early return 0 never executes, and execution falls through to the third line, which immediately adds the tag back.

Net effect: the trail always ends up "on" after every invocation.

Solution

The tag is now tested once before any mutation and the logic is split into two completely separate branches (toggle_on / toggle_off helper functions). return run function ... ensures that the second branch can never execute after the first branch has been triggered.

Test Status

A real server.jar test could not be performed in this environment (network access is disabled). Only static validation was performed: file paths, balanced parentheses/quotes, and manual step-by-step simulation of the logic. It still needs to be tested on a real 1.21.2 server.

Note: The GitHub token used to create this PR was exposed during this task. It is recommended to revoke the token once the operation is complete.

The toggle logic removed the tag first, then re-checked
'if entity @s[tag=...trail]' — which was now always false since the
tag had just been removed on the previous line — so the early
'return 0' never fired and execution fell through to the 'add' line,
re-adding the tag on every call. Net effect: toggle never actually
turned the trail off.

Split into toggle_on/toggle_off helpers and use 'execute ... run
return run function ...' so the tag is tested exactly once and the
two branches are truly mutually exclusive.
@tickwarden
tickwarden merged commit 21d1b6d into main Aug 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants