Wiki 9Minecraft Wiki 9Minecraft

How to Program Conditional Entity Targeting and Debug Spells

Instead of casting fixed effects, you can program spells that inspect nearby targets and react on the fly. By combining entity queries with conditional branches, your RG Alloy Wand can adapt to a target's health, armor, or movement.

Checking Target Stats with Conditional Spells

1. Compare the result against Spell: Get Caster Entity with Spell: Not Equal so your spell ignores you.

2. Query stats using Spell: Get Entity Health, Spell: Get Entity Max Health, or Spell: Get Entity Armor, or read movement data with Spell: Get Entity Position and Spell: Get Entity Velocity.

3. Build your test with Spell: Greater Than, Spell: Less Than, or Spell: Equal. Group multi-part checks inside Spell: Left Paren and Spell: Right Paren alongside Spell: And, Spell: Or, or Spell: Condition Inverter.

4. Place Spell: If to open the branch, insert your payload—such as Spell: Apply Potion, Spell: Explosion, or Spell: Teleport—and close the block with Spell: If Branch End.

Saving Data and Debugging Spell Logic

When complex chains misbehave, use storage and debug parts to track values across expressions:

  • Reuse Values: Save a target, vector, or number with Spell: Set Storage and recall it later using Spell: Get Storage, separating distinct operations with Spell: Expression Separator.
  • Print Live Data: Drop Spell: Debug Print after calculations or entity checks to inspect what your Spell Entity reads mid-cast before attaching expensive effects, and cap finished branches with Spell: End Spell.