Date: 2017/05/17 13:07:06 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
on player breaks block:
- if <context.location.is_within[gardenspawn]> {
- determine cancelled
}
- if <s@Config.list_keys[materials].contains_any[<context.material.bukkit_enum>].not.and[<context.material.contains_text[podzol].not>]> {
- determine cancelled
}
- determine passively cancelled
- modifyblock <context.location> bedrock
- define item <player.item_in_hand>
- if <def[item].enchantments.contains_text[Unbreaking]> {
- choose <def[item].enchantments.level[Unbreaking]> {
- case "1" {
- if <util.random.int[1].to[4].is[>=].than[2]> {
- ^inject s@ToolDamage instantly
}
}
- case "2" {
- if <util.random.int[1].to[3].is[>=].than[2]> {
- ^inject s@ToolDamage instantly
}
}
- case "3" {
- if <util.random.int[1].to[2].is[==].to[2]> {
- ^inject s@ToolDamage instantly
}
}
}
}
ToolDamage:
type: task
debug: true
script:
- adjust <def[item]> "durability:<player.item_in_hand.durability.add[1]>" save:item
- take iteminhand
- if <entry[item].result.durability.is[LESS].than[<def[item].max_durability>]> {
- give <entry[item].result>
}
else {
- playsound <player> sound:ENTITY_ITEM_BREAK
}