Paste #62295: Custom Blocks 2.0

Date: 2019/11/24 08:26:30 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


custom_blocks_handler_events:
  type: world
  debug: false
  events:
    on player places sponge:
      - if <player.item_in_hand.script.yaml_key[is_custom_block]||false>:
        - determine passively cancelled
        - wait 1t
        - spawn armor_stand[custom_name=customBlock_<player.item_in_hand.scriptname>;equipment=air|air|air|<player.item_in_hand.scriptname>;gravity=false;visible=false] <context.location.center.below[1.66]>
        - modifyblock <context.location> cracked_stone_bricks
        - adjust <context.location> spawner_type:<entity[dropped_item]>

    on player breaks cracked_stone_bricks:
      - define customBlockStands:<context.location.center.below[1.66].find.entities[armor_stand].within[0.1].filter[custom_name.contains[customBlock]]>
      - if <[customBlockStands].size||0> >= 1:
        - determine passively <[customBlockStands].get[1].as_entity.equipment.head.script.yaml_key[custom_block_drop].as_item||<[customBlockStands].get[1].as_entity.custom_name.after[_].as_item>>
        - wait 1t
        - remove <[customBlockStands].get[1]>