This commit is contained in:
7
data/lzstools_chisel/function/block/place.mcfunction
Normal file
7
data/lzstools_chisel/function/block/place.mcfunction
Normal file
@@ -0,0 +1,7 @@
|
||||
scoreboard players set @s lzt_chisel_success 0
|
||||
|
||||
# Don't place if same block
|
||||
$execute if block ~ ~ ~ $(chosen_block) run return fail
|
||||
|
||||
execute if score @s lzt_chisel_success matches 0 run function lzstools_chisel:block/place_normal with storage lzstools:chisel
|
||||
execute if score @s lzt_chisel_success matches 1 run function lzstools_chisel:block/remove_item with storage lzstools:chisel
|
@@ -0,0 +1,2 @@
|
||||
# Place Leaves
|
||||
$execute as @s store result score @s lzt_chisel_success setblock ~ ~ ~ $(chosen_block)[persistent=true] destroy
|
@@ -0,0 +1,5 @@
|
||||
# Place NESW
|
||||
$execute as @s[y_rotation=-45..45] store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[facing=north] destroy
|
||||
$execute as @s[y_rotation=45..135] store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[facing=east] destroy
|
||||
$execute as @s[y_rotation=135..-135] store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[facing=south] destroy
|
||||
$execute as @s[y_rotation=-135..-45] store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[facing=west] destroy
|
@@ -0,0 +1,7 @@
|
||||
# Place NESWUD
|
||||
$execute as @s[x_rotation=45..90] store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[facing=up] destroy
|
||||
$execute as @s[x_rotation=-90..-45] store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[facing=down] destroy
|
||||
$execute as @s[x_rotation=-45..45, y_rotation=-45..45] store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[facing=north] destroy
|
||||
$execute as @s[x_rotation=-45..45, y_rotation=45..135] store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[facing=east] destroy
|
||||
$execute as @s[x_rotation=-45..45, y_rotation=135..-135] store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[facing=south] destroy
|
||||
$execute as @s[x_rotation=-45..45, y_rotation=-135..-45] store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[facing=west] destroy
|
@@ -0,0 +1,3 @@
|
||||
# Place Slabs
|
||||
$execute as @s if score py lzt_chisel_raycast matches 8.. store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[type=top] destroy
|
||||
$execute as @s if score py lzt_chisel_raycast matches ..7 store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[type=bottom] destroy
|
@@ -0,0 +1,9 @@
|
||||
# Place Stairs
|
||||
$execute as @s[y_rotation=-45..45] if score py lzt_chisel_raycast matches ..7 store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=south] destroy
|
||||
$execute as @s[y_rotation=45..135] if score py lzt_chisel_raycast matches ..7 store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=west] destroy
|
||||
$execute as @s[y_rotation=135..-135] if score py lzt_chisel_raycast matches ..7 store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=north] destroy
|
||||
$execute as @s[y_rotation=-135..-45] if score py lzt_chisel_raycast matches ..7 store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=east] destroy
|
||||
$execute as @s[y_rotation=-45..45] if score py lzt_chisel_raycast matches 8.. store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=south] destroy
|
||||
$execute as @s[y_rotation=45..135] if score py lzt_chisel_raycast matches 8.. store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=west] destroy
|
||||
$execute as @s[y_rotation=135..-135] if score py lzt_chisel_raycast matches 8.. store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=north] destroy
|
||||
$execute as @s[y_rotation=-135..-45] if score py lzt_chisel_raycast matches 8.. store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=east] destroy
|
@@ -0,0 +1,10 @@
|
||||
# Place Trapdoors
|
||||
$execute as @s[y_rotation=-45..45] if score py lzt_chisel_raycast matches ..7 store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=north] destroy
|
||||
$execute as @s[y_rotation=45..135] if score py lzt_chisel_raycast matches ..7 store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=east] destroy
|
||||
$execute as @s[y_rotation=135..-135] if score py lzt_chisel_raycast matches ..7 store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=south] destroy
|
||||
$execute as @s[y_rotation=-135..-45] if score py lzt_chisel_raycast matches ..7 store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[half=bottom,facing=west] destroy
|
||||
$execute as @s[y_rotation=-45..45] if score py lzt_chisel_raycast matches 8.. store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=north] destroy
|
||||
$execute as @s[y_rotation=45..135] if score py lzt_chisel_raycast matches 8.. store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=east] destroy
|
||||
$execute as @s[y_rotation=135..-135] if score py lzt_chisel_raycast matches 8.. store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=south] destroy
|
||||
$execute as @s[y_rotation=-135..-45] if score py lzt_chisel_raycast matches 8.. store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[half=top,facing=west] destroy
|
||||
|
7
data/lzstools_chisel/function/block/place/xyz.mcfunction
Normal file
7
data/lzstools_chisel/function/block/place/xyz.mcfunction
Normal file
@@ -0,0 +1,7 @@
|
||||
# Place XYZ
|
||||
$execute as @s if score py lzt_chisel_raycast matches 0 store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[axis=y] destroy
|
||||
$execute as @s if score py lzt_chisel_raycast matches 15 store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[axis=y] destroy
|
||||
$execute as @s if score px lzt_chisel_raycast matches 0 store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[axis=x] destroy
|
||||
$execute as @s if score px lzt_chisel_raycast matches 15 store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[axis=x] destroy
|
||||
$execute as @s if score pz lzt_chisel_raycast matches 0 store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[axis=z] destroy
|
||||
$execute as @s if score pz lzt_chisel_raycast matches 15 store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block)[axis=z] destroy
|
16
data/lzstools_chisel/function/block/place_normal.mcfunction
Normal file
16
data/lzstools_chisel/function/block/place_normal.mcfunction
Normal file
@@ -0,0 +1,16 @@
|
||||
# Get Raycast Target Coords
|
||||
function lzstools_chisel:block/target_coords
|
||||
|
||||
$setblock ~ -64 ~ $(chosen_block)
|
||||
|
||||
execute if score @s lzt_chisel_success matches 0 if block ~ -64 ~ #lzstools:xyz run function lzstools_chisel:block/place/xyz with storage lzstools:chisel
|
||||
execute if score @s lzt_chisel_success matches 0 if block ~ -64 ~ #lzstools:neswud run function lzstools_chisel:block/place/neswud with storage lzstools:chisel
|
||||
execute if score @s lzt_chisel_success matches 0 if block ~ -64 ~ #lzstools:nesw run function lzstools_chisel:block/place/nesw with storage lzstools:chisel
|
||||
execute if score @s lzt_chisel_success matches 0 if block ~ -64 ~ #lzstools:glazed_terracotta run function lzstools_chisel:block/place/nesw with storage lzstools:chisel
|
||||
execute if score @s lzt_chisel_success matches 0 if block ~ -64 ~ #minecraft:leaves run function lzstools_chisel:block/place/leaves with storage lzstools:chisel
|
||||
execute if score @s lzt_chisel_success matches 0 if block ~ -64 ~ #minecraft:trapdoors run function lzstools_chisel:block/place/trapdoors with storage lzstools:chisel
|
||||
execute if score @s lzt_chisel_success matches 0 if block ~ -64 ~ #minecraft:stairs run function lzstools_chisel:block/place/stairs with storage lzstools:chisel
|
||||
execute if score @s lzt_chisel_success matches 0 if block ~ -64 ~ #minecraft:slabs run function lzstools_chisel:block/place/slabs with storage lzstools:chisel
|
||||
$execute if score @s lzt_chisel_success matches 0 store result score @s lzt_chisel_success run setblock ~ ~ ~ $(chosen_block) destroy
|
||||
|
||||
setblock ~ -64 ~ bedrock
|
@@ -0,0 +1 @@
|
||||
$execute if entity @s[gamemode=!creative] run clear @s $(chosen_block) 1
|
22
data/lzstools_chisel/function/block/target_coords.mcfunction
Normal file
22
data/lzstools_chisel/function/block/target_coords.mcfunction
Normal file
@@ -0,0 +1,22 @@
|
||||
## Get Raycast Target Coords
|
||||
|
||||
# Stored Value for Calc
|
||||
scoreboard players set c16 lzt_chisel_raycast 16
|
||||
# Summon Invisible Entity
|
||||
summon area_effect_cloud ~ ~ ~ {Radius:0.01,Duration:1,Tags:["RaycastMark"]}
|
||||
|
||||
# Pixel Calculations
|
||||
execute store result score px lzt_chisel_raycast run data get entity @e[tag=RaycastMark,sort=nearest,limit=1] Pos[0] 16
|
||||
scoreboard players operation px lzt_chisel_raycast %= c16 lzt_chisel_raycast
|
||||
execute if score px lzt_chisel_raycast matches ..-1 run scoreboard players add px lzt_chisel_raycast 16
|
||||
|
||||
execute store result score py lzt_chisel_raycast run data get entity @e[tag=RaycastMark,sort=nearest,limit=1] Pos[1] 16
|
||||
scoreboard players operation py lzt_chisel_raycast %= c16 lzt_chisel_raycast
|
||||
execute if score py lzt_chisel_raycast matches ..-1 run scoreboard players add py lzt_chisel_raycast 16
|
||||
|
||||
execute store result score pz lzt_chisel_raycast run data get entity @e[tag=RaycastMark,sort=nearest,limit=1] Pos[2] 16
|
||||
scoreboard players operation pz lzt_chisel_raycast %= c16 lzt_chisel_raycast
|
||||
execute if score pz lzt_chisel_raycast matches ..-1 run scoreboard players add pz lzt_chisel_raycast 16
|
||||
|
||||
# Remove Entity
|
||||
kill @e[tag=RaycastMark,sort=nearest,limit=1]
|
Reference in New Issue
Block a user