EarthRide:
type: world
debug: true
events:
on player starts sneaking:
- if <player.has_flag[EarthRideActive]> {
- flag <player> EarthRideActive:!
- queue clear
}
- ^if <player.is_on_ground> {
- queue clear
}
- if <player.flag[element]> != earth {
- queue clear
}
- if <player.has_flag[element_toggled]> {
- queue clear
}
- if <player.location.cursor_on[5].material> != m@air {
- queue clear
}
- if <li@m@sand|m@clay|m@dirt|m@grass|m@gravel|m@diorite|m@cobblestone|m@stone|m@polished_diorite|m@andesite|m@polished_andesite|m@granite|m@polished_granite.contains[<player.location.center.add[0,-2,0].material>]> {
- if <player.has_flag[EarthRideActive]> {
- flag <player> EarthRideActive:!
- queue clear
}
- flag <player> EarthRideActive
}
on player walks:
- if <player.has_flag[EarthRideActive]> {
- if !<li@m@sand|m@clay|m@dirt|m@grass|m@gravel|m@diorite|m@cobblestone|m@stone|m@polished_diorite|m@andesite|m@polished_andesite|m@granite|m@polished_granite.contains[<player.location.center.add[0,-1,0].material>]> {
- queue clear
}
- adjust <player> "velocity:<player.location.direction.vector.mul[1].add[0,0.19,0]>"
- define bmat li@
- foreach <player.location.center.add[0,-1,0].find.surface_blocks[<li@m@sand|m@clay|m@dirt|m@grass|m@gravel|m@diorite|m@cobblestone|m@stone|m@polished_diorite|m@andesite|m@polished_andesite|m@granite|m@polished_granite>].within[2].parse[material.name]> {
- define bmat <def[bmat].include[<def[value]>]>
}
- - define blocks li@
- foreach <player.location.center.add[0,-1,0].find.surface_blocks[<li@m@sand|m@clay|m@dirt|m@grass|m@gravel|m@diorite|m@cobblestone|m@stone|m@polished_diorite|m@andesite|m@polished_andesite|m@granite|m@polished_granite>].within[2]> {
- - define blocks <def[blocks].include[<def[value]>]>
+ - modifyblock <def[value]> m@air
+ - spawn e@falling_block,def[bmat].as_list.get[<def[loop_index]>]> <def[value]> save:fallingblock
+ - adjust <entry[fallingblock].spawned_entities> "velocity:0,0.2,0"
}
- - modifyblock <def[blocks]> m@air
- - spawn e@falling_block,<def[bmat].as_list.get[<def[loop_index]>]> <def[blocks].get[<def[loop_index]>]> save:fallingblock
- - adjust <entry[fallingblock].spawned_entities> "velocity:0,0.2,0"
- playsound <player.location> sound:BLOCK_STONE_BREAK volume:25
}