updated tags and scoreboards

added sound to action
fixed damage when in offhand
This commit is contained in:
2025-05-15 23:20:41 +01:00
parent e2b221eed0
commit 329f879cd8
133 changed files with 1287 additions and 1284 deletions

View File

@@ -1,4 +1,4 @@
scoreboard players set @s lz_trowel_success 0
scoreboard players set @s lzt_trowel_success 0
execute if score @s lz_trowel_success matches 0 run function lzstools_trowel:block/place_normal with storage lzstools:trowel
execute if score @s lz_trowel_success matches 1 run function lzstools_trowel:block/remove_item with storage lzstools:trowel
execute if score @s lzt_trowel_success matches 0 run function lzstools_trowel:block/place_normal with storage lzstools:trowel
execute if score @s lzt_trowel_success matches 1 run function lzstools_trowel:block/remove_item with storage lzstools:trowel

View File

@@ -1,5 +1,5 @@
# Place NESW
$execute as @s[y_rotation=-45..45] store result score @s lz_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=north] keep
$execute as @s[y_rotation=45..135] store result score @s lz_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=east] keep
$execute as @s[y_rotation=135..-135] store result score @s lz_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=south] keep
$execute as @s[y_rotation=-135..-45] store result score @s lz_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=west] keep
$execute as @s[y_rotation=-45..45] store result score @s lzt_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=north] keep
$execute as @s[y_rotation=45..135] store result score @s lzt_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=east] keep
$execute as @s[y_rotation=135..-135] store result score @s lzt_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=south] keep
$execute as @s[y_rotation=-135..-45] store result score @s lzt_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=west] keep

View File

@@ -1,7 +1,7 @@
# Place NESWUD
$execute as @s[x_rotation=45..90] store result score @s lz_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=up] keep
$execute as @s[x_rotation=-90..-45] store result score @s lz_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=down] keep
$execute as @s[x_rotation=-45..45, y_rotation=-45..45] store result score @s lz_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=north] keep
$execute as @s[x_rotation=-45..45, y_rotation=45..135] store result score @s lz_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=east] keep
$execute as @s[x_rotation=-45..45, y_rotation=135..-135] store result score @s lz_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=south] keep
$execute as @s[x_rotation=-45..45, y_rotation=-135..-45] store result score @s lz_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=west] keep
$execute as @s[x_rotation=45..90] store result score @s lzt_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=up] keep
$execute as @s[x_rotation=-90..-45] store result score @s lzt_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=down] keep
$execute as @s[x_rotation=-45..45, y_rotation=-45..45] store result score @s lzt_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=north] keep
$execute as @s[x_rotation=-45..45, y_rotation=45..135] store result score @s lzt_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=east] keep
$execute as @s[x_rotation=-45..45, y_rotation=135..-135] store result score @s lzt_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=south] keep
$execute as @s[x_rotation=-45..45, y_rotation=-135..-45] store result score @s lzt_trowel_raycast run setblock ~ ~ ~ $(chosen_block)[facing=west] keep

View File

@@ -1,3 +1,3 @@
# Place Slabs
$execute as @s if score py lz_trowel_raycast matches 8.. store result score @s lz_wrench_success run setblock ~ ~ ~ $(chosen_block)[type=top] keep
$execute as @s if score py lz_trowel_raycast matches ..7 store result score @s lz_wrench_success run setblock ~ ~ ~ $(chosen_block)[type=bottom] keep
$execute as @s if score py lzt_trowel_raycast matches 8.. store result score @s lzt_wrench_success run setblock ~ ~ ~ $(chosen_block)[type=top] keep
$execute as @s if score py lzt_trowel_raycast matches ..7 store result score @s lzt_wrench_success run setblock ~ ~ ~ $(chosen_block)[type=bottom] keep

View File

