Molang

YSM Molang reference: YSM player & entity

Every Molang function and variable you can use in Yes Steve Model animations and controllers, with what it returns and the YSM version that added it. New to Molang? Start with Molang in YSM.

MolangWhat it doesSince
ysm.dump_equipped_item(slotType)Outputs equipped item info to the chat. Only works in animation debug mode.slotType options: chest feet head legs mainhand offhand1.2.0
ysm.dump_relative_block<br>(xOffset, yOffset, zOffset)Outputs info of a nearby block to the chat.Only works in animation debug mode.Centered on the player's lower body. Max value for each parameter is 8.1.2.0
ysm.dump_modsOutputs installed mods info to the chat.Only works in animation debug mode.1.2.0
ysm.dump_effectsOutputs active status effects info to the chat.Only works in animation debug mode.1.2.0
ysm.dump_biomeOutputs current biome ID and tags to the chat.Only works in animation debug mode.1.2.0
ysm.mod_version(modid)Returns the version of a specified mod installed on the client.1.2.0
ysm.equipped_enchantment<br>_level(slotType, id)Returns the level of a specified enchantment on an equipped item. In 2.5.0+, accepts multiple id arguments and returns the sum of their levels.slotType options: chest feet head legs mainhand offhand1.2.0
ysm.effect_level(id)Returns the level of a status effect on the player or arrow.In 2.5.0+, accepts multiple id arguments and returns the sum of their levels.1.2.0
ysm.relative_block_name<br>(xOffset, yOffset, zOffset)Returns the ID of a nearby block.Centered on the player's lower body. Max value for each parameter is 8.1.2.0
ysm.head_yawSame as query.head_x_rotation.1.1.5
ysm.head_pitchSame as query.head_y_rotation.1.1.5
ysm.weatherReturns the current weather.0: Clear, 1: Rain/Snow, 2: Thunder/Blizzard1.2.0
ysm.dimension_nameReturns the current dimension ID.1.2.0
ysm.fpsReturns the game FPS.1.1.5
ysm.input_verticalGets the player's forward/backward movement input.>0 when moving forward, <0 when moving backward, 0 when stationary.2.3.0
ysm.input_horizontalGets the player's left/right movement input.>0 when moving right, <0 when moving left, 0 when stationary.2.3.0
ysm.person_viewReturns the current camera perspective.First-person: 0, Third-person back: 1, Third-person front: 2. Should be compatible with Shoulder Surfing?2.3.1
ysm.is_passengerSame as query.is_riding.1.1.5
ysm.is_sleepSame as query.is_sleeping.1.1.5
ysm.is_sneakSame as query.is_sneaking.1.1.5
ysm.biome_categoryGets the category of the player's current biome.Only available in 1.16.5 and 1.18.2.1.2.0
ysm.is_open_airChecks if the player is in an open-air area.1.2.0
ysm.eye_in_waterChecks if the player's eyes are underwater (used to determine if fully submerged).2.2.1
ysm.frozen_ticksIncreases by 1 per tick when in powder snow (max 140). Decreases by 2 per tick when not, down to 0.2.2.1
ysm.air_supplyAir supply value, max 300.2.2.1
ysm.has_helmettrue if the player is wearing a helmet, otherwise false.1.1.5
ysm.has_chest_platetrue if the player is wearing a chestplate, otherwise false.1.1.5
ysm.has_leggingstrue if the player is wearing leggings, otherwise false1.1.5
ysm.has_bootstrue if the player is wearing boots, otherwise false1.1.5
ysm.has_mainhandtrue if the player is holding an item in the main hand, otherwise false1.1.5
ysm.has_offhandtrue if the player is holding an item in the off-hand, otherwise false1.1.5
ysm.has_elytraReturns true if the player is wearing an elytra, otherwise false1.1.5
ysm.is_riptidetrue if the player is in the Riptide state, otherwise false1.1.5
ysm.armor_valueReturns the player's armor value1.1.5
ysm.is_close_eyesDefaults to false, returns true when the player needs to blinkBlink interval is around 4 seconds. Also returns true when sleeping1.1.5
ysm.rendering_in_inventoryChecks if the model is rendering in a GUI (e.g., model selection screen) Returns true when rendered in these places2.2.1
ysm.rendering_in_paperdollChecks if the model is rendering in the paperdollThe paperdoll refers to the extra player preview in the top-left corner2.3.1
ysm.on_ladderBoolean, checks if the entity is on a ladder2.2.1
ysm.ladder_facingFacing direction of the ladder the entity is climbingOutputs 0-3, corresponding to: South, West, North, East2.2.1
ysm.arrow_countNumber of arrows stuck in the player2.2.1
ysm.stinger_countNumber of bee stingers stuck in the player2.2.1
ysm.texture_nameReturns the name of the texture currently used by the player (including extension)1.2.0
ysm.elytra_rot_xReturns the X rotation angle of the player's elytra1.1.5
ysm.elytra_rot_yReturns the Y rotation angle of the player's elytra1.1.5
ysm.elytra_rot_zReturns the Z rotation angle of the player's elytra1.1.5
ysm.food_levelReturns the player's food level1.1.5
ysm.first_person_mod_hidetrue when the First-person Model mod is installed and the player's head needs to be hidden, otherwise false1.1.5
ysm.has_left_shoulder_parrotChecks if a parrot is perched on the player's left shoulder2.2.1
ysm.has_right_shoulder_parrotChecks if a parrot is perched on the player's right shoulder2.2.1
ysm.left_shoulder<br>_parrot_variantReturns the variant of the parrot on the player's left shoulderVersions 1.19 and earlier do not have string-based parrot color variants, so this variable is only available in 1.20+2.2.1
ysm.right_shoulder<br>_parrot_variantReturns the variant of the parrot on the player's right shoulderVersions 1.19 and earlier do not have string-based parrot color variants, so this variable is only available in 1.20+2.2.1
ysm.attack_damagePlayer's attack damage, inherited from player attributes2.2.1
ysm.attack_speedPlayer's attack speed, inherited from player attributes2.2.1
ysm.attack_knockbackPlayer's attack knockback, inherited from player attributes2.2.1
ysm.movement_speedPlayer's base movement acceleration, inherited from player attributes2.2.1
ysm.knockback_resistancePlayer's knockback resistance, inherited from player attributes2.2.1
ysm.luckPlayer's luck value, inherited from player attributes2.2.1
ysm.block_reachPlayer's block reach distance, inherited from player attributes2.2.1
ysm.entity_reachPlayer's entity reach distance, inherited from player attributes2.2.1
ysm.swim_speedPlayer's swim speed, inherited from player attributes2.2.1
ysm.entity_gravityGravity applied to the player (falling acceleration), inherited from player attributes2.2.1
ysm.step_height_additionAdditional step height (determines the max height a player can step up without jumping and the min height preventing falling while sneaking), inherited from player attributes2.2.1
ysm.nametag_distanceRender distance of the nametag2.2.1
ysm.first_order(name, input, response)First-order system function2.3.0
ysm.second_order(name, input, frequency, coefficient, response)Second-order system function2.3.0
ysm.bone_rot(name).xGets the X-axis rotation value of the specified bone from the previous frame2.2.2
ysm.bone_rot(name).yGets the Y-axis rotation value of the specified bone from the previous frame2.2.2
ysm.bone_rot(name).zGet the Z-axis rotation of a specific bone from the previous frame2.2.2
ysm.bone_pos(name).xGet the X-axis position of a specific bone in model-relative space2.2.2
ysm.bone_pos(name).yGet the Y-axis position of a specific bone in model-relative space2.2.2
ysm.bone_pos(name).zGet the Z-axis position of a specific bone in model-relative space2.2.2
ysm.bone_scale(name).xGet the X-axis scale of a specific bone from the previous frame2.2.2
ysm.bone_scale(name).yGet the Y-axis scale of a specific bone from the previous frame2.2.2
ysm.bone_scale(name).zGet the Z-axis scale of a specific bone from the previous frame2.2.2
ysm.bone_pivot_abs(name).xGet the X-axis pivot position of a specific bone in absolute model space2.2.2
ysm.bone_pivot_abs(name).yGet the Y-axis pivot position of a specific bone in absolute model space2.2.2
ysm.bone_pivot_abs(name).zGet the Z-axis pivot position of a specific bone in absolute model space2.2.2
ysm.entity_typeReturn the type of the currently rendered entity (since rendering is no longer limited to players)Returns player or maid2.4.0
ysm.is_playerWhether the currently rendered entity is a player2.4.0
ysm.is_maidWhether the currently rendered entity is a maid2.4.0
ysm.particle('id', x, y, z, dx, dy, dz, speed, count, life_time)Spawn particles. Parameters match the vanilla particle command, with an extra life_time parameterSee official wiki: [Particle Command](https://minecraft.wiki/w/Commands/particle)2.4.0
ysm.abs_particle('id', x, y, z, dx, dy, dz, speed, count, life_time)Spawn particles. Parameters match the vanilla particle command, with an extra life_time parameterParticles spawned by this function do not rotate with the player's facing direction (spawns in absolute coordinates)2.4.0
ysm.mainhand_charged_crossbowWhether the mainhand is holding a charged crossbow2.4.0
ysm.offhand_charged_crossbowWhether the offhand is holding a charged crossbow2.4.0
ysm.is_fishingWhether the player has cast a fishing bobberAlso applies to maids2.4.0
ysm.perlin_noise(seed, x, y, z)Perlin noise function, returns a float between 0 and 1See Khan Academy's tutorial: [Perlin Noise](https://www.khanacademy.org/computing/computer-programming/programming-natural-simulations/programming-noise/a/perlin-noise)2.4.0
ysm.relative_block_name_any<br>(xOffset, yOffset, zOffset, 'blockName1', 'blockName2'...)Similar to ysm.relative_block_name, but accepts multiple block ID stringsReturns true if at least one ID matches2.5.0
ysm.in_shield_block_cooldownBoolean. Whether currently in the cooldown period after a successful shield blockCooldown lasts 5 ticks2.5.0
ysm.xxa<br/>ysm.yya<br/>ysm.zzaDirectional movement input values (forward, backward, left, right) when riding an entityForward/backward is ysm.zza Left/right is ysm.xxa Usage of ysm.yya is unknown (no value change observed during vertical movement)2.5.0
ysm.play_sound('id', 'sound_name', flags?, volume, pitch)[+new_sound]Play sound. id is the sound identifier, sound_name uses the same format as sound keyframes. flags are special bit flagsWhen set to force play, each execution stops any previously playing sound with the same ID and restarts it from the beginning.2.5.0
ysm.stop_sound('id', global?)[+new_sound]Stop sound. id is the sound identifier2.5.0
ysm.stop_all_sounds(global?)[+new_sound]Stop all sounds played via Molang2.5.0
ysm.block_lightBlock light level at the entity's feet0-152.5.0
ysm.sky_lightSky light level at the entity's feet0-15, 15 when fully exposed to the sky2.5.0
ysm.mouse(keycode) [+client]Detect mouse button stateEnter keycode: [Mouse button numbers](https://www.glfw.org/docs/latest/group__buttons.html)2.5.0
ysm.keyboard(keycode1, keycode2, ...) [+client]Detect keyboard key stateEnter keycode: [Key numbers](https://www.glfw.org/docs/latest/group__keys.html). Supports 1 or more arguments. When multiple arguments are provided, returns true if any of the keys is pressed2.5.0
ysm.time_deltaTime interval between two frames2.5.0
ysm.sync(int1, int2, ...)Actively sync data to the server. Refer to the custom functions section for details2.5.0
ysm.ground_speed2Return player speedBoth this and query.ground_speed represent character speed, but this value syncs between players on the server.Returns a slightly larger value than query.ground_speed2.5.1
ysm.hit_target_idReturn the ID of the block or entity the crosshair is pointing atReturns an empty string if pointing at nothing2.6.0
ysm.hit_target_typeReturn the target type the crosshair is pointing atReturns block for blocks Returns entity for entities Returns an empty string if pointing at nothing2.6.0
ysm.swingingBoolean. Returns true when the player is swinging their arm2.6.0
ysm.swing_timeInteger. Returns the swing tick count when the player is swinging, usually under 102.6.0
ysm.swinging_armThe swinging arm: 0 for mainhand, 1 for offhandAlways returns 0 when not swinging, so use it together with ysm.swinging2.6.0
ysm.attack_timeFloat. Attack wind-up counter between 0 and 1. Triggers the attack when it reaches 1Simply understood as a pre-attack wind-up counter2.6.0