This commit is contained in:
16
data/lzstools_chisel/function/raycast/hit.mcfunction
Normal file
16
data/lzstools_chisel/function/raycast/hit.mcfunction
Normal file
@@ -0,0 +1,16 @@
|
||||
# Get Slot and block
|
||||
function lzstools_chisel:select/start
|
||||
|
||||
# No block, don't place and end
|
||||
execute store result score @s lzt_chisel_block_check run data get storage lzstools:chisel chosen_block
|
||||
execute if score @s lzt_chisel_block_check matches 0 run return fail
|
||||
|
||||
# Place block
|
||||
function lzstools_chisel:block/place with storage lzstools:chisel
|
||||
|
||||
execute if score @s lzt_chisel_success matches 0 run return fail
|
||||
execute at @s run playsound minecraft:block.azalea_leaves.place master @a ~ ~ ~ 0.3 1
|
||||
|
||||
# Durability
|
||||
execute if entity @s[tag=lzstools_chisel_mainhand,gamemode=!creative] run function lzstools_chisel:durability/mainhand/handle
|
||||
execute if entity @s[tag=lzstools_chisel_offhand,gamemode=!creative] run function lzstools_chisel:durability/offhand/handle
|
12
data/lzstools_chisel/function/raycast/loop.mcfunction
Normal file
12
data/lzstools_chisel/function/raycast/loop.mcfunction
Normal file
@@ -0,0 +1,12 @@
|
||||
## Raycast
|
||||
|
||||
# Set block data
|
||||
execute as @s store result score @s lzt_chisel_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 lzt_chisel_raycast_hit matches 1 run function lzstools_chisel:raycast/hit
|
||||
execute if score @s lzt_chisel_raycast_hit matches 1 run tag @s remove lzstools_chisel_mainhand
|
||||
|
||||
# Advance forward and if nothing found
|
||||
scoreboard players add #distance lzt_chisel_raycast 1
|
||||
execute if score @s lzt_chisel_raycast_hit matches 0 if score #distance lzt_chisel_raycast matches ..451 positioned ^ ^ ^0.01 run function lzstools_chisel:raycast/loop
|
11
data/lzstools_chisel/function/raycast/start.mcfunction
Normal file
11
data/lzstools_chisel/function/raycast/start.mcfunction
Normal file
@@ -0,0 +1,11 @@
|
||||
#Setting up the raycasting data.
|
||||
scoreboard players set #distance lzt_chisel_raycast 0
|
||||
|
||||
#Activating the raycast. This function will call itself until it is done.
|
||||
execute as @s at @s anchored eyes positioned ^ ^ ^ anchored feet run function lzstools_chisel:raycast/loop
|
||||
|
||||
# Clean Data
|
||||
data remove storage lzstools:chisel inventory
|
||||
data remove storage lzstools:chisel damage
|
||||
data remove storage lzstools:chisel chosen_block
|
||||
data remove storage lzstools:chisel chosen_slot
|
Reference in New Issue
Block a user