Added Crafter and raligned file depth

This commit is contained in:
2024-11-06 18:31:37 +00:00
parent f7a37a68b9
commit c35e52cf17
71 changed files with 58 additions and 1 deletions

View File

@@ -0,0 +1,41 @@
#Raycast Partial-box
### Get Raycast Target Coords
# Stored Value for Calc
scoreboard players set c16 WrenchRaycast 16
# Summon Invisible Entity
summon area_effect_cloud ~ ~ ~ {Radius:0.01,Duration:1,Tags:["RaycastMark"]}
# Pixel Calculations
execute store result score px WrenchRaycast run data get entity @e[tag=RaycastMark,sort=nearest,limit=1] Pos[0] 16
scoreboard players operation px WrenchRaycast %= c16 WrenchRaycast
execute if score px WrenchRaycast matches ..-1 run scoreboard players add px WrenchRaycast 16
execute store result score py WrenchRaycast run data get entity @e[tag=RaycastMark,sort=nearest,limit=1] Pos[1] 16
scoreboard players operation py WrenchRaycast %= c16 WrenchRaycast
execute if score py WrenchRaycast matches ..-1 run scoreboard players add py WrenchRaycast 16
execute store result score pz WrenchRaycast run data get entity @e[tag=RaycastMark,sort=nearest,limit=1] Pos[2] 16
scoreboard players operation pz WrenchRaycast %= c16 WrenchRaycast
execute if score pz WrenchRaycast matches ..-1 run scoreboard players add pz WrenchRaycast 16
# Remove Entity
kill @e[tag=RaycastMark,sort=nearest,limit=1]
### Partial Boxes
# Calculate partial-box
#Rails
execute if block ~ ~ ~ #minecraft:rails unless score WrenchRails WrenchConfig matches 0 run function wrench:raycast/partialbox/rails
#Redstone
execute if block ~ ~ ~ minecraft:repeater unless score WrenchRedstone WrenchConfig matches 0 if score py WrenchRaycast matches ..1 run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:comparator unless score WrenchRedstone WrenchConfig matches 0 if score py WrenchRaycast matches ..1 run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:calibrated_sculk_sensor unless score WrenchRedstone WrenchConfig matches 0 if score py WrenchRaycast matches ..7 run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:piston unless score WrenchRedstone WrenchConfig matches 0 run function wrench:raycast/partialbox/pistons
execute if block ~ ~ ~ minecraft:sticky_piston unless score WrenchRedstone WrenchConfig matches 0 run function wrench:raycast/partialbox/sticky_pistons
execute if block ~ ~ ~ minecraft:hopper unless score WrenchRedstone WrenchConfig matches 0 run function wrench:raycast/partialbox/hoppers
#Blocks
execute if block ~ ~ ~ #minecraft:slabs unless score WrenchSlabs WrenchConfig matches 0 run function wrench:raycast/partialbox/slabs
execute if block ~ ~ ~ #minecraft:stairs unless score WrenchStairs WrenchConfig matches 0 run function wrench:raycast/partialbox/stairs
execute if block ~ ~ ~ minecraft:end_rod unless score WrenchRods WrenchConfig matches 0 run function wrench:raycast/partialbox/end_rods

View File

@@ -0,0 +1,7 @@
#End rods
execute if block ~ ~ ~ minecraft:end_rod[facing=up] if score px WrenchRaycast matches 6..9 if score pz WrenchRaycast matches 6..9 run function wrench:rotate/end_rod_flip
execute if block ~ ~ ~ minecraft:end_rod[facing=down] if score px WrenchRaycast matches 6..9 if score pz WrenchRaycast matches 6..9 run function wrench:rotate/end_rod_flip
execute if block ~ ~ ~ minecraft:end_rod[facing=south] if score px WrenchRaycast matches 6..9 if score py WrenchRaycast matches 6..9 run function wrench:rotate/end_rod_flip
execute if block ~ ~ ~ minecraft:end_rod[facing=north] if score px WrenchRaycast matches 6..9 if score py WrenchRaycast matches 6..9 run function wrench:rotate/end_rod_flip
execute if block ~ ~ ~ minecraft:end_rod[facing=east] if score py WrenchRaycast matches 6..9 if score pz WrenchRaycast matches 6..9 run function wrench:rotate/end_rod_flip
execute if block ~ ~ ~ minecraft:end_rod[facing=west] if score py WrenchRaycast matches 6..9 if score pz WrenchRaycast matches 6..9 run function wrench:rotate/end_rod_flip

View File

