Paste #69668: Untitled Paste

Date: 2020/05/26 10:02:57 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


woodcutting_listener:
    type: world
    events:
        on player places *_log:
        - flag server woodcutting.player_made_trees.<context.location.simple>
        - narrate newflag
        on player breaks *_log:
        - if !<server.has_flag[woodcutting.player_made_trees.<context.location.simple>]>:
            - stop
        - flag server woodcutting.player_made_trees.<context.location.simple>:!
        - narrate removeflag
        on player left clicks block with item:
        - if !<context.item.has_script>:
            - stop
        #if item is not axe
        - if !<list[bronze_axe|iron_axe|steel_axe|branite_axe|molmek_axe|endos_axe].contains[<context.item.script.name>]>:
            - stop

        #check if man made log
        - if <server.has_flag[woodcutting.player_made_trees.<context.location.simple>]>:
            - stop

        #begin felling process
        - if <player.has_flag[woodcutting.cooldown]>:
            - narrate "<&c>You swing your axe and miss."
            - playsound entity_llama_spit <player.location> pitch:-2
            - stop

        - choose <context.location.material.name>:
            - case acacia_log oak_log dark_oak_log spruce_log birch_log jungle_log:
                - if !<player.has_flag[woodcutting.tree.<context.location.simple>]>:
                    - flag player woodcutting.tree.<context.location.simple>
                    - flag player woodcutting.chop_count.<context.location.simple>:0
                    #wc lvl, axe sharpness, hardness/
                    - if <player.flag[woodcuttinglvl].mul[.1].round_up.add[<context.item.nbt[sharpness]>]> < <script[block_hardness].yaml_key[block.<context.location.material.name>]>:
                        - flag player woodcutting.chop_total.<context.location.simple>:<util.random.int[<player.flag[woodcuttinglvl].mul[.1].add[<context.item.nbt[sharpness]>].round_up>].to[<script[block_hardness].yaml_key[block.<context.location.material.name>]>]>
                    - else:
                        - flag player woodcutting.chop_total.<context.location.simple>:<util.random.int[1].to[3]>
                - flag player woodcutting.cooldown duration:10t
                - flag player woodcutting.chop_count.<context.location.simple>:++
                - flag player woodcuttingxp:+:.30
                - actionbar "<&a><&l>+ .30 XP"
                - playsound block_wood_break <player.location> pitch:3

                - if <player.flag[woodcutting.chop_count.<context.location.simple>]> == <player.flag[woodcutting.chop_total.<context.location.simple>]>:
                    - modifyblock <context.location> air
                    - playeffect block_crack <player.location.forward[2]> special_data:<context.location.material.name> quantity:150
                    - playsound block_wood_break <player.location> pitch:-3
                    - if <proc[woodcuttinglevel_process].context[<player>]>:
                        - flag player woodcuttinglvl:<player.flag[woodcuttinglvl].add[1]>
                        - playsound entity_experience_orb_pickup <player.location> pitch:-1
                        - toast "Congratulations your woodcutting level is now <player.flag[woodcuttinglvl]>!"
                    - flag player woodcutting.tree.<context.location.simple>:!
                    - flag player woodcutting.chop_count.<context.location.simple>:!
                    - flag player woodcutting.cooldown:!
                - else:
                    - if <proc[woodcuttinglevel_process].context[<player>]>:
                        - flag player woodcuttinglvl:<player.flag[woodcuttinglvl].add[1]>
                        - playsound entity_experience_orb_pickup <player.location> pitch:-1
                        - toast "Congratulations your woodcutting level is now <player.flag[woodcuttinglvl]>!"
                    - playeffect block_crack <player.location.forward[2]> special_data:<context.location.material.name> quantity:150
                    - playsound block_wood_break <player.location> pitch:-3