@@ -1,9 +1,9 @@
# Place Stairs
$execute as @s[y_rotation=-45..45] if score py lz_trowel_raycast matches ..7 store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=south] keep
$execute as @s[y_rotation=45..135] if score py lz_trowel_raycast matches ..7 store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=west] keep
$execute as @s[y_rotation=135..-135] if score py lz_trowel_raycast matches ..7 store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=north] keep
$execute as @s[y_rotation=-135..-45] if score py lz_trowel_raycast matches ..7 store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=east] keep
$execute as @s[y_rotation=-45..45] if score py lz_trowel_raycast matches 8.. store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=south] keep
$execute as @s[y_rotation=45..135] if score py lz_trowel_raycast matches 8.. store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=west] keep
$execute as @s[y_rotation=135..-135] if score py lz_trowel_raycast matches 8.. store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=north] keep
$execute as @s[y_rotation=-135..-45] if score py lz_trowel_raycast matches 8.. store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=east] keep
$execute as @s[y_rotation=-45..45] if score py lzt_trowel_raycast matches ..7 store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=south] keep
$execute as @s[y_rotation=45..135] if score py lzt_trowel_raycast matches ..7 store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=west] keep
$execute as @s[y_rotation=135..-135] if score py lzt_trowel_raycast matches ..7 store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=north] keep
$execute as @s[y_rotation=-135..-45] if score py lzt_trowel_raycast matches ..7 store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=east] keep
$execute as @s[y_rotation=-45..45] if score py lzt_trowel_raycast matches 8.. store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=south] keep
$execute as @s[y_rotation=45..135] if score py lzt_trowel_raycast matches 8.. store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=west] keep
$execute as @s[y_rotation=135..-135] if score py lzt_trowel_raycast matches 8.. store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=north] keep
$execute as @s[y_rotation=-135..-45] if score py lzt_trowel_raycast matches 8.. store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=east] keep

View File

@@ -1,10 +1,10 @@
# Place Trapdoors
$execute as @s[y_rotation=-45..45] if score py lz_trowel_raycast matches ..7 store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=north] keep
$execute as @s[y_rotation=45..135] if score py lz_trowel_raycast matches ..7 store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=east] keep
$execute as @s[y_rotation=135..-135] if score py lz_trowel_raycast matches ..7 store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=south] keep
$execute as @s[y_rotation=-135..-45] if score py lz_trowel_raycast matches ..7 store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=west] keep
$execute as @s[y_rotation=-45..45] if score py lz_trowel_raycast matches 8.. store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=north] keep
$execute as @s[y_rotation=45..135] if score py lz_trowel_raycast matches 8.. store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=east] keep
$execute as @s[y_rotation=135..-135] if score py lz_trowel_raycast matches 8.. store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=south] keep
$execute as @s[y_rotation=-135..-45] if score py lz_trowel_raycast matches 8.. store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=west] keep
$execute as @s[y_rotation=-45..45] if score py lzt_trowel_raycast matches ..7 store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=north] keep
$execute as @s[y_rotation=45..135] if score py lzt_trowel_raycast matches ..7 store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=east] keep
$execute as @s[y_rotation=135..-135] if score py lzt_trowel_raycast matches ..7 store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=south] keep
$execute as @s[y_rotation=-135..-45] if score py lzt_trowel_raycast matches ..7 store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=west] keep
$execute as @s[y_rotation=-45..45] if score py lzt_trowel_raycast matches 8.. store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=north] keep
$execute as @s[y_rotation=45..135] if score py lzt_trowel_raycast matches 8.. store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=east] keep
$execute as @s[y_rotation=135..-135] if score py lzt_trowel_raycast matches 8.. store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=south] keep
$execute as @s[y_rotation=-135..-45] if score py lzt_trowel_raycast matches 8.. store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=west] keep

View File

@@ -1,7 +1,7 @@
# Place XYZ
$execute as @s if score py lz_trowel_raycast matches 0 store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[axis=y] keep
$execute as @s if score py lz_trowel_raycast matches 15 store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[axis=y] keep
$execute as @s if score px lz_trowel_raycast matches 0 store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[axis=x] keep
$execute as @s if score px lz_trowel_raycast matches 15 store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[axis=x] keep
$execute as @s if score pz lz_trowel_raycast matches 0 store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[axis=z] keep
$execute as @s if score pz lz_trowel_raycast matches 15 store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block)[axis=z] keep
$execute as @s if score py lzt_trowel_raycast matches 0 store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[axis=y] keep
$execute as @s if score py lzt_trowel_raycast matches 15 store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[axis=y] keep
$execute as @s if score px lzt_trowel_raycast matches 0 store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[axis=x] keep
$execute as @s if score px lzt_trowel_raycast matches 15 store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[axis=x] keep
$execute as @s if score pz lzt_trowel_raycast matches 0 store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[axis=z] keep
$execute as @s if score pz lzt_trowel_raycast matches 15 store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block)[axis=z] keep