@@ -0,0 +1,8 @@
# Hopper
execute if block ~ ~ ~ minecraft:hopper[facing=down] if score px WrenchRaycast matches 6..9 if score py WrenchRaycast matches ..3 if score pz WrenchRaycast matches 6..9 run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:hopper[facing=south] if score px WrenchRaycast matches 6..9 if score py WrenchRaycast matches 4..7 if score pz WrenchRaycast matches 12.. run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:hopper[facing=north] if score px WrenchRaycast matches 6..9 if score py WrenchRaycast matches 4..7 if score pz WrenchRaycast matches ..3 run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:hopper[facing=east] if score px WrenchRaycast matches 12.. if score py WrenchRaycast matches 4..7 if score pz WrenchRaycast matches 6..9 run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:hopper[facing=west] if score px WrenchRaycast matches ..3 if score py WrenchRaycast matches 4..7 if score pz WrenchRaycast matches 6..9 run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:hopper if score px WrenchRaycast matches 4..11 if score py WrenchRaycast matches 4.. if score pz WrenchRaycast matches 4..11 run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:hopper if score py WrenchRaycast matches 10.. run function wrench:rotate/redstone

View File

@@ -0,0 +1,8 @@
# Piston
execute if block ~ ~ ~ minecraft:piston[extended=false] run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:piston[facing=up] if score py WrenchRaycast matches ..11 run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:piston[facing=down] if score py WrenchRaycast matches 4.. run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:piston[facing=south] if score pz WrenchRaycast matches ..11 run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:piston[facing=north] if score pz WrenchRaycast matches 4.. run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:piston[facing=east] if score px WrenchRaycast matches ..11 run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:piston[facing=west] if score px WrenchRaycast matches 4.. run function wrench:rotate/redstone

View File

@@ -0,0 +1,6 @@
# Rails
execute if block ~ ~ ~ #minecraft:rails if score py WrenchRaycast matches ..1 run function wrench:rotate/rails
execute if block ~ ~ ~ #minecraft:rails[shape=ascending_west] if score py WrenchRaycast matches ..7 run function wrench:rotate/rails
execute if block ~ ~ ~ #minecraft:rails[shape=ascending_east] if score py WrenchRaycast matches ..7 run function wrench:rotate/rails
execute if block ~ ~ ~ #minecraft:rails[shape=ascending_north] if score py WrenchRaycast matches ..7 run function wrench:rotate/rails
execute if block ~ ~ ~ #minecraft:rails[shape=ascending_south] if score py WrenchRaycast matches ..7 run function wrench:rotate/rails

View File

@@ -0,0 +1,3 @@
# Slabs
execute if block ~ ~ ~ #minecraft:slabs[type=top] if score py WrenchRaycast matches 8.. run function wrench:rotate/slabs_flip
execute if block ~ ~ ~ #minecraft:slabs[type=bottom] if score py WrenchRaycast matches ..7 run function wrench:rotate/slabs_flip

View File

