SwitchCase - Case (Section) — SkBee
Addon: SkBee · Category: Section · Since: 3.8.0
Syntax
case %objects%Description
In a switch section/expression, you can manage different actions based on the case matching the switched value. Multiple objects are supported in cases. Default will run if all other cases fail to match. Default must go last or all cases after it will be ignored.
Examples
on break:
switch event-block:
case dirt:
give player a stick named "Dirt"
case stone:
give player an apple named "Stone"
case grass block:
give player an iron ingot named "Iron Ingot"
default:
kill player
on damage of a mob by a player:
switch type of victim:
case zombie, husk, a drowned:
spawn 3 baby zombies at victim
case skeleton, stray:
spawn a skeleton horse at victim:
set {_h} to entity
spawn a skeleton at victim:
set {_s} to entity
make {_s} ride {_h}
case sheep, cow, chicken, pig:
kill attacker
default:
give attacker a diamond