Date: 2019/06/23 15:40:52 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
66
67
68
69
70
applebranch:
type: item
material: oak_sapling
display name: Orchard Branch
lore:
- One time use.
- Plant for a chance to
- Grow an Apple Tree
'AppleTreeWorld':
type: world
events:
on player places applebranch:
- random:
- repeat 1:
- wait 10-30
- flag global vSpawnerTreeLocList:->:<context.location.simple>
- if <context.location.material> == m@oak_sapling {
#Check Trunk
- flag player vTreeY:1
- flag player vTrunk:0
- narrate "Y:<player.flag[vTreeY].asint>, Trunk: <player.flag[vTrunk].asint>"
- repeat 8 {
- if <context.location.add[0,<player.flag[vTreeY].asint>,0].material> != m@air {
- narrate "Found non-air!"
- flag player vTrunk:1
} else {
- narrate "Air found at <player.flag[vTreeY].asint>"
}
- flag player vTreeY:++
}
- if <player.flag[vTrunk].asint> == 0 {
- flag player vTreeX:-2
- flag player vTreeY:3
- flag player vTreeZ:-2
- flag player vNonAir:0
- narrate "X <player.flag[vTreeX].round_down>, Y <player.flag[vTreeY].round_down>, Z <player.flag[vTreeZ].round_down>, material <context.location.add[<player.flag[vTreeX].round_down>,<player.flag[vTreeY].round_down>,<player.flag[vTreeZ].round_down>].material>"
- repeat 5 { # vTreeX = -2 to 2
- repeat 3 { # vTreeY = 3 to 6
- repeat 5 { # vTreeZ = -2 to 2
- narrate "X <player.flag[vTreeX].round_down>, Y <player.flag[vTreeY].round_down>, Z <player.flag[vTreeZ].round_down>, material <context.location.add[<player.flag[vTreeX].round_down>,<player.flag[vTreeY].round_down>,<player.flag[vTreeZ].round_down>].material>"
- if <context.location.add[<player.flag[vTreeX].round_down>,<player.flag[vTreeY].round_down>,<player.flag[vTreeZ].round_down>].material> != m@air {
- flag player vNonAir:1
}
- flag player vTreeZ:++
}
- flag player vTreeY:++
}
- flag player vTreeX:++
}
- if <player.flag[vNonAir].asint> == 0 {
- modifyblock <context.location> air
- execute as_op "setblock <context.location.x> <context.location.y.add[-1]> <context.location.z> minecraft:structure_block[mode=<&dq>load<&dq>]{name:<&dq>minecraft:customappletree<&dq>,ignoreEntities:0b,posX:-4,posZ:-4,mode:<&dq>LOAD<&dq>}"
- modifyblock <context.location> redstone_block
- flag player vTreeX:!
- flag player vTreeY:!
- flag player vTreeZ:!
- flag player vTrunk:!
- flag player vNonAir:!
} else {
- narrate "No Apples today - Canopy not clear"
}
} else {
- narrate "No Apples today - Trunk not clear"
}
} else {
- narrate "No Apples today - sapling gone"
- flag global vSpawnerTreeLocList:<-:<context.location.simple>
}
#- repeat 1: #add repeats to lessen the chance of an apple tree 'spawning'