From 8784b377f9ff0243b1adfd92d1b8201924d05127 Mon Sep 17 00:00:00 2001 From: Mark Rapson Date: Sun, 18 May 2025 02:15:33 +0100 Subject: [PATCH] Added Skulls Removed double checks --- data/lzstools/tags/block/skulls.json | 11 ++++++++++ .../function/raycast/loop.mcfunction | 1 + .../function/raycast/partialbox.mcfunction | 1 + .../raycast/partialbox/banners.mcfunction | 2 +- .../partialbox/decorated_pot.mcfunction | 2 +- .../raycast/partialbox/ender_chest.mcfunction | 2 +- .../raycast/partialbox/skulls.mcfunction | 2 ++ .../function/rotate/skulls/click.mcfunction | 13 ++++++++++++ .../function/rotate/skulls/cycle.mcfunction | 18 ++++++++++++++++ .../function/rotate/skulls/flip.mcfunction | 18 ++++++++++++++++ .../function/rotate/skulls/player.mcfunction | 21 +++++++++++++++++++ .../function/rotate/skulls/rotate.mcfunction | 7 +++++++ 12 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 data/lzstools/tags/block/skulls.json create mode 100644 data/lzstools_wrench/function/raycast/partialbox/skulls.mcfunction create mode 100644 data/lzstools_wrench/function/rotate/skulls/click.mcfunction create mode 100644 data/lzstools_wrench/function/rotate/skulls/cycle.mcfunction create mode 100644 data/lzstools_wrench/function/rotate/skulls/flip.mcfunction create mode 100644 data/lzstools_wrench/function/rotate/skulls/player.mcfunction create mode 100644 data/lzstools_wrench/function/rotate/skulls/rotate.mcfunction diff --git a/data/lzstools/tags/block/skulls.json b/data/lzstools/tags/block/skulls.json new file mode 100644 index 0000000..e5f431b --- /dev/null +++ b/data/lzstools/tags/block/skulls.json @@ -0,0 +1,11 @@ +{ + "replace": false, + "values": [ + "minecraft:player_head", + "minecraft:zombie_head", + "minecraft:creeper_head", + "minecraft:skeleton_skull", + "minecraft:wither_skeleton_skull", + "minecraft:dragon_head" + ] +} diff --git a/data/lzstools_wrench/function/raycast/loop.mcfunction b/data/lzstools_wrench/function/raycast/loop.mcfunction index 8921cca..8cf2dfe 100644 --- a/data/lzstools_wrench/function/raycast/loop.mcfunction +++ b/data/lzstools_wrench/function/raycast/loop.mcfunction @@ -8,6 +8,7 @@ execute as @s run execute as @s run kill @n[type=minecraft:item,distance=..0.5,y # Partial Blocks execute if block ~ ~ ~ #lzstools:partialbox run function lzstools_wrench:raycast/partialbox execute if block ~ ~ ~ #lzstools:banners run function lzstools_wrench:raycast/partialbox +execute if block ~ ~ ~ #lzstools:skulls run function lzstools_wrench:raycast/partialbox # Remaining Blocks execute unless block ~ ~ ~ #lzstools:partialbox if block ~ ~ ~ #lzstools:neswud run function lzstools_wrench:rotate/neswud/rotate diff --git a/data/lzstools_wrench/function/raycast/partialbox.mcfunction b/data/lzstools_wrench/function/raycast/partialbox.mcfunction index fd7ca8b..9613604 100644 --- a/data/lzstools_wrench/function/raycast/partialbox.mcfunction +++ b/data/lzstools_wrench/function/raycast/partialbox.mcfunction @@ -5,6 +5,7 @@ function lzstools_wrench:raycast/target_coords # Partial Boxes execute if block ~ ~ ~ #lzstools:banners run function lzstools_wrench:raycast/partialbox/banners +execute if block ~ ~ ~ #lzstools:skulls run function lzstools_wrench:raycast/partialbox/skulls execute if block ~ ~ ~ #minecraft:rails run function lzstools_wrench:raycast/partialbox/rails execute if block ~ ~ ~ #minecraft:trapdoors run function lzstools_wrench:raycast/partialbox/trapdoors execute if block ~ ~ ~ #minecraft:slabs run function lzstools_wrench:raycast/partialbox/slabs diff --git a/data/lzstools_wrench/function/raycast/partialbox/banners.mcfunction b/data/lzstools_wrench/function/raycast/partialbox/banners.mcfunction index 7c13d5a..119dcb5 100644 --- a/data/lzstools_wrench/function/raycast/partialbox/banners.mcfunction +++ b/data/lzstools_wrench/function/raycast/partialbox/banners.mcfunction @@ -1,2 +1,2 @@ # Banners -execute if score px lzt_wrench_raycast matches 4..11 if score pz lzt_wrench_raycast matches 4..11 if block ~ ~ ~ #lzstools:banners run function lzstools_wrench:rotate/banners/rotate \ No newline at end of file +execute if score px lzt_wrench_raycast matches 4..11 if score pz lzt_wrench_raycast matches 4..11 run function lzstools_wrench:rotate/banners/rotate \ No newline at end of file diff --git a/data/lzstools_wrench/function/raycast/partialbox/decorated_pot.mcfunction b/data/lzstools_wrench/function/raycast/partialbox/decorated_pot.mcfunction index 5dc80ec..ba050b6 100644 --- a/data/lzstools_wrench/function/raycast/partialbox/decorated_pot.mcfunction +++ b/data/lzstools_wrench/function/raycast/partialbox/decorated_pot.mcfunction @@ -1,2 +1,2 @@ # Decorated Pot -execute if score px lzt_wrench_raycast matches 1..14 if score pz lzt_wrench_raycast matches 1..14 if block ~ ~ ~ minecraft:decorated_pot run function lzstools_wrench:rotate/nesw/rotate +execute if score px lzt_wrench_raycast matches 1..14 if score pz lzt_wrench_raycast matches 1..14 run function lzstools_wrench:rotate/nesw/rotate diff --git a/data/lzstools_wrench/function/raycast/partialbox/ender_chest.mcfunction b/data/lzstools_wrench/function/raycast/partialbox/ender_chest.mcfunction index 7f43b54..aff1227 100644 --- a/data/lzstools_wrench/function/raycast/partialbox/ender_chest.mcfunction +++ b/data/lzstools_wrench/function/raycast/partialbox/ender_chest.mcfunction @@ -1,2 +1,2 @@ # Ender Chest -execute if score px lzt_wrench_raycast matches 1..14 if score pz lzt_wrench_raycast matches 1..14 if score py lzt_wrench_raycast matches ..14 if block ~ ~ ~ minecraft:ender_chest run function lzstools_wrench:rotate/nesw/rotate +execute if score px lzt_wrench_raycast matches 1..14 if score pz lzt_wrench_raycast matches 1..14 if score py lzt_wrench_raycast matches ..14 run function lzstools_wrench:rotate/nesw/rotate diff --git a/data/lzstools_wrench/function/raycast/partialbox/skulls.mcfunction b/data/lzstools_wrench/function/raycast/partialbox/skulls.mcfunction new file mode 100644 index 0000000..b12b162 --- /dev/null +++ b/data/lzstools_wrench/function/raycast/partialbox/skulls.mcfunction @@ -0,0 +1,2 @@ +# Skulls +execute if score px lzt_wrench_raycast matches 4..11 if score pz lzt_wrench_raycast matches 4..11 if score py lzt_wrench_raycast matches ..7 run function lzstools_wrench:rotate/skulls/rotate \ No newline at end of file diff --git a/data/lzstools_wrench/function/rotate/skulls/click.mcfunction b/data/lzstools_wrench/function/rotate/skulls/click.mcfunction new file mode 100644 index 0000000..d4161ea --- /dev/null +++ b/data/lzstools_wrench/function/rotate/skulls/click.mcfunction @@ -0,0 +1,13 @@ +## Face Click Heads and Skulls + +# Get Raycast Target Coords +function lzstools_wrench:raycast/target_coords + +# Heads and skulls don't have full hitboxes, nothing else uses numeric rotation +$execute as @s[scores={lzt_wrench_success=0}] if score pz lzt_wrench_raycast matches 4 store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=0] replace +$execute as @s[scores={lzt_wrench_success=0}] if score px lzt_wrench_raycast matches 11 store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=4] replace +$execute as @s[scores={lzt_wrench_success=0}] if score pz lzt_wrench_raycast matches 11 store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=8] replace +$execute as @s[scores={lzt_wrench_success=0}] if score px lzt_wrench_raycast matches 4 store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=12] replace + +# Otherwise, Flip +execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run function lzstools_wrench:rotate/skulls/flip with storage lzstools:wrench \ No newline at end of file diff --git a/data/lzstools_wrench/function/rotate/skulls/cycle.mcfunction b/data/lzstools_wrench/function/rotate/skulls/cycle.mcfunction new file mode 100644 index 0000000..62717f3 --- /dev/null +++ b/data/lzstools_wrench/function/rotate/skulls/cycle.mcfunction @@ -0,0 +1,18 @@ +## Cycle Heads and Skulls + +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=0] run setblock ~ ~ ~ $(block)[rotation=1] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=1] run setblock ~ ~ ~ $(block)[rotation=2] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=2] run setblock ~ ~ ~ $(block)[rotation=3] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=3] run setblock ~ ~ ~ $(block)[rotation=4] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=4] run setblock ~ ~ ~ $(block)[rotation=5] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=5] run setblock ~ ~ ~ $(block)[rotation=6] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=6] run setblock ~ ~ ~ $(block)[rotation=7] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=7] run setblock ~ ~ ~ $(block)[rotation=8] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=8] run setblock ~ ~ ~ $(block)[rotation=9] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=9] run setblock ~ ~ ~ $(block)[rotation=10] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=10] run setblock ~ ~ ~ $(block)[rotation=11] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=11] run setblock ~ ~ ~ $(block)[rotation=12] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=12] run setblock ~ ~ ~ $(block)[rotation=13] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=13] run setblock ~ ~ ~ $(block)[rotation=14] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=14] run setblock ~ ~ ~ $(block)[rotation=15] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=15] run setblock ~ ~ ~ $(block)[rotation=0] replace \ No newline at end of file diff --git a/data/lzstools_wrench/function/rotate/skulls/flip.mcfunction b/data/lzstools_wrench/function/rotate/skulls/flip.mcfunction new file mode 100644 index 0000000..30ef044 --- /dev/null +++ b/data/lzstools_wrench/function/rotate/skulls/flip.mcfunction @@ -0,0 +1,18 @@ +## Flip Heads and Skulls + +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=0] run setblock ~ ~ ~ $(block)[rotation=8] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=1] run setblock ~ ~ ~ $(block)[rotation=9] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=2] run setblock ~ ~ ~ $(block)[rotation=10] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=3] run setblock ~ ~ ~ $(block)[rotation=11] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=4] run setblock ~ ~ ~ $(block)[rotation=12] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=5] run setblock ~ ~ ~ $(block)[rotation=13] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=6] run setblock ~ ~ ~ $(block)[rotation=14] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=7] run setblock ~ ~ ~ $(block)[rotation=15] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=8] run setblock ~ ~ ~ $(block)[rotation=0] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=9] run setblock ~ ~ ~ $(block)[rotation=1] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=10] run setblock ~ ~ ~ $(block)[rotation=2] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=11] run setblock ~ ~ ~ $(block)[rotation=3] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=12] run setblock ~ ~ ~ $(block)[rotation=4] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=13] run setblock ~ ~ ~ $(block)[rotation=5] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=14] run setblock ~ ~ ~ $(block)[rotation=6] replace +$execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block)[rotation=15] run setblock ~ ~ ~ $(block)[rotation=7] replace \ No newline at end of file diff --git a/data/lzstools_wrench/function/rotate/skulls/player.mcfunction b/data/lzstools_wrench/function/rotate/skulls/player.mcfunction new file mode 100644 index 0000000..94bb7da --- /dev/null +++ b/data/lzstools_wrench/function/rotate/skulls/player.mcfunction @@ -0,0 +1,21 @@ +## Face Player Heads and Skulls + +$execute as @s[scores={lzt_wrench_success=0}, y_rotation=-11.25..11.25] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=0] replace +$execute as @s[scores={lzt_wrench_success=0}, y_rotation=11.25..33.75] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=1] replace +$execute as @s[scores={lzt_wrench_success=0}, y_rotation=33.75..56.25] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=2] replace +$execute as @s[scores={lzt_wrench_success=0}, y_rotation=56.25..78.75] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=3] replace +$execute as @s[scores={lzt_wrench_success=0}, y_rotation=78.75..101.25] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=4] replace +$execute as @s[scores={lzt_wrench_success=0}, y_rotation=101.25..123.75] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=5] replace +$execute as @s[scores={lzt_wrench_success=0}, y_rotation=123.75..146.25] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=6] replace +$execute as @s[scores={lzt_wrench_success=0}, y_rotation=146.25..168.75] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=7] replace +$execute as @s[scores={lzt_wrench_success=0}, y_rotation=168.75..-168.75] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=8] replace +$execute as @s[scores={lzt_wrench_success=0}, y_rotation=-168.75..-146.25] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=9] replace +$execute as @s[scores={lzt_wrench_success=0}, y_rotation=-146.25..-123.75] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=10] replace +$execute as @s[scores={lzt_wrench_success=0}, y_rotation=-123.75..-101.25] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=11] replace +$execute as @s[scores={lzt_wrench_success=0}, y_rotation=-101.25..-78.75] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=12] replace +$execute as @s[scores={lzt_wrench_success=0}, y_rotation=-78.75..-56.25] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=13] replace +$execute as @s[scores={lzt_wrench_success=0}, y_rotation=-56.25..-33.75] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=14] replace +$execute as @s[scores={lzt_wrench_success=0}, y_rotation=-33.75..-11.25] store result score @s lzt_wrench_success run execute if block ~ ~ ~ $(block) run setblock ~ ~ ~ $(block)[rotation=15] replace + +# Otherwise, Flip +execute as @s[scores={lzt_wrench_success=0}] store result score @s lzt_wrench_success run function lzstools_wrench:rotate/skulls/flip with storage lzstools:wrench \ No newline at end of file diff --git a/data/lzstools_wrench/function/rotate/skulls/rotate.mcfunction b/data/lzstools_wrench/function/rotate/skulls/rotate.mcfunction new file mode 100644 index 0000000..330b8b7 --- /dev/null +++ b/data/lzstools_wrench/function/rotate/skulls/rotate.mcfunction @@ -0,0 +1,7 @@ +## Heads and Skulls + +# Rotate Based on Wrench Mode +execute as @s[scores={lzt_wrench_success=0},nbt={SelectedItem:{components:{"minecraft:lore":["Flip"]}}}] run function lzstools_wrench:rotate/skulls/flip with storage lzstools:wrench +execute as @s[scores={lzt_wrench_success=0},nbt={SelectedItem:{components:{"minecraft:lore":["Face Player"]}}}] run function lzstools_wrench:rotate/skulls/player with storage lzstools:wrench +execute as @s[scores={lzt_wrench_success=0},nbt={SelectedItem:{components:{"minecraft:lore":["Face Click"]}}}] run function lzstools_wrench:rotate/skulls/click with storage lzstools:wrench +execute as @s[scores={lzt_wrench_success=0}] run function lzstools_wrench:rotate/skulls/cycle with storage lzstools:wrench \ No newline at end of file