Date: 2024/11/12 18:24:15 UTC-08:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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