Server MoLang Reference
Server MoLang Reference
Section titled “Server MoLang Reference”Titan extends Cobblemon’s MoLang with server-side execution through the server_molang keyframe type. This enables powerful scripting within ActionEffect timelines.
Server MoLang Keyframe
Section titled “Server MoLang Keyframe”Type: server_molang
Structure
Section titled “Structure”{ "type": "server_molang", "expressions": [ "q.play_sound('minecraft:entity.lightning_bolt.thunder', 2.0, 1.0);", "t.pos = q.position(0);", "q.particle_effect('cobblemon:thunder_actorcloud', t.pos, 200, 8.0);" ]}Key Changes from Old Format:
- ✅
expressions(array) - NEW format - ❌
expression(string) - OLD format (deprecated)
Namespaces
Section titled “Namespaces”q.* - Query Functions
Section titled “q.* - Query Functions”Global queries and utilities.
q.position(0)q.play_sound('minecraft:entity.generic.explode', 1.0, 1.0)q.particle_effect('cobblemon:flame_burst', q.position(0), 100, 3.0)q.titan.* - Titan-Specific Functions
Section titled “q.titan.* - Titan-Specific Functions”Functions that operate on the Titan or apply titan-specific effects.
q.titan.apply_potion('minecraft:speed', 100, 1)q.titan.apply_burn(5.0)q.titan.apply_wither(3.0)q.entity.* - Entity Conditions
Section titled “q.entity.* - Entity Conditions”Query properties about entities in context.
q.entity.is_user // true if entity is the titan, false if targett.* - Temporary Variables
Section titled “t.* - Temporary Variables”Store intermediate values for reuse.
t.pos = q.position(0);q.particle_effect('cobblemon:thunder_actorcloud', t.pos, 200, 8.0);Core Query Functions
Section titled “Core Query Functions”Position & Coordinates
Section titled “Position & Coordinates”q.position(component)
Section titled “q.position(component)”Returns entity position as array or individual component.
Parameters:
component(Number): 0 = [x,y,z] array, 1 = x, 2 = y, 3 = z
Returns: Vec3 array or Number
Examples:
// Get full positiont.pos = q.position(0); // [x, y, z]
// Get individual coordinatest.x = q.position(1);t.y = q.position(2);t.z = q.position(3);
// Use in expressionsq.particle_effect('minecraft:flame', q.position(0) + [0, 1.5, 0], 50, 2.0);Damage Functions
Section titled “Damage Functions”q.damage_all(amount)
Section titled “q.damage_all(amount)”Damages all entities registered in the current damage context (from OBB).
Parameters:
amount(Number): Damage to apply
Returns: Void
Examples:
// Fixed damageq.damage_all(45.0);
// Use move damageq.damage_all(q.move_damage);
// Combined with soundq.play_sound('minecraft:entity.generic.explode', 2.0, 0.8);q.damage_all(100.0);Usage Context:
{ "type": "damage_obb", "obbName": "slash_1", "damage": "50", "expressions": [ "q.damage_all(50.0);" ]}q.move_damage
Section titled “q.move_damage”References the damage value configured in the move’s JSON.
Type: Query Variable Returns: Number
Examples:
// Use configured move damageq.damage_all(q.move_damage);Move Config:
{ "armor_oblivion": { "damage": "120.0", // ← Referenced by q.move_damage "actionEffect": "titan:ceruledge_armor_oblivion" }}ActionEffect:
{ "type": "damage_obb", "obbName": "oblivion_sphere", "damage": "q.move_damage", // ← Uses move config value "expressions": [ "q.damage_all(q.move_damage);" // ← Same value ]}q.fling_all_up(power)
Section titled “q.fling_all_up(power)”Launches all registered entities upward.
Parameters:
power(Number): Upward velocity (1.0 = ~5 blocks, 2.0 = ~10 blocks)
Returns: Void
Examples:
// Light knockupq.fling_all_up(1.0);
// Heavy knockupq.fling_all_up(2.4);
// Combined with damageq.damage_all(80.0);q.fling_all_up(1.8);q.hurt_cone(length, radius, damage)
Section titled “q.hurt_cone(length, radius, damage)”DEPRECATED - Use OBB system instead.
Damages entities in a forward cone.
Parameters:
length(Number): Cone length in blocksradius(Number): Cone base radiusdamage(Number): Damage amount
q.hurt_sphere(radius, damage)
Section titled “q.hurt_sphere(radius, damage)”DEPRECATED - Use OBB system instead.
Damages entities in a sphere.
Parameters:
radius(Number): Sphere radius in blocksdamage(Number): Damage amount
Titan Functions
Section titled “Titan Functions”All titan-specific functions use the q.titan.* namespace.
Status Effects
Section titled “Status Effects”q.titan.apply_potion(effect, duration, amplifier)
Section titled “q.titan.apply_potion(effect, duration, amplifier)”Applies a potion effect to the Titan.
Parameters:
effect(String): Potion effect ID (e.g.,'minecraft:speed')duration(Number): Duration in ticks (20 = 1 second)amplifier(Number): Effect level (0 = I, 1 = II, etc.)
Returns: Void
Examples:
// Speed II for 5 secondsq.titan.apply_potion('minecraft:speed', 100, 1);
// Glowing for 5 secondsq.titan.apply_potion('minecraft:glowing', 100, 0);
// Permanent effect (phase duration)q.titan.apply_potion('minecraft:speed', 999999, 0);
// Multiple effectsq.titan.apply_potion('minecraft:speed', 999999, 2);q.titan.apply_potion('minecraft:strength', 999999, 1);q.titan.apply_potion('minecraft:resistance', 999999, 1);Common Effects:
minecraft:speed- Movement speedminecraft:strength- Attack damageminecraft:resistance- Damage reductionminecraft:regeneration- Health regenminecraft:glowing- Outline effectminecraft:haste- Attack speed
Usage: Phase enter scripts, move buffs
q.titan.remove_potion(effect)
Section titled “q.titan.remove_potion(effect)”Removes a potion effect from the Titan.
Parameters:
effect(String): Potion effect ID
Returns: Void
Examples:
// Remove speed on phase exitq.titan.remove_potion('minecraft:speed');
// Remove multiple effectsq.titan.remove_potion('minecraft:speed');q.titan.remove_potion('minecraft:strength');Usage: Phase exit scripts
q.titan.apply_burn(duration)
Section titled “q.titan.apply_burn(duration)”Applies burn/fire damage to all registered targets.
Parameters:
duration(Number): Burn duration in seconds
Returns: Void
Examples:
// 3 second burnq.titan.apply_burn(3.0);
// 5 second burn with flingq.damage_all(q.move_damage);q.fling_all_up(1.4);q.titan.apply_burn(5.0);q.titan.apply_wither(duration)
Section titled “q.titan.apply_wither(duration)”Applies wither effect to all registered targets.
Parameters:
duration(Number): Wither duration in seconds
Returns: Void
Examples:
// 2 second witherq.titan.apply_wither(2.0);
// Combined damage + wither + burnq.damage_all(q.move_damage);q.titan.apply_wither(5.0);q.titan.apply_burn(5.0);q.titan.apply_slowness(duration)
Section titled “q.titan.apply_slowness(duration)”Applies slowness effect to all registered targets.
Parameters:
duration(Number): Slowness duration in seconds
Returns: Void
Examples:
// 4 second slownessq.titan.apply_slowness(4.0);
// Triple debuffq.titan.apply_wither(5.0);q.titan.apply_burn(5.0);q.titan.apply_slowness(4.0);Visual & Audio Functions
Section titled “Visual & Audio Functions”Sounds
Section titled “Sounds”q.play_sound(sound, volume, pitch)
Section titled “q.play_sound(sound, volume, pitch)”Plays a sound at the Titan’s position.
Parameters:
sound(String): Sound event IDvolume(Number): Volume (0.0-3.0, 1.0 = normal)pitch(Number): Pitch (0.5-2.0, 1.0 = normal)
Returns: Void
Examples:
// Thunder soundq.play_sound('minecraft:entity.lightning_bolt.thunder', 2.0, 1.0);
// Explosionq.play_sound('minecraft:entity.generic.explode', 1.0, 0.8);
// Multiple sounds (layered)q.play_sound('minecraft:entity.wither.spawn', 1.0, 0.5);q.play_sound('minecraft:entity.ender_dragon.growl', 0.9, 0.6);
// Low pitch for menaceq.play_sound('minecraft:entity.evoker.prepare_summon', 2.0, 0.3);Common Sounds:
minecraft:entity.lightning_bolt.thunder- Thunderminecraft:entity.lightning_bolt.impact- Electric impactminecraft:entity.generic.explode- Explosionminecraft:entity.wither.shoot- Dark projectileminecraft:entity.blaze.shoot- Fire projectileminecraft:entity.ender_dragon.growl- Menacing growlminecraft:entity.evoker.prepare_summon- Charging magic
Particles
Section titled “Particles”q.particle_effect(id, pos, count, spread)
Section titled “q.particle_effect(id, pos, count, spread)”Spawns particles with automatic Cobblemon snowstorm fallback.
Parameters:
id(String): Particle identifier (vanilla or Cobblemon)pos(Vec3): Spawn position (useq.position(0)or temp variable)count(Number): Number of particles (20-300 typical)spread(Number): Spread radius in blocks (determines render distance: spread × 2)
Returns: Void
Examples:
// Basic particle at entity centerq.particle_effect('cobblemon:thunder_actorcloud', q.position(0), 200, 8.0);
// Using temp variablet.pos = q.position(0);q.particle_effect('cobblemon:thunder_targetsparks', t.pos, 100, 5.0);
// Offset position (2.5 blocks up)q.particle_effect('cobblemon:thunder_actorcloud', q.position(0) + [0, 2.5, 0], 180, 3.5);
// Layered particlesq.particle_effect('cobblemon:willowisp_actorwisp', q.position(0), 350, 8.0);q.particle_effect('cobblemon:eruption_actorlava', q.position(0), 200, 6.0);q.particle_effect('cobblemon:swordsdance_sparkle', q.position(0), 250, 7.0);
// Vanilla particleq.particle_effect('minecraft:explosion', q.position(0), 1, 0.0);Fallback Logic:
- Check vanilla registry (
minecraft:*) - If not found, use
SpawnSnowstormParticlePacket(Cobblemon) - Render radius =
spread * 2(clamped 16-96 blocks)
Entity Conditions
Section titled “Entity Conditions”q.entity.is_user
Section titled “q.entity.is_user”Type: Query Variable Returns: Boolean
Checks if the current entity context is the Titan (user) or a target.
Examples:
// In entity_particles keyframe{ "type": "entity_particles", "entityCondition": "q.entity.is_user == false", // Only targets "effect": "cobblemon:impact_fire", "locators": ["target"]}
// In animation keyframe{ "type": "animation", "animation": ["hurt"], "entityCondition": "q.entity.is_user == false" // Target hurt anim}Usage: Filter entity particles/animations to targets only.
Temporary Variables
Section titled “Temporary Variables”t.* Namespace
Section titled “t.* Namespace”Store intermediate values for reuse within the same server_molang keyframe.
Examples:
// Store positiont.pos = q.position(0);q.particle_effect('cobblemon:thunder_actorcloud', t.pos, 200, 8.0);q.particle_effect('cobblemon:thunder_targetsparks', t.pos, 100, 5.0);
// Store calculated valuet.damage = q.move_damage * 1.5;q.damage_all(t.damage);
// Multiple temp varst.x = q.position(1);t.y = q.position(2);t.z = q.position(3);Scope: Single server_molang keyframe execution
Advanced Examples
Section titled “Advanced Examples”Phase Enter Script
Section titled “Phase Enter Script”// Raichu Phase 3 Enter (raichu.json:63)q.titan.apply_potion('minecraft:speed', 999999, 2);q.titan.apply_potion('minecraft:strength', 999999, 1);q.titan.apply_potion('minecraft:resistance', 999999, 1);q.invoke_move('overcharge');q.play_sound('minecraft:entity.lightning_bolt.thunder', 1.1, 0.9);Ultimate Attack Sequence
Section titled “Ultimate Attack Sequence”{ "type": "server_molang", "expressions": [ "q.titan.apply_potion('minecraft:glowing', 100, 0);", "q.play_sound('minecraft:entity.lightning_bolt.thunder', 0.5, 0.5);", "t.pos = q.position(0);", "q.particle_effect('cobblemon:thunder_targetsparks', t.pos, 100, 5.0);" ]}Multi-Hit Combo
Section titled “Multi-Hit Combo”{ "type": "damage_obb", "obbName": "combo_hit", "damage": "q.move_damage", "expressions": [ "q.damage_all(q.move_damage);", "q.fling_all_up(1.4);", "q.titan.apply_burn(3.0);", "q.titan.apply_wither(2.0);", "q.play_sound('minecraft:entity.generic.explode', 1.0, 0.8);" ]}Layered Particle Effect
Section titled “Layered Particle Effect”// Ceruledge Armor Oblivion final explosionq.particle_effect('cobblemon:eruption_targetburst', q.position(0), 80, 10.0);q.particle_effect('cobblemon:willowisp_actorwisp', q.position(0), 500, 12.0);q.particle_effect('cobblemon:shadowball_actorcharge', q.position(0), 300, 9.0);q.particle_effect('cobblemon:swordsdance_sparkle', q.position(0), 200, 8.0);q.particle_effect('cobblemon:impact_ghost', q.position(0), 250, 7.0);q.particle_effect('cobblemon:eruption_actorlava', q.position(0), 300, 8.0);Execution Order
Section titled “Execution Order”Within a server_molang keyframe, expressions execute sequentially in array order:
"expressions": [ "t.pos = q.position(0);", // 1. Store position "q.play_sound('...', 1.0, 1.0);", // 2. Play sound "q.particle_effect('...', t.pos, ...);", // 3. Spawn particles (uses t.pos) "q.damage_all(50.0);" // 4. Deal damage]Performance Considerations
Section titled “Performance Considerations”- Particle Count - Keep under 300 per effect for client performance
- Sound Layering - Limit to 3-4 simultaneous sounds
- Temp Variables - Reuse expensive queries (
q.position(0)) - Expression Count - 5-10 expressions per keyframe is typical
Troubleshooting
Section titled “Troubleshooting”Expressions Not Executing
Section titled “Expressions Not Executing”Check:
- Array format:
"expressions": [...]not"expression": "..." - Semicolons at end of each expression
- Quotes around strings
- Commas between array elements
Particles Not Appearing
Section titled “Particles Not Appearing”Check:
- Particle ID correct (verify in Cobblemon bedrock repository)
spreadlarge enough for render distance- Position valid (
q.position(0)not NaN)
Damage Not Applying
Section titled “Damage Not Applying”Check:
q.damage_all()called withindamage_obbkeyframeexpressions- Entities registered in OBB context (defined + telegraphed)
- Damage value not 0
Next Steps
Section titled “Next Steps”- Action Effects → - Build complete move timelines
- Particles & Visuals → - Particle reference guide
- Creating Custom Moves → - Complete workflow
Master server MoLang to create dynamic, scripted boss attacks!