diff --git a/assets/lzstools/models/items/chisel/diamond.json b/assets/lzstools/models/items/chisel/diamond.json new file mode 100644 index 0000000..6e2e771 --- /dev/null +++ b/assets/lzstools/models/items/chisel/diamond.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "lzstools:item/chisel/diamond" + } +} \ No newline at end of file diff --git a/assets/lzstools/models/items/chisel/iron.json b/assets/lzstools/models/items/chisel/iron.json new file mode 100644 index 0000000..9ba71a0 --- /dev/null +++ b/assets/lzstools/models/items/chisel/iron.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "lzstools:item/chisel/iron" + } +} \ No newline at end of file diff --git a/assets/lzstools/textures/item/chisel/diamond.png b/assets/lzstools/textures/item/chisel/diamond.png new file mode 100644 index 0000000..793a512 Binary files /dev/null and b/assets/lzstools/textures/item/chisel/diamond.png differ diff --git a/assets/lzstools/textures/item/chisel/iron.png b/assets/lzstools/textures/item/chisel/iron.png new file mode 100644 index 0000000..554af0f Binary files /dev/null and b/assets/lzstools/textures/item/chisel/iron.png differ diff --git a/assets/minecraft/items/carrot_on_a_stick.json b/assets/minecraft/items/carrot_on_a_stick.json index 4e4873f..eabea0e 100644 --- a/assets/minecraft/items/carrot_on_a_stick.json +++ b/assets/minecraft/items/carrot_on_a_stick.json @@ -55,6 +55,20 @@ "type": "model", "model": "lzstools:items/trowel/diamond" } + }, + { + "when": "lzstools:chisel_iron", + "model": { + "type": "model", + "model": "lzstools:items/chisel/iron" + } + }, + { + "when": "lzstools:chisel_diamond", + "model": { + "type": "model", + "model": "lzstools:items/chisel/diamond" + } } ] } diff --git a/data/lzstools/advancement/visible/chisel_diamond.json b/data/lzstools/advancement/visible/chisel_diamond.json new file mode 100644 index 0000000..d61d825 --- /dev/null +++ b/data/lzstools/advancement/visible/chisel_diamond.json @@ -0,0 +1,32 @@ +{ + "display": { + "icon": { + "id": "minecraft:carrot_on_a_stick", + "components": { + "minecraft:custom_model_data": { + "strings": [ + "lzstools:chisel_diamond" + ] + } + } + }, + "title": { + "text": "As flawless as Michelangelo" + }, + "description": { + "text": "Craft a Diamond Chisel" + }, + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "parent": "lzstools:visible/chisel_iron", + "criteria": { + "": { + "trigger": "minecraft:recipe_crafted", + "conditions": { + "recipe_id": "lzstools_chisel:diamond" + } + } + } +} \ No newline at end of file diff --git a/data/lzstools/advancement/visible/chisel_iron.json b/data/lzstools/advancement/visible/chisel_iron.json new file mode 100644 index 0000000..99f8fd9 --- /dev/null +++ b/data/lzstools/advancement/visible/chisel_iron.json @@ -0,0 +1,32 @@ +{ + "display": { + "icon": { + "id": "minecraft:carrot_on_a_stick", + "components": { + "minecraft:custom_model_data": { + "strings": [ + "lzstools:chisel_iron" + ] + } + } + }, + "title": { + "text": "Just take a stab at it" + }, + "description": { + "text": "Craft a Chisel" + }, + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "parent": "lzstools:visible/root", + "criteria": { + "": { + "trigger": "minecraft:recipe_crafted", + "conditions": { + "recipe_id": "lzstools_chisel:iron" + } + } + } +} \ No newline at end of file diff --git a/data/lzstools/function/check_click.mcfunction b/data/lzstools/function/check_click.mcfunction index dbb5cb7..c5eb6d6 100644 --- a/data/lzstools/function/check_click.mcfunction +++ b/data/lzstools/function/check_click.mcfunction @@ -6,4 +6,7 @@ execute if predicate lzstools:wrench/offhand run function lzstools_wrench:wrench # Trowel execute if predicate lzstools:trowel/mainhand run function lzstools_trowel:mainhand -execute if predicate lzstools:trowel/offhand run function lzstools_trowel:offhand \ No newline at end of file +execute if predicate lzstools:trowel/offhand run function lzstools_trowel:offhand + +# Chisel +execute if predicate lzstools:chisel/mainhand run function lzstools_chisel:mainhand \ No newline at end of file diff --git a/data/lzstools/function/give/chisel_diamond.mcfunction b/data/lzstools/function/give/chisel_diamond.mcfunction new file mode 100644 index 0000000..728520d --- /dev/null +++ b/data/lzstools/function/give/chisel_diamond.mcfunction @@ -0,0 +1 @@ +give @s minecraft:carrot_on_a_stick[minecraft:item_name={"text":"Diamond Chisel","color":"aqua"},minecraft:custom_model_data={strings:["lzstools:chisel_diamond"]},minecraft:custom_data={"lzstools":["chisel","chisel_diamond"]},minecraft:max_damage=2100] \ No newline at end of file diff --git a/data/lzstools/function/give/chisel_iron.mcfunction b/data/lzstools/function/give/chisel_iron.mcfunction new file mode 100644 index 0000000..7f23f82 --- /dev/null +++ b/data/lzstools/function/give/chisel_iron.mcfunction @@ -0,0 +1 @@ +give @s minecraft:carrot_on_a_stick[minecraft:item_name={"text":"Iron Chisel","color":"aqua"},minecraft:custom_model_data={strings:["lzstools:chisel_iron"]},minecraft:custom_data={"lzstools":["chisel","chisel_iron"]},minecraft:max_damage=350] \ No newline at end of file diff --git a/data/lzstools/function/load.mcfunction b/data/lzstools/function/load.mcfunction index 6532d93..9ef7625 100644 --- a/data/lzstools/function/load.mcfunction +++ b/data/lzstools/function/load.mcfunction @@ -16,6 +16,16 @@ scoreboard objectives add lzt_trowel_unbreaking_chance dummy scoreboard objectives add lzt_trowel_damage dummy scoreboard objectives add lzt_trowel_max_damage dummy +# Chisel +scoreboard objectives add lzt_chisel_success dummy +scoreboard objectives add lzt_chisel_raycast dummy +scoreboard objectives add lzt_chisel_raycast_hit dummy +scoreboard objectives add lzt_chisel_slot dummy +scoreboard objectives add lzt_chisel_unbreaking_check dummy +scoreboard objectives add lzt_chisel_unbreaking_chance dummy +scoreboard objectives add lzt_chisel_damage dummy +scoreboard objectives add lzt_chisel_max_damage dummy + # Hammer scoreboard objectives add lzt_hammer_check minecraft.used:minecraft.iron_pickaxe scoreboard objectives add lzt_hammer_success dummy diff --git a/data/lzstools/function/recipes.mcfunction b/data/lzstools/function/recipes.mcfunction index a8f44d4..a500a25 100644 --- a/data/lzstools/function/recipes.mcfunction +++ b/data/lzstools/function/recipes.mcfunction @@ -1,4 +1,6 @@ recipe give @s lzstools_wrench:wrench recipe give @s lzstools_trowel:iron recipe give @s lzstools_trowel:diamond +recipe give @s lzstools_chisel:iron +recipe give @s lzstools_chisel:diamond recipe give @s lzstools_hammer:hammer \ No newline at end of file diff --git a/data/lzstools/function/uninstall.mcfunction b/data/lzstools/function/uninstall.mcfunction index 365024b..5e24eb8 100644 --- a/data/lzstools/function/uninstall.mcfunction +++ b/data/lzstools/function/uninstall.mcfunction @@ -18,6 +18,17 @@ scoreboard objectives remove lzt_trowel_unbreaking_chance scoreboard objectives remove lzt_trowel_damage scoreboard objectives remove lzt_trowel_max_damage +# Trowel +scoreboard objectives remove lzt_trowel_success dummy +scoreboard objectives remove lzt_trowel_raycast dummy +scoreboard objectives remove lzt_trowel_raycast_hit dummy +scoreboard objectives remove lzt_trowel_block_check dummy +scoreboard objectives remove lzt_trowel_block_length dummy +scoreboard objectives remove lzt_trowel_unbreaking_check dummy +scoreboard objectives remove lzt_trowel_unbreaking_chance dummy +scoreboard objectives remove lzt_trowel_damage dummy +scoreboard objectives remove lzt_trowel_max_damage dummy + # Hammer scoreboard objectives remove lzt_hammer_check scoreboard objectives remove lzt_hammer_success diff --git a/data/lzstools/predicate/chisel/mainhand.json b/data/lzstools/predicate/chisel/mainhand.json new file mode 100644 index 0000000..ba00385 --- /dev/null +++ b/data/lzstools/predicate/chisel/mainhand.json @@ -0,0 +1,17 @@ +{ + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "equipment": { + "mainhand": { + "predicates": { + "minecraft:custom_data": { + "lzstools": [ + "chisel" + ] + } + } + } + } + } +} \ No newline at end of file diff --git a/data/lzstools_chisel/function/block/place.mcfunction b/data/lzstools_chisel/function/block/place.mcfunction new file mode 100644 index 0000000..9666107 --- /dev/null +++ b/data/lzstools_chisel/function/block/place.mcfunction @@ -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 \ No newline at end of file diff --git a/data/lzstools_chisel/function/block/place/leaves.mcfunction b/data/lzstools_chisel/function/block/place/leaves.mcfunction new file mode 100644 index 0000000..3767ced --- /dev/null +++ b/data/lzstools_chisel/function/block/place/leaves.mcfunction @@ -0,0 +1,2 @@ +# Place Leaves +$execute as @s store result score @s lzt_chisel_success setblock ~ ~ ~ $(chosen_block)[persistent=true] destroy \ No newline at end of file diff --git a/data/lzstools_chisel/function/block/place/nesw.mcfunction b/data/lzstools_chisel/function/block/place/nesw.mcfunction new file mode 100644 index 0000000..a5c394f --- /dev/null +++ b/data/lzstools_chisel/function/block/place/nesw.mcfunction @@ -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 \ No newline at end of file diff --git a/data/lzstools_chisel/function/block/place/neswud.mcfunction b/data/lzstools_chisel/function/block/place/neswud.mcfunction new file mode 100644 index 0000000..ba528f6 --- /dev/null +++ b/data/lzstools_chisel/function/block/place/neswud.mcfunction @@ -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 \ No newline at end of file diff --git a/data/lzstools_chisel/function/block/place/slabs.mcfunction b/data/lzstools_chisel/function/block/place/slabs.mcfunction new file mode 100644 index 0000000..4dc774a --- /dev/null +++ b/data/lzstools_chisel/function/block/place/slabs.mcfunction @@ -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 \ No newline at end of file diff --git a/data/lzstools_chisel/function/block/place/stairs.mcfunction b/data/lzstools_chisel/function/block/place/stairs.mcfunction new file mode 100644 index 0000000..295daa9 --- /dev/null +++ b/data/lzstools_chisel/function/block/place/stairs.mcfunction @@ -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 \ No newline at end of file diff --git a/data/lzstools_chisel/function/block/place/trapdoors.mcfunction b/data/lzstools_chisel/function/block/place/trapdoors.mcfunction new file mode 100644 index 0000000..5f25fa9 --- /dev/null +++ b/data/lzstools_chisel/function/block/place/trapdoors.mcfunction @@ -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 + diff --git a/data/lzstools_chisel/function/block/place/xyz.mcfunction b/data/lzstools_chisel/function/block/place/xyz.mcfunction new file mode 100644 index 0000000..753fa48 --- /dev/null +++ b/data/lzstools_chisel/function/block/place/xyz.mcfunction @@ -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 \ No newline at end of file diff --git a/data/lzstools_chisel/function/block/place_normal.mcfunction b/data/lzstools_chisel/function/block/place_normal.mcfunction new file mode 100644 index 0000000..3379a66 --- /dev/null +++ b/data/lzstools_chisel/function/block/place_normal.mcfunction @@ -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 diff --git a/data/lzstools_chisel/function/block/remove_item.mcfunction b/data/lzstools_chisel/function/block/remove_item.mcfunction new file mode 100644 index 0000000..118173a --- /dev/null +++ b/data/lzstools_chisel/function/block/remove_item.mcfunction @@ -0,0 +1 @@ +$execute if entity @s[gamemode=!creative] run clear @s $(chosen_block) 1 \ No newline at end of file diff --git a/data/lzstools_chisel/function/block/target_coords.mcfunction b/data/lzstools_chisel/function/block/target_coords.mcfunction new file mode 100644 index 0000000..fde8920 --- /dev/null +++ b/data/lzstools_chisel/function/block/target_coords.mcfunction @@ -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] \ No newline at end of file diff --git a/data/lzstools_chisel/function/durability/mainhand/apply.mcfunction b/data/lzstools_chisel/function/durability/mainhand/apply.mcfunction new file mode 100644 index 0000000..df40173 --- /dev/null +++ b/data/lzstools_chisel/function/durability/mainhand/apply.mcfunction @@ -0,0 +1 @@ +$item modify entity @s weapon.mainhand {"function":"minecraft:set_components","components":{"minecraft:damage":$(damage)}} \ No newline at end of file diff --git a/data/lzstools_chisel/function/durability/mainhand/break.mcfunction b/data/lzstools_chisel/function/durability/mainhand/break.mcfunction new file mode 100644 index 0000000..6f56702 --- /dev/null +++ b/data/lzstools_chisel/function/durability/mainhand/break.mcfunction @@ -0,0 +1,4 @@ +execute if entity @s[predicate=lzstools_chisel:mainhand/iron] at @s anchored eyes run particle minecraft:item{item:"minecraft:iron_sword"} ^ ^-0.35 ^0.65 0.1 0.1 0.1 0.06 10 force +execute if entity @s[predicate=lzstools_chisel:mainhand/diamond] at @s anchored eyes run particle minecraft:item{item:"minecraft:diamond_sword"} ^ ^-0.35 ^0.65 0.1 0.1 0.1 0.06 10 force +item replace entity @s weapon.mainhand with minecraft:air +playsound minecraft:entity.item.break master @a ~ ~ ~ 1 1 \ No newline at end of file diff --git a/data/lzstools_chisel/function/durability/mainhand/handle.mcfunction b/data/lzstools_chisel/function/durability/mainhand/handle.mcfunction new file mode 100644 index 0000000..3c3ba8b --- /dev/null +++ b/data/lzstools_chisel/function/durability/mainhand/handle.mcfunction @@ -0,0 +1,13 @@ +scoreboard players reset @s lzt_chisel_unbreaking_check +execute if entity @s[predicate=lzstools:unbreaking/mainhand/all] run function lzstools_chisel:durability/mainhand/unbreaking +execute if score @s lzt_chisel_unbreaking_check matches 1 run return fail + +# Handle Damage +data modify storage lzstools:chisel components set from entity @s SelectedItem.components +execute store result score @s lzt_chisel_damage run data get storage lzstools:chisel components."minecraft:damage" +execute store result score @s lzt_chisel_max_damage run data get storage lzstools:chisel components."minecraft:max_damage" +scoreboard players add @s lzt_chisel_damage 1 +execute store result storage lzstools:chisel damage int 1 run scoreboard players get @s lzt_chisel_damage + +function lzstools_chisel:durability/mainhand/apply with storage lzstools:chisel +execute if score @s lzt_chisel_damage >= @s lzt_chisel_max_damage run function lzstools_chisel:durability/mainhand/break \ No newline at end of file diff --git a/data/lzstools_chisel/function/durability/mainhand/unbreaking.mcfunction b/data/lzstools_chisel/function/durability/mainhand/unbreaking.mcfunction new file mode 100644 index 0000000..0c83de1 --- /dev/null +++ b/data/lzstools_chisel/function/durability/mainhand/unbreaking.mcfunction @@ -0,0 +1,4 @@ +execute store result score @s lzt_chisel_unbreaking_chance run random value 1..100 +execute if entity @s[predicate=lzstools:unbreaking/mainhand/3] if score @s lzt_chisel_unbreaking_chance matches ..75 run return run scoreboard players set @s lzt_chisel_unbreaking_check 1 +execute if entity @s[predicate=lzstools:unbreaking/mainhand/2] if score @s lzt_chisel_unbreaking_chance matches ..66 run return run scoreboard players set @s lzt_chisel_unbreaking_check 1 +execute if entity @s[predicate=lzstools:unbreaking/mainhand/1] if score @s lzt_chisel_unbreaking_chance matches ..50 run return run scoreboard players set @s lzt_chisel_unbreaking_check 1 diff --git a/data/lzstools_chisel/function/mainhand.mcfunction b/data/lzstools_chisel/function/mainhand.mcfunction new file mode 100644 index 0000000..855e0ad --- /dev/null +++ b/data/lzstools_chisel/function/mainhand.mcfunction @@ -0,0 +1,3 @@ +tag @s add lzstools_chisel_mainhand +# Raycast from player's position +function lzstools_chisel:raycast/start \ No newline at end of file diff --git a/data/lzstools_chisel/function/raycast/hit.mcfunction b/data/lzstools_chisel/function/raycast/hit.mcfunction new file mode 100644 index 0000000..f4b2f9a --- /dev/null +++ b/data/lzstools_chisel/function/raycast/hit.mcfunction @@ -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 \ No newline at end of file diff --git a/data/lzstools_chisel/function/raycast/loop.mcfunction b/data/lzstools_chisel/function/raycast/loop.mcfunction new file mode 100644 index 0000000..b9545e0 --- /dev/null +++ b/data/lzstools_chisel/function/raycast/loop.mcfunction @@ -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 \ No newline at end of file diff --git a/data/lzstools_chisel/function/raycast/start.mcfunction b/data/lzstools_chisel/function/raycast/start.mcfunction new file mode 100644 index 0000000..a588610 --- /dev/null +++ b/data/lzstools_chisel/function/raycast/start.mcfunction @@ -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 \ No newline at end of file diff --git a/data/lzstools_chisel/function/select/check_block.mcfunction b/data/lzstools_chisel/function/select/check_block.mcfunction new file mode 100644 index 0000000..78ce3f9 --- /dev/null +++ b/data/lzstools_chisel/function/select/check_block.mcfunction @@ -0,0 +1,5 @@ +# No Shulkers +$execute if items entity @s hotbar.$(chosen_slot) #minecraft:shulker_boxes run return fail + +$setblock ~ -64 ~ $(chosen_block) +setblock ~ -64 ~ bedrock \ No newline at end of file diff --git a/data/lzstools_chisel/function/select/get_block.mcfunction b/data/lzstools_chisel/function/select/get_block.mcfunction new file mode 100644 index 0000000..cfaa3cc --- /dev/null +++ b/data/lzstools_chisel/function/select/get_block.mcfunction @@ -0,0 +1,2 @@ +$data modify storage lzstools:chisel chosen_block set from entity @s Inventory[{Slot:$(chosen_slot)b}].id +function lzstools_chisel:select/check_block with storage lzstools:chisel \ No newline at end of file diff --git a/data/lzstools_chisel/function/select/start.mcfunction b/data/lzstools_chisel/function/select/start.mcfunction new file mode 100644 index 0000000..bf32143 --- /dev/null +++ b/data/lzstools_chisel/function/select/start.mcfunction @@ -0,0 +1,7 @@ +execute store result score @s lzt_chisel_slot run data get entity @s SelectedItemSlot +scoreboard players add @s lzt_chisel_slot 1 +execute if score @s lzt_chisel_slot matches 9.. run return fail +execute store result storage lzstools:chisel chosen_slot int 1 run scoreboard players get @s lzt_chisel_slot + +# Check Valid Block +function lzstools_chisel:select/get_block with storage lzstools:chisel \ No newline at end of file diff --git a/data/lzstools_chisel/predicate/mainhand/diamond.json b/data/lzstools_chisel/predicate/mainhand/diamond.json new file mode 100644 index 0000000..1fee009 --- /dev/null +++ b/data/lzstools_chisel/predicate/mainhand/diamond.json @@ -0,0 +1,17 @@ +{ + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "equipment": { + "mainhand": { + "predicates": { + "minecraft:custom_data": { + "lzstools": [ + "chisel_diamond" + ] + } + } + } + } + } +} \ No newline at end of file diff --git a/data/lzstools_chisel/predicate/mainhand/iron.json b/data/lzstools_chisel/predicate/mainhand/iron.json new file mode 100644 index 0000000..88c1177 --- /dev/null +++ b/data/lzstools_chisel/predicate/mainhand/iron.json @@ -0,0 +1,17 @@ +{ + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "equipment": { + "mainhand": { + "predicates": { + "minecraft:custom_data": { + "lzstools": [ + "chisel_iron" + ] + } + } + } + } + } +} \ No newline at end of file diff --git a/data/lzstools_chisel/recipe/diamond.json b/data/lzstools_chisel/recipe/diamond.json new file mode 100644 index 0000000..8354fbf --- /dev/null +++ b/data/lzstools_chisel/recipe/diamond.json @@ -0,0 +1,35 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "equipment", + "pattern": [ + "d ", + "s " + ], + "key": { + "s": "minecraft:stick", + "d": "minecraft:diamond" + }, + "result": { + "id": "minecraft:carrot_on_a_stick", + "count": 1, + "components": { + "minecraft:max_damage": 2100, + "minecraft:item_name": { + "text": "Diamond Chisel", + "color": "aqua", + "italic": false + }, + "minecraft:custom_model_data": { + "strings": [ + "lzstools:chisel_diamond" + ] + }, + "minecraft:custom_data": { + "lzstools": [ + "chisel", + "chisel_diamond" + ] + } + } + } +} \ No newline at end of file diff --git a/data/lzstools_chisel/recipe/iron.json b/data/lzstools_chisel/recipe/iron.json new file mode 100644 index 0000000..1a2e6a7 --- /dev/null +++ b/data/lzstools_chisel/recipe/iron.json @@ -0,0 +1,35 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "equipment", + "pattern": [ + "i ", + "s " + ], + "key": { + "s": "minecraft:stick", + "i": "minecraft:iron_ingot" + }, + "result": { + "id": "minecraft:carrot_on_a_stick", + "count": 1, + "components": { + "minecraft:max_damage": 350, + "minecraft:item_name": { + "text": "Iron Chisel", + "color": "aqua", + "italic": false + }, + "minecraft:custom_model_data": { + "strings": [ + "lzstools:chisel_iron" + ] + }, + "minecraft:custom_data": { + "lzstools": [ + "chisel", + "chisel_iron" + ] + } + } + } +} \ No newline at end of file