Paste #48855: Untitled Paste

Date: 2018/08/05 16:50:33 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


CheckBlock:
    type: task
    debug: true
    script:
    - if !<li@m@stone|m@cobblestone|m@andesite|m@polished_andesite|m@diorite|m@polished_diorite|m@granite|m@polished_granite|m@grass|m@dirt|m@coarse_dirt|m@podzol|m@mossy_cobblestone|m@mycel|m@ender_stone|m@netherrack|m@clay|m@stone_brick|m@mossy_stone_brick|m@cracked_stone_brick|m@chiseled_stone_bricks|m@end_bricks.contains[<player.location.add[0,-1,0].material>]> {
        - queue clear
    }

SummonBoulder:
    type: world
    debug: true
    events:
        on player starts sneaking:
            - run CheckBlock
            - if <player.flag[element]> == earth && <player.is_on_ground> {
                - if <player.location.cursor_on[5].material> == m@air {
                    - if <player.has_flag[boulderpending]> {
                        - queue clear
                    }
                    - copyblock <player.location.add[0,-1,0]> to:<player.location.add[0,3,0]>
                    - flag player underblock:<player.location.add[0,-1,0].material.name>
                    - modifyblock <player.location.add[0,-1,0]> m@air
                    - flag player underblockloc:<player.location.add[0,-1,0]>
                    - flag player boulderpending:<player.location.add[0,3,0]>
                    - define boulderloc <player.location.add[0,3,0]>
                    - narrate "<&a>Flagged you with boulder pending"
                    - wait 5s
                    - if <player.has_flag[boulderpending]> {
                        - modifyblock <def[boulderloc]> m@air
                        - modifyblock <player.flag[underblockloc]> <player.flag[underblock]>
                        - flag player boulderpending:!
                        - flag player underblock:!
                        - narrate "<&a>No longer have boulderpending!"
                    }
                }
            }
        on player left clicks:
            - if <player.flag[element]> == earth && <player.has_flag[boulderpending]> {
                #Modify the boulder to be a falling sand and launch it in direction player clicks
                - define boulderloc <player.flag[boulderpending]>
                - modifyblock <def[boulderloc]> m@air
                - spawn falling_block,<player.flag[underblock]> <def[boulderloc]> save:boulder
                - adjust <entry[boulder].spawned_entities.get[1]> "velocity:<player.location.direction.vector.mul[1.5]>"
                - flag player boulderpending:!
                - flag player underblock:!
                - narrate "<&a>You no longer have boulder pending!"
            }