Date: 2019/07/02 23:51:47 UTC-07: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
65
FastLeafDecay_Events:
type: world
debug: false
events:
on player breaks Oak_Log:
- define Leaf "Oak_Leaves"
- inject FastLeafDecay_Task
on player breaks Spruce_Log:
- define Leaf "Spruce_Leaves"
- inject FastLeafDecay_Task
on player breaks Birch_Log:
- define Leaf "Birch_Leaves"
- inject FastLeafDecay_Task
on player breaks Jungle_Log:
- define Leaf "Jungle_Leaves"
- inject FastLeafDecay_Task
on player breaks Acacia_Log:
- define Leaf "Acacia_Leaves"
- inject FastLeafDecay_Task
on player breaks Dark_Oak_Log:
- define Leaf "Dark_Oak_Leaves"
- inject FastLeafDecay_Task
FastLeafDecay_Task:
type: task
debug: false
speed: 0
script:
# Check if block has another log ontop of it.
- if <context.location.add[0,1,0].material> == <context.material>:
# Top of the tree hasn't been reached yet.
- queue clear
# Grab all the leaves in a radius of the log broken.
- define Leaves <context.location.find.blocks[<def[Leaf]>].within[<server.flag[FastLeafDecayRange]||7>]>
# Clearing queue if there are no leaves.
- if <def[Leaves].size> == 0:
- queue clear
# Destroying leaves naturally.
- foreach <def[Leaves].random[<def[leaves].size>]>:
# Check for additional logs within a 5-block radius, excluding the broken log from the results.
- if <def[value].find.blocks[<context.material.name>].within[3].exclude[<context.location>].size> == 0:
# Destroy the block
- modifyblock <def[value]> air naturally
# Play a sound.
- playsound <def[value]> sound:block_grass_break volume:0.05 pitch:1.2 sound_category:blocks
# Play a particle effect.
- playeffect effect:happy_villager at:<def[value].add[0.5,0.5,0.5]> offset:0.2 quantity:10 visibility:15
- wait 2t
- playeffect effect:happy_villager at:<def[value].add[0.5,0.5,0.5]> offset:0.2 quantity:10 visibility:15
FastLeafDecay_Init:
type: task
debug: false
speed: 0
script:
- flag server FastLeafDecayRange:12