View File

@@ -3,14 +3,14 @@ function lzstools_trowel:block/target_coords
$setblock ~ -64 ~ $(chosen_block)
execute if score @s lz_trowel_success matches 0 if block ~ -64 ~ #lzstools:xyz run function lzstools_trowel:block/place/xyz with storage lzstools:trowel
execute if score @s lz_trowel_success matches 0 if block ~ -64 ~ #lzstools:neswud run function lzstools_trowel:block/place/neswud with storage lzstools:trowel
execute if score @s lz_trowel_success matches 0 if block ~ -64 ~ #lzstools:nesw run function lzstools_trowel:block/place/nesw with storage lzstools:trowel
execute if score @s lz_trowel_success matches 0 if block ~ -64 ~ #lzstools:glazed_terracotta run function lzstools_trowel:block/place/nesw with storage lzstools:trowel
execute if score @s lz_trowel_success matches 0 if block ~ -64 ~ #minecraft:leaves run function lzstools_trowel:block/place/leaves with storage lzstools:trowel
execute if score @s lz_trowel_success matches 0 if block ~ -64 ~ #minecraft:trapdoors run function lzstools_trowel:block/place/trapdoors with storage lzstools:trowel
execute if score @s lz_trowel_success matches 0 if block ~ -64 ~ #minecraft:stairs run function lzstools_trowel:block/place/stairs with storage lzstools:trowel
execute if score @s lz_trowel_success matches 0 if block ~ -64 ~ #minecraft:slabs run function lzstools_trowel:block/place/slabs with storage lzstools:trowel
$execute if score @s lz_trowel_success matches 0 store result score @s lz_trowel_success run setblock ~ ~ ~ $(chosen_block) keep
execute if score @s lzt_trowel_success matches 0 if block ~ -64 ~ #lzstools:xyz run function lzstools_trowel:block/place/xyz with storage lzstools:trowel
execute if score @s lzt_trowel_success matches 0 if block ~ -64 ~ #lzstools:neswud run function lzstools_trowel:block/place/neswud with storage lzstools:trowel
execute if score @s lzt_trowel_success matches 0 if block ~ -64 ~ #lzstools:nesw run function lzstools_trowel:block/place/nesw with storage lzstools:trowel
execute if score @s lzt_trowel_success matches 0 if block ~ -64 ~ #lzstools:glazed_terracotta run function lzstools_trowel:block/place/nesw with storage lzstools:trowel
execute if score @s lzt_trowel_success matches 0 if block ~ -64 ~ #minecraft:leaves run function lzstools_trowel:block/place/leaves with storage lzstools:trowel
execute if score @s lzt_trowel_success matches 0 if block ~ -64 ~ #minecraft:trapdoors run function lzstools_trowel:block/place/trapdoors with storage lzstools:trowel
execute if score @s lzt_trowel_success matches 0 if block ~ -64 ~ #minecraft:stairs run function lzstools_trowel:block/place/stairs with storage lzstools:trowel
execute if score @s lzt_trowel_success matches 0 if block ~ -64 ~ #minecraft:slabs run function lzstools_trowel:block/place/slabs with storage lzstools:trowel
$execute if score @s lzt_trowel_success matches 0 store result score @s lzt_trowel_success run setblock ~ ~ ~ $(chosen_block) keep
setblock ~ -64 ~ bedrock

View File

