Paste #139150: Unnamed Denizen Script Paste

Date: 2026/02/14 08:01:55 UTC+00:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


woodcutter_world:
    type: world
    debug: false
    events:
        on player breaks *_log:
            - if !<context.material> matches stripped_* && <context.location.above.material> matches oak_log|spruce_log|birch_log|jungle_log|acacia_log|dark_oak_log|mangrove_log|cherry_log|pale_oak_log:
                - define b <context.location>
                - repeat 5:
                    - define b <[b].below>
                    - if <[b].material> matches dirt:
                        - determine passively cancelled
                        - run woodcutter_task def:<[b].above>|0
                        - playsound sound:entity.creaking.deactivate <context.location> pitch:<util.random.decimal[0.5].to[0.9]>
                        - playsound sound:block.chest.open <context.location> pitch:<util.random.decimal[0.5].to[0.9]> volume:0.5
                        - wait 1t
                        - modifyblock <[b].above> <context.material.name.before[_]>_sapling
                        - repeat stop
        on block falls:
        - determine passively cancelled
        - if <context.entity.has_flag[from_tree]||false>:
            - define n <context.entity.fallingblock_material.name>
            - choose <[n]>:
                - case birch_log acacia_log jungle_log:
                    - define item stripped_<[n]>
                - case oak_leaves spruce_leaves birch_leaves jungle_leaves acacia_leaves dark_oak_leaves mangrove_leaves cherry_leaves pale_oak_leaves:
                    - choose <util.random.int[1].to[20]>:
                        - case 1 2:
                            - define item stick
                        - case 3 4:
                            - define item <[n].before[_]>_leaves
                        - case 5:
                            - define item <[n].before[_]>_sapling
                    - playsound sound:block.pink_petals.hit <context.entity.location> pitch:0.8 volume:0.1
            - playeffect effect:dust_pillar at:<context.entity.location> special_data:<[n]> quantity:8
            - spawn item[item=<[item]||air>] <context.entity.location>

woodcutter_task:
    type: task
    debug: false
    data:
        coords:
        - 1,0,0
        - 1,0,1
        - 1,0,-1
        - 1,1,0
        - 1,1,1
        - 1,1,-1
        - -1,0,0
        - -1,0,1
        - -1,0,-1
        - -1,1,0
        - -1,1,1
        - -1,1,-1
        - 0,1,0
        - 0,1,1
        - 0,1,-1
        - 0,0,1
        - 0,0,-1
    script:
        - if <[1].has_flag[woodcut_cooldown]>:
            - stop
        - flag <[1]> woodcut_cooldown expire:3
        - choose <[1].material.name>:
            - case air:
                - stop
            - case oak_log spruce_log birch_log jungle_log acacia_log dark_oak_log mangrove_log cherry_log pale_oak_log:
                - wait 1t
                - foreach <script.data_key[data].get[coords]> as:shift:
                    - run woodcutter_task def:<[1].add[<[shift]>]>|<[2].add[1]>|0

            - case oak_leaves spruce_leaves birch_leaves jungle_leaves acacia_leaves dark_oak_leaves mangrove_leaves cherry_leaves pale_oak_leaves:
                - wait 1t
                - foreach <script.data_key[data].get[coords]> as:shift:
                    - define loc <[1].add[<[shift]>]>
                    - if <[loc].material.distance||-1> > <[3]||0>:
                        - run woodcutter_task def:<[loc]>|<[2].add[1]>|<[3].add[1]||1>
            - default:
                - stop

        - define vel <player.location.forward_flat.sub[<player.location>].normalize.div[1024].mul[<[2].mul[12].add[4]>]>
        - definemap fb:
            fallingblock_type: <[1].material>
            fallingblock_hurt_entities: false
            fallingblock_drop_item: false
            gravity: false
            velocity: <[vel]>
        - modifyblock <[1]> air
        - wait 1t
        - spawn <entity[falling_block].with_map[<[fb]>]> <[1].add[0.5,0,0.5]> save:e
        - flag <entry[e].spawned_entity> from_tree
        - wait <util.random.int[18].to[22]>t
        - adjust <entry[e].spawned_entity> velocity:<[vel].mul[2].with_y[<[2].mul[-0.05].add[0.1]>]>
        - adjust <entry[e].spawned_entity> gravity:true