Common Molang Snippets and Tricks for YSM Models
Molang expressions let your Yes Steve Model (YSM) react dynamically to in-game player states without complex keyframe animations. This guide covers ready-to-use Molang snippets for Blockbench debugging, armor-based outfit toggling, eye tracking, automatic blinking, and glowing bone groups.
Testing Molang in Blockbench with Variable Placeholders
Testing your Molang expressions directly inside Minecraft takes a lot of time. Blockbench includes a Variable Placeholders panel that lets you create interactive sliders and toggle buttons to preview YSM queries right in the animation editor.
Using slider('Label') creates a numeric slider for continuous values like speed or camera angles, while toggle('Label') creates an on/off switch for boolean states like wearing armor or blinking.
Paste the following preset list into your Blockbench Variable Placeholders box to quickly simulate common YSM and Minecraft queries:
query.ground_speed = slider('Ground Speed')
query.vertical_speed = slider('Vertical Speed')
ysm.head_yaw = slider('Head Yaw (Left/Right)')
ysm.head_pitch = slider('Head Pitch (Up/Down)')
query.health = slider('Current Health')
query.max_health = slider('Max Health')
ysm.food_level = slider('Food Level')
query.player_level = slider('Player Level')
query.time_of_day = slider('Time of Day')
query.moon_phase = slider('Moon Phase')
ysm.armor_value = slider('Armor Value')
query.distance_from_camera = slider('Camera Distance')
ysm.has_chest_plate = toggle('Chestplate')
ysm.has_leggings = toggle('Leggings')
ysm.has_helmet = toggle('Helmet')
ysm.has_boots = toggle('Boots')
ysm.has_elytra = toggle('Elytra')
ysm.is_close_eyes = toggle('Close Eyes / Blink')
ysm.has_mainhand = toggle('Mainhand Item')
ysm.has_offhand = toggle('Offhand Item')
query.is_on_fire = toggle('On Fire')
query.is_in_water_or_rain = toggle('In Water or Rain')
query.is_spectator = toggle('Spectator Mode')
query.is_first_person = toggle('First Person')
query.is_jumping = toggle('Jumping')
query.is_on_ground = toggle('On Ground')Outfit Switching via Armor Slots
A popular feature in YSM models is changing clothes or showing custom armor pieces when the player equips armor in-game. You can toggle clothing visibility by binding a bone's Scale keyframe to YSM armor queries inside a parallel animation.
When the player equips an armor piece, the query returns 1 (normal size). When unequipped, it returns 0 (shrunk to invisibility). Apply these queries to all three Scale axes (X, Y, Z) of your clothing or armor bone group:
- Create or open a
parallelanimation so the check runs continuously alongside movement animations. - Select your clothing or armor bone group and add a Scale keyframe at timestamp 0.0.
- Enter the corresponding slot query into the X, Y, and Z scale fields.
ysm.has_helmet
ysm.has_chest_plate
ysm.has_leggings
ysm.has_boots!ysm.has_chest_plate.Automatic Blinking
Animating eye blinks manually across dozens of animations is tedious. YSM provides the ysm.is_close_eyes query, which automatically triggers a blink state roughly once every 4 seconds.
By placing this logic in a pre_parallel animation, your character will blink naturally during idle, walking, and other standard animations without extra work. You can scale the open-eye mesh down to zero while simultaneously shifting the eyelid or eyebrow bone slightly downward.
- Open your
pre_parallelanimation. - For the Eyes bone: add a Scale keyframe and set X, Y, and Z to
ysm.is_close_eyes ? 0 : 1. - For the Eyebrows (or upper eyelid) bone: add a Position keyframe to lower it by 1 unit during a blink.
// Eye Bone - Scale (X, Y, Z)
ysm.is_close_eyes ? 0 : 1
// Eyebrow Bone - Position (X, Y, Z)
X: 0
Y: ysm.is_close_eyes ? -1 : 0
Z: 0Eye Tracking (Pupil Follow)
By default, the entire head bone rotates with the player's camera. You can make your model look much more alive by having the pupils subtly shift toward the player's view direction using a parallel animation.
This works by dividing ysm.head_yaw and ysm.head_pitch so the pupils move a fraction of a pixel across the surface of the eye as the head turns.
// Animation: parallel | Bone: Pupils | Keyframe: Position
X: ysm.head_yaw/180
Y: ysm.head_pitch/360
Z: 0Head Rotation Locking
During certain special or cinematic animations (like emotes or sitting poses), automatic camera-based head rotation can ruin the pose and cause severe neck clipping. You can counteract the game's camera rotation and lock the head in place by applying the player's pitch and clamped yaw directly to the head's Rotation keyframe.
Add a Rotation keyframe to the Head bone inside your special animation and use the following values:
// Animation: Special / Emote | Bone: Head | Keyframe: Rotation
X: ysm.head_pitch
Y: math.clamp(ysm.head_yaw,-60,60)
Z: 0Emissive / Glowing Bone Groups
You do not even need a Molang expression to make parts of your model glow in the dark. Adding the prefix ysmGlow to any bone group name in Blockbench makes all cubes inside that group render at full brightness (emissive).
For example, naming a bone group ysmGlowEyes or ysmGlowHalo will make those elements glow in dark caves or at night.
ysmGlow prefix is strictly case-sensitive—make sure the capital 'G' matches exactly.Questions
What is the difference between `pre_parallel` and `parallel` animations for Molang?
pre_parallel runs before standard animations (great for base states like automatic blinking that other animations might want to override), while parallel runs alongside everything to continuously layer effects like armor toggling or pupil tracking.
Why isn't my `ysmGlow` bone glowing in-game?
Check the capitalization of the bone group name in Blockbench. It must start with ysmGlow (lowercase 'ysm', uppercase 'G'). Also ensure the glowing cubes are actually placed inside that bone group.
How do I preview `ysm.has_chest_plate` or `ysm.is_close_eyes` in Blockbench?
Open the Variable Placeholders panel in Blockbench's animation tab and paste ysm.has_chest_plate = toggle('Chestplate'). A checkbox button will appear that lets you toggle the variable between 0 and 1 while previewing your animation.