@@ -1,22 +1,22 @@
## Get Raycast Target Coords
# Stored Value for Calc
scoreboard players set c16 lz_trowel_raycast 16
scoreboard players set c16 lzt_trowel_raycast 16
# Summon Invisible Entity
summon area_effect_cloud ~ ~ ~ {Radius:0.01,Duration:1,Tags:["RaycastMark"]}
# Pixel Calculations
execute store result score px lz_trowel_raycast run data get entity @e[tag=RaycastMark,sort=nearest,limit=1] Pos[0] 16
scoreboard players operation px lz_trowel_raycast %= c16 lz_trowel_raycast
execute if score px lz_trowel_raycast matches ..-1 run scoreboard players add px lz_trowel_raycast 16
execute store result score px lzt_trowel_raycast run data get entity @e[tag=RaycastMark,sort=nearest,limit=1] Pos[0] 16
scoreboard players operation px lzt_trowel_raycast %= c16 lzt_trowel_raycast
execute if score px lzt_trowel_raycast matches ..-1 run scoreboard players add px lzt_trowel_raycast 16
execute store result score py lz_trowel_raycast run data get entity @e[tag=RaycastMark,sort=nearest,limit=1] Pos[1] 16
scoreboard players operation py lz_trowel_raycast %= c16 lz_trowel_raycast
execute if score py lz_trowel_raycast matches ..-1 run scoreboard players add py lz_trowel_raycast 16
execute store result score py lzt_trowel_raycast run data get entity @e[tag=RaycastMark,sort=nearest,limit=1] Pos[1] 16
scoreboard players operation py lzt_trowel_raycast %= c16 lzt_trowel_raycast
execute if score py lzt_trowel_raycast matches ..-1 run scoreboard players add py lzt_trowel_raycast 16
execute store result score pz lz_trowel_raycast run data get entity @e[tag=RaycastMark,sort=nearest,limit=1] Pos[2] 16
scoreboard players operation pz lz_trowel_raycast %= c16 lz_trowel_raycast
execute if score pz lz_trowel_raycast matches ..-1 run scoreboard players add pz lz_trowel_raycast 16
execute store result score pz lzt_trowel_raycast run data get entity @e[tag=RaycastMark,sort=nearest,limit=1] Pos[2] 16
scoreboard players operation pz lzt_trowel_raycast %= c16 lzt_trowel_raycast
execute if score pz lzt_trowel_raycast matches ..-1 run scoreboard players add pz lzt_trowel_raycast 16
# Remove Entity
kill @e[tag=RaycastMark,sort=nearest,limit=1]

View File

@@ -1,13 +1,13 @@
scoreboard players reset @s lz_trowel_unbreaking_check
scoreboard players reset @s lzt_trowel_unbreaking_check
execute if entity @s[predicate=lzstools:unbreaking/mainhand/all] run function lzstools_trowel:durability/mainhand/unbreaking
execute if score @s lz_trowel_unbreaking_check matches 1 run return fail
execute if score @s lzt_trowel_unbreaking_check matches 1 run return fail
# Handle Damage
data modify storage lzstools:trowel components set from entity @s SelectedItem.components
execute store result score @s lz_trowel_damage run data get storage lzstools:trowel components."minecraft:damage"
execute store result score @s lz_trowel_max_damage run data get storage lzstools:trowel components."minecraft:max_damage"
scoreboard players add @s lz_trowel_damage 1
execute store result storage lzstools:trowel damage int 1 run scoreboard players get @s lz_trowel_damage
execute store result score @s lzt_trowel_damage run data get storage lzstools:trowel components."minecraft:damage"
execute store result score @s lzt_trowel_max_damage run data get storage lzstools:trowel components."minecraft:max_damage"
scoreboard players add @s lzt_trowel_damage 1
execute store result storage lzstools:trowel damage int 1 run scoreboard players get @s lzt_trowel_damage
function lzstools_trowel:durability/mainhand/apply with storage lzstools:trowel
execute if score @s lz_trowel_damage >= @s lz_trowel_max_damage run function lzstools_trowel:durability/mainhand/break
execute if score @s lzt_trowel_damage >= @s lzt_trowel_max_damage run function lzstools_trowel:durability/mainhand/break

View File

@@ -1,4 +1,4 @@
execute store result score @s lz_trowel_unbreaking_chance run random value 1..100
execute if entity @s[predicate=lzstools:unbreaking/mainhand/3] if score @s lz_trowel_unbreaking_chance matches ..75 run return run scoreboard players set @s lz_trowel_unbreaking_check 1
execute if entity @s[predicate=lzstools:unbreaking/mainhand/2] if score @s lz_trowel_unbreaking_chance matches ..66 run return run scoreboard players set @s lz_trowel_unbreaking_check 1
execute if entity @s[predicate=lzstools:unbreaking/mainhand/1] if score @s lz_trowel_unbreaking_chance matches ..50 run return run scoreboard players set @s lz_trowel_unbreaking_check 1
execute store result score @s lzt_trowel_unbreaking_chance run random value 1..100
execute if entity @s[predicate=lzstools:unbreaking/mainhand/3] if score @s lzt_trowel_unbreaking_chance matches ..75 run return run scoreboard players set @s lzt_trowel_unbreaking_check 1
execute if entity @s[predicate=lzstools:unbreaking/mainhand/2] if score @s lzt_trowel_unbreaking_chance matches ..66 run return run scoreboard players set @s lzt_trowel_unbreaking_check 1
execute if entity @s[predicate=lzstools:unbreaking/mainhand/1] if score @s lzt_trowel_unbreaking_chance matches ..50 run return run scoreboard players set @s lzt_trowel_unbreaking_check 1

