Date: 2020/05/25 14:40:40 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
woodcutting_listener:
type: world
events:
on player places acacia_log:
- flag server woodcutting.player_made_trees.<context.location.simple>
- announce flagged
on player left clicks *_log with item:
- if !<context.item.has_script>:
- stop
#choose axe type
- define axes:|:<item[bronze_axe]>|<item[iron_axe]>|<item[steel_axe]>|<item[branite_axe]>|<item[molmek_axe]>|<item[endos_axe]>
- if !<[axes].contains_any[<context.item>]>:
- stop
#check if man made log
- if <server.has_flag[woodcutting.player_made_trees.<context.location.simple>]>:
- stop
#choose log
- if !<player.has_flag[woodcutting.tree.<context.location.simple>]>:
- if <player.has_flag[woodcuting.is_chopping]>:
- narrate "<&c><&l>I'm already chopping some other tree."
- stop
- choose <context.location.material.name>:
- case acacia_log:
- flag player woodcutting.tree.<context.location.simple> duration:1m
- flag player woodcutting.chop_count:0 duration:1m
- spawn hologram <player.location.below[1].forward[1]> save:woodcutting_display
- adjust <entry[woodcutting_display].spawned_entity> custom_name_visible:true
- adjust <entry[woodcutting_display].spawned_entity> custom_name:<&4>0<&pc>
- flag player woodcutting.entity:<entry[woodcutting_display].spawned_entity>
- default:
- stop
#begin the felling process
- if <player.has_flag[woodcutting.cooldown]>:
- narrate "<&c>You swing your axe and miss."
- playsound entity_llama_spit <player.location> pitch:-2
- stop
- choose <context.item.script.name>:
- case bronze_axe:
- flag player woodcutting.cooldown duration:1s
- flag player woodcutting.chop_count:++ duration:1m
- flag player woodcuttingxp:+:.30
- actionbar "<&a><&l>+ .30 XP"
- playsound block_wood_break <player.location> pitch:3
- choose <player.flag[woodcutting.chop_count]>:
- case 1:
- adjust <player.flag[woodcutting.entity]> custom_name:<&c><&l>20<&pc>
- playeffect block_crack <player.location.forward[2]> special_data:acacia_log quantity:150
- case 2:
- adjust <player.flag[woodcutting.entity]> custom_name:<&6><&l>40<&pc>
- playeffect block_crack <player.location.forward[2]> special_data:acacia_log quantity:150
- case 3:
- playeffect block_crack <player.location.forward[2]> special_data:acacia_log quantity:150
- adjust <player.flag[woodcutting.entity]> custom_name:<&e><&l>60<&pc>
- case 4:
- playeffect block_crack <player.location.forward[2]> special_data:acacia_log quantity:150
- adjust <player.flag[woodcutting.entity]> custom_name:<&2><&l>80<&pc>
- case 5:
- playeffect block_crack <player.location.forward[2]> special_data:acacia_log quantity:150
- adjust <player.flag[woodcutting.entity]> custom_name:<&a><&l>100<&pc>
- playsound block_wood_break <player.location> pitch:-3
- if <proc[woodcuttinglevel_process].context[<player>]>:
- flag player woodcuttinglvl <player.flag[woodcuttinglvl].add[1]>
- playsound entity_experience_orb_pickup <player.location> pitch:-1
- toast "Congratulations your woodcutting level is now <player.flag[woodcuttinglvl]>!"
- flag player woodcutting.tree.<context.location.simple>:!
- remove <player.flag[woodcutting.entity]>
- flag player woodcutting.entity:!
- flag player woodcutting.chop_count:!
- flag player woodcutting.is_chopping:!
- define base_location <context.location>
#- define logs <context.location>
#- define count 1
#- while <[base_location].above[<[count]>].material> == <[log]>:
# - define logs:->:<proc[get_logs_process].context[<[base_location]>|<[logs]>|<[log]>]>
# - narrate <[log]>
# - narrate <[logs]>
# - define count:++
# - define count_processes:++
- define leaves:|:<material[acacia_leaves]>|<material[birch_leaves]>|<material[dark_oak_leaves]>|<material[jungle_leaves]>|<material[oak_leaves]>|<material[spruce_leaves]>
- define count 1
- while <[base_location].above[<[count]>].material.name> != air:
- define base_location <[base_location].above[<[count]>]>
- define count:++
- define logs_and_leaves:->:<[base_location].find.blocks[<context.location.material>|<[leaves]>].within[3]>
- define processes:++
- if <[loop_index]> >= 2:
- if <[base_location].above[3].find.blocks[<context.location.material>|<[leaves]>].within[1].ends_with[<context.location.material>]||<[leaves]>>:
- define upper_location <[base_location].above[3]>
- define logs_and_leaves:->:<[upper_location].find.blocks[<context.location.material>|<[leaves]>].within[7]>
- narrate "Processed <[processes]> loops."
- wait 1s
- narrate "Block count:"
- wait 1s
- narrate <[logs_and_leaves].size>
- wait 1s
- narrate "Block locations to remove:"
- wait 1s
- narrate <[logs_and_leaves].formatted>
#- narrate "Counted logs_process <[count_processes]> times."
#- wait 1s
#- narrate "Came up with a total of <[logs].size> logs."
#- wait 1s
#- narrate "List of log locations to remove:"
#- wait 1s
#- narrate <[logs].formatted>
- foreach <[logs_and_leaves]>:
- showfake glowstone <[value]> duration:10s