Paste #128084: Things and stuff

Date: 2024/11/12 18:24:15 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


test:
    type: world
    debug: true
    events:
        on player right clicks block:
            - ratelimit <player> 0.1s
            - if <player.item_in_hand.script> == <script[test_block]> && <context.location.material.exists> && not <context.relative.find_entities.within[1].get[0].exists>:
                - animate <player> animation:ARM_SWING
                - playsound <context.relative> sound:<context.item.flag[block].get[sounds].get[place]> sound_category:BLOCKS
                - modifyblock <context.relative> <material[note_block]>
                - adjustblock <context.relative> instrument:BASS_DRUM
                - adjustblock <context.relative> note:2
                - adjustblock <context.relative> powered:false
                - adjustblock <context.relative.material> block_sound_data:<context.relative.material.block_sound_data.with[break_sound].as[BLOCK_METAL_BREAK]>
                - flag <context.relative> item:<context.item.script>
                - flag <context.relative> placed_by_player:true
                - if <player.gamemode> != CREATIVE:
                    - inventory adjust d:<player.inventory> slot:<player.item_in_hand.slot> quantity:<player.item_in_hand.quantity.sub[1]>
            - if <player.item_in_offhand.script> == <script[test_block]> && <context.location.material.exists>:
                - animate <player> animation:ARM_SWING_OFFHAND
                - playsound <context.relative> sound:<player.item_in_offhand.flag[block].get[sounds].get[place]> sound_category:BLOCKS
                - modifyblock <context.relative> <material[note_block]>
                - adjustblock <context.relative> instrument:BASS_DRUM
                - adjustblock <context.relative> note:2
                - adjustblock <context.relative> powered:false
                - flag <context.relative> item:<player.item_in_offhand.script>
                - if <player.gamemode> != CREATIVE:
                    - inventory adjust d:<player.inventory> slot:41 quantity:<player.item_in_offhand.quantity.sub[1]>
        on player breaks block:
            - flag <context.location> placed_by_player:!
            - if <context.location.flag[item].exists>:
                - modifyblock <context.location> <material[air]>
                - playsound <context.location> sound:<context.location.flag[item].data_key[flags].get[block].get[sounds].get[break]> sound_category:BLOCKS
                - flag <context.location> item:!
                - determine cancelled
        on player stops damaging block:
            - flag <player> damaging_block:!
        on player left clicks note_block:
            - narrate <context.location>
            - determine passively cancelled
            - narrate AAA
            - flag <player> damaging_block
            - while <context.location.material> != <material[air]> && <player.has_flag[damaging_block]>:
                - playsound <context.location> sound:BLOCK_METAL_HIT
                - wait 0.2
            - if <context.location.flag[item].exists>:
                - narrate AAA

test_block:
    type: item
    debug: false
    material: paper
    mechanisms:
        custom_model_data: 1008
    flags:
        block:
            base_block: <material[note_block]>
            sounds:
                place: BLOCK_METAL_PLACE
                break: BLOCK_METAL_BREAK
                hit: BLOCK_METAL_HIT
                step: BLOCK_METAL_STEP
                fall: BLOCK_METAL_FALL