@@ -0,0 +1,19 @@
#Stairs
execute if block ~ ~ ~ #minecraft:stairs[half=bottom] if score py WrenchRaycast matches ..7 run function wrench:rotate/stairs
execute if block ~ ~ ~ #minecraft:stairs[half=top] if score py WrenchRaycast matches 8.. run function wrench:rotate/stairs
# -x-z
execute if block ~ ~ ~ #minecraft:stairs if score px WrenchRaycast matches ..7 if score pz WrenchRaycast matches ..7 unless block ~ ~ ~ #minecraft:stairs[facing=west,shape=outer_left] unless block ~ ~ ~ #minecraft:stairs[facing=north,shape=outer_right] unless block ~ ~ ~ #minecraft:stairs[facing=east] unless block ~ ~ ~ #minecraft:stairs[facing=south] run function wrench:rotate/stairs
execute if block ~ ~ ~ #minecraft:stairs if score px WrenchRaycast matches ..7 if score pz WrenchRaycast matches ..7 if block ~ ~ ~ #minecraft:stairs[facing=east,shape=inner_left] run function wrench:rotate/stairs
execute if block ~ ~ ~ #minecraft:stairs if score px WrenchRaycast matches ..7 if score pz WrenchRaycast matches ..7 if block ~ ~ ~ #minecraft:stairs[facing=south,shape=inner_right] run function wrench:rotate/stairs
# -x+z
execute if block ~ ~ ~ #minecraft:stairs if score px WrenchRaycast matches ..7 if score pz WrenchRaycast matches 8.. unless block ~ ~ ~ #minecraft:stairs[facing=south,shape=outer_left] unless block ~ ~ ~ #minecraft:stairs[facing=west,shape=outer_right] unless block ~ ~ ~ #minecraft:stairs[facing=north] unless block ~ ~ ~ #minecraft:stairs[facing=east] run function wrench:rotate/stairs
execute if block ~ ~ ~ #minecraft:stairs if score px WrenchRaycast matches ..7 if score pz WrenchRaycast matches 8.. if block ~ ~ ~ #minecraft:stairs[facing=north,shape=inner_left] run function wrench:rotate/stairs
execute if block ~ ~ ~ #minecraft:stairs if score px WrenchRaycast matches ..7 if score pz WrenchRaycast matches 8.. if block ~ ~ ~ #minecraft:stairs[facing=east,shape=inner_right] run function wrench:rotate/stairs
# +x+z
execute if block ~ ~ ~ #minecraft:stairs if score px WrenchRaycast matches 8.. if score pz WrenchRaycast matches 8.. unless block ~ ~ ~ #minecraft:stairs[facing=east,shape=outer_left] unless block ~ ~ ~ #minecraft:stairs[facing=south,shape=outer_right] unless block ~ ~ ~ #minecraft:stairs[facing=west] unless block ~ ~ ~ #minecraft:stairs[facing=north] run function wrench:rotate/stairs
execute if block ~ ~ ~ #minecraft:stairs if score px WrenchRaycast matches 8.. if score pz WrenchRaycast matches 8.. if block ~ ~ ~ #minecraft:stairs[facing=west,shape=inner_left] run function wrench:rotate/stairs
execute if block ~ ~ ~ #minecraft:stairs if score px WrenchRaycast matches 8.. if score pz WrenchRaycast matches 8.. if block ~ ~ ~ #minecraft:stairs[facing=north,shape=inner_right] run function wrench:rotate/stairs
# +x-z
execute if block ~ ~ ~ #minecraft:stairs if score px WrenchRaycast matches 8.. if score pz WrenchRaycast matches ..7 unless block ~ ~ ~ #minecraft:stairs[facing=north,shape=outer_left] unless block ~ ~ ~ #minecraft:stairs[facing=east,shape=outer_right] unless block ~ ~ ~ #minecraft:stairs[facing=south] unless block ~ ~ ~ #minecraft:stairs[facing=west] run function wrench:rotate/stairs
execute if block ~ ~ ~ #minecraft:stairs if score px WrenchRaycast matches 8.. if score pz WrenchRaycast matches ..7 if block ~ ~ ~ #minecraft:stairs[facing=south,shape=inner_left] run function wrench:rotate/stairs
execute if block ~ ~ ~ #minecraft:stairs if score px WrenchRaycast matches 8.. if score pz WrenchRaycast matches ..7 if block ~ ~ ~ #minecraft:stairs[facing=west,shape=inner_right] run function wrench:rotate/stairs

View File

@@ -0,0 +1,8 @@
#Sticky pistons
execute if block ~ ~ ~ minecraft:sticky_piston[extended=false] run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:sticky_piston[facing=up] if score py WrenchRaycast matches ..11 run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:sticky_piston[facing=down] if score py WrenchRaycast matches 4.. run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:sticky_piston[facing=south] if score pz WrenchRaycast matches ..11 run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:sticky_piston[facing=north] if score pz WrenchRaycast matches 4.. run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:sticky_piston[facing=east] if score px WrenchRaycast matches ..11 run function wrench:rotate/redstone
execute if block ~ ~ ~ minecraft:sticky_piston[facing=west] if score px WrenchRaycast matches 4.. run function wrench:rotate/redstone

View File

@@ -0,0 +1,20 @@
### Test Block Detected
# Partial Blocks
execute if block ~ ~ ~ #wrench:partialbox run function wrench:raycast/partialbox
# Remaining Blocks
execute unless block ~ ~ ~ #wrench:partialbox unless score WrenchRedstone WrenchConfig matches 0 if block ~ ~ ~ #wrench:redstone run function wrench:rotate/redstone
execute unless block ~ ~ ~ #wrench:partialbox unless score WrenchPillars WrenchConfig matches 0 if block ~ ~ ~ #wrench:pillars run function wrench:rotate/pillars
execute unless block ~ ~ ~ #wrench:partialbox unless score WrenchTerracotta WrenchConfig matches 0 if block ~ ~ ~ #wrench:glazed_terracotta run function wrench:rotate/glazed_terracotta
execute as @s[scores={WrenchSuccess=1..}] if block ~ ~ ~ #wrench:updates run clone ~-1 ~ ~ ~1 ~ ~ ~-1 ~ ~ replace force
execute as @s[scores={WrenchSuccess=1..}] if block ~ ~ ~ #wrench:updates run clone ~ ~ ~-1 ~ ~ ~1 ~ ~ ~-1 replace force
execute as @s[scores={WrenchSuccess=1..}] run playsound minecraft:entity.item_frame.rotate_item block @s ~ ~ ~
# Raycast Debug
execute if score WrenchDebug WrenchConfig matches 1 run summon area_effect_cloud ~ ~ ~ {Particle:happy_villager,Radius:0.01,Duration:2}
# Advance forward and if nothing found
scoreboard players add #distance WrenchRaycast 1
execute if score @s WrenchSuccess matches 0 if score #distance WrenchRaycast matches ..350 positioned ^ ^ ^0.01 run function wrench:raycast/rayloop

View File

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