This commit is contained in:
@@ -0,0 +1 @@
|
||||
$item modify entity @s weapon.mainhand {"function":"minecraft:set_components","components":{"minecraft:damage":$(damage)}}
|
@@ -0,0 +1,4 @@
|
||||
execute if entity @s[predicate=lzstools_chisel:mainhand/iron] at @s anchored eyes run particle minecraft:item{item:"minecraft:iron_sword"} ^ ^-0.35 ^0.65 0.1 0.1 0.1 0.06 10 force
|
||||
execute if entity @s[predicate=lzstools_chisel:mainhand/diamond] at @s anchored eyes run particle minecraft:item{item:"minecraft:diamond_sword"} ^ ^-0.35 ^0.65 0.1 0.1 0.1 0.06 10 force
|
||||
item replace entity @s weapon.mainhand with minecraft:air
|
||||
playsound minecraft:entity.item.break master @a ~ ~ ~ 1 1
|
@@ -0,0 +1,13 @@
|
||||
scoreboard players reset @s lzt_chisel_unbreaking_check
|
||||
execute if entity @s[predicate=lzstools:unbreaking/mainhand/all] run function lzstools_chisel:durability/mainhand/unbreaking
|
||||
execute if score @s lzt_chisel_unbreaking_check matches 1 run return fail
|
||||
|
||||
# Handle Damage
|
||||
data modify storage lzstools:chisel components set from entity @s SelectedItem.components
|
||||
execute store result score @s lzt_chisel_damage run data get storage lzstools:chisel components."minecraft:damage"
|
||||
execute store result score @s lzt_chisel_max_damage run data get storage lzstools:chisel components."minecraft:max_damage"
|
||||
scoreboard players add @s lzt_chisel_damage 1
|
||||
execute store result storage lzstools:chisel damage int 1 run scoreboard players get @s lzt_chisel_damage
|
||||
|
||||
function lzstools_chisel:durability/mainhand/apply with storage lzstools:chisel
|
||||
execute if score @s lzt_chisel_damage >= @s lzt_chisel_max_damage run function lzstools_chisel:durability/mainhand/break
|
@@ -0,0 +1,4 @@
|
||||
execute store result score @s lzt_chisel_unbreaking_chance run random value 1..100
|
||||
execute if entity @s[predicate=lzstools:unbreaking/mainhand/3] if score @s lzt_chisel_unbreaking_chance matches ..75 run return run scoreboard players set @s lzt_chisel_unbreaking_check 1
|
||||
execute if entity @s[predicate=lzstools:unbreaking/mainhand/2] if score @s lzt_chisel_unbreaking_chance matches ..66 run return run scoreboard players set @s lzt_chisel_unbreaking_check 1
|
||||
execute if entity @s[predicate=lzstools:unbreaking/mainhand/1] if score @s lzt_chisel_unbreaking_chance matches ..50 run return run scoreboard players set @s lzt_chisel_unbreaking_check 1
|
Reference in New Issue
Block a user