View File

@@ -1,13 +1,13 @@
scoreboard players reset @s lz_trowel_unbreaking_check
scoreboard players reset @s lzt_trowel_unbreaking_check
execute if entity @s[predicate=lzstools:unbreaking/offhand/all] run function lzstools_trowel:durability/offhand/unbreaking
execute if score @s lz_trowel_unbreaking_check matches 1 run return fail
execute if score @s lzt_trowel_unbreaking_check matches 1 run return fail
# Handle Damage
data modify storage lzstools:trowel components set from entity @s SelectedItem.components
execute store result score @s lz_trowel_damage run data get storage lzstools:trowel components."minecraft:damage"
execute store result score @s lz_trowel_max_damage run data get storage lzstools:trowel components."minecraft:max_damage"
scoreboard players add @s lz_trowel_damage 1
execute store result storage lzstools:trowel damage int 1 run scoreboard players get @s lz_trowel_damage
data modify storage lzstools:trowel components set from entity @s equipment.offhand.components
execute store result score @s lzt_trowel_damage run data get storage lzstools:trowel components."minecraft:damage"
execute store result score @s lzt_trowel_max_damage run data get storage lzstools:trowel components."minecraft:max_damage"
scoreboard players add @s lzt_trowel_damage 1
execute store result storage lzstools:trowel damage int 1 run scoreboard players get @s lzt_trowel_damage
function lzstools_trowel:durability/offhand/apply with storage lzstools:trowel
execute if score @s lz_trowel_damage >= @s lz_trowel_max_damage run function lzstools_trowel:durability/offhand/break
execute if score @s lzt_trowel_damage >= @s lzt_trowel_max_damage run function lzstools_trowel:durability/offhand/break

View File

@@ -1,4 +1,4 @@
execute store result score @s lz_trowel_unbreaking_chance run random value 1..100
execute if entity @s[predicate=lzstools:unbreaking/offhand/3] if score @s lz_trowel_unbreaking_chance matches ..75 run return run scoreboard players set @s lz_trowel_unbreaking_check 1
execute if entity @s[predicate=lzstools:unbreaking/offhand/2] if score @s lz_trowel_unbreaking_chance matches ..66 run return run scoreboard players set @s lz_trowel_unbreaking_check 1
execute if entity @s[predicate=lzstools:unbreaking/offhand/1] if score @s lz_trowel_unbreaking_chance matches ..50 run return run scoreboard players set @s lz_trowel_unbreaking_check 1
execute store result score @s lzt_trowel_unbreaking_chance run random value 1..100
execute if entity @s[predicate=lzstools:unbreaking/offhand/3] if score @s lzt_trowel_unbreaking_chance matches ..75 run return run scoreboard players set @s lzt_trowel_unbreaking_check 1
execute if entity @s[predicate=lzstools:unbreaking/offhand/2] if score @s lzt_trowel_unbreaking_chance matches ..66 run return run scoreboard players set @s lzt_trowel_unbreaking_check 1
execute if entity @s[predicate=lzstools:unbreaking/offhand/1] if score @s lzt_trowel_unbreaking_chance matches ..50 run return run scoreboard players set @s lzt_trowel_unbreaking_check 1

View File

@@ -14,14 +14,14 @@ data modify storage lzstools:trowel inventory set from entity @s Inventory
function lzstools_trowel:random/check_hotbar with storage lzstools:trowel
# Get blocks length
execute store result score @s lz_trowel_block_length run data get storage lzstools:trowel blocks
scoreboard players remove @s lz_trowel_block_length 1
execute store result score @s lzt_trowel_block_length run data get storage lzstools:trowel blocks
scoreboard players remove @s lzt_trowel_block_length 1
# Stop if no blocks
execute if score @s lz_trowel_block_length matches ..-1 run return fail
execute if score @s lzt_trowel_block_length matches ..-1 run return fail
# Store result
execute store result storage lzstools:trowel length int 1 run scoreboard players get @s lz_trowel_block_length
execute store result storage lzstools:trowel length int 1 run scoreboard players get @s lzt_trowel_block_length
# Pick Block
execute store result storage lzstools:trowel chosen_index int 1 run function lzstools_trowel:random/random with storage lzstools:trowel

View File

@@ -5,12 +5,15 @@ execute if entity @n[distance=..1] run return fail
function lzstools_trowel:random/start
# No block, don't place and end
execute store result score @s lz_chosen_block_check run data get storage lzstools:trowel chosen_block
execute if score @s lz_chosen_block_check matches 0 run return fail
execute store result score @s lzt_chosen_block_check run data get storage lzstools:trowel chosen_block
execute if score @s lzt_chosen_block_check matches 0 run return fail
execute at @s run playsound minecraft:block.stone.place master @a ~ ~ ~ 1 1.2
execute at @s run playsound minecraft:block.azalea_leaves.place master @a ~ ~ ~ 0.3 1
# Place block
function lzstools_trowel:block/place
# Durability
execute if entity @s[tag=lztools_trowel_mainhand,gamemode=!creative] run function lzstools_trowel:durability/mainhand/handle
execute if entity @s[tag=lztools_trowel_offhand,gamemode=!creative] run function lzstools_trowel:durability/offhand/handle
execute if entity @s[tag=lzstools_trowel_mainhand,gamemode=!creative] run function lzstools_trowel:durability/mainhand/handle
execute if entity @s[tag=lzstools_trowel_offhand,gamemode=!creative] run function lzstools_trowel:durability/offhand/handle

View File

@@ -1,14 +1,14 @@
## Raycast
# Set block data
execute as @s store result score @s lz_trowel_raycast_hit run loot spawn ~ -65 ~ mine ~ ~ ~ minecraft:netherite_pickaxe[minecraft:enchantments={"minecraft:silk_touch":1}]
execute as @s store result score @s lzt_trowel_raycast_hit run loot spawn ~ -65 ~ mine ~ ~ ~ minecraft:netherite_pickaxe[minecraft:enchantments={"minecraft:silk_touch":1}]
execute as @s run kill @n[type=minecraft:item,distance=..0.5,y=-65]
execute as @s if score @s lz_trowel_raycast_hit matches 1 positioned ^ ^ ^-0.01 run function lzstools_trowel:raycast/hit
execute if score @s lz_trowel_raycast_hit matches 1 run tag @s remove lzstools_trowel_mainhand
execute if score @s lz_trowel_raycast_hit matches 1 run tag @s remove lzstools_trowel_offhand
execute as @s if score @s lzt_trowel_raycast_hit matches 1 positioned ^ ^ ^-0.01 run function lzstools_trowel:raycast/hit
execute if score @s lzt_trowel_raycast_hit matches 1 run tag @s remove lzstools_trowel_mainhand
execute if score @s lzt_trowel_raycast_hit matches 1 run tag @s remove lzstools_trowel_offhand
# Advance forward and if nothing found
scoreboard players add #distance lz_trowel_raycast 1
execute if score @s lz_trowel_raycast_hit matches 0 if score #distance lz_trowel_raycast matches ..451 positioned ^ ^ ^0.01 run function lzstools_trowel:raycast/rayloop
scoreboard players add #distance lzt_trowel_raycast 1
execute if score @s lzt_trowel_raycast_hit matches 0 if score #distance lzt_trowel_raycast matches ..451 positioned ^ ^ ^0.01 run function lzstools_trowel:raycast/rayloop

View File

@@ -1,9 +1,9 @@
#Setting up the raycasting data.
scoreboard players set #distance lz_trowel_raycast 0
tag @s add lz_trowel_raycast
scoreboard players set #distance lzt_trowel_raycast 0
tag @s add lzt_trowel_raycast
#Activating the raycast. This function will call itself until it is done.
execute as @e[tag=lz_trowel_raycast] at @s anchored eyes positioned ^ ^ ^ run function lzstools_trowel:raycast/rayloop
execute as @e[tag=lzt_trowel_raycast] at @s anchored eyes positioned ^ ^ ^ run function lzstools_trowel:raycast/rayloop
#Raycasting finished, removing tag from the raycaster.
tag @s remove lz_trowel_raycast
tag @s remove lzt_trowel_raycast