From 1f861cba2b075892ce3222baf0704e863db92906 Mon Sep 17 00:00:00 2001 From: Mark Rapson Date: Thu, 12 Dec 2024 13:00:57 +0000 Subject: [PATCH] Initial --- .gitattributes | 2 ++ .gitignore | 1 + .../function/enable.mcfunction | 2 ++ .../function/init.mcfunction | 5 +++++ .../function/remove_model.mcfunction | 9 +++++++++ .../function/second.mcfunction | 7 +++++++ .../function/set_model.mcfunction | 9 +++++++++ .../function/trigger.mcfunction | 7 +++++++ data/minecraft/tags/function/load.json | 5 +++++ pack.mcmeta | 10 ++++++++++ pack.png | Bin 0 -> 4568 bytes 11 files changed, 57 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 data/custom_item_model_data/function/enable.mcfunction create mode 100644 data/custom_item_model_data/function/init.mcfunction create mode 100644 data/custom_item_model_data/function/remove_model.mcfunction create mode 100644 data/custom_item_model_data/function/second.mcfunction create mode 100644 data/custom_item_model_data/function/set_model.mcfunction create mode 100644 data/custom_item_model_data/function/trigger.mcfunction create mode 100644 data/minecraft/tags/function/load.json create mode 100644 pack.mcmeta create mode 100644 pack.png diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6f66c74 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.zip \ No newline at end of file diff --git a/data/custom_item_model_data/function/enable.mcfunction b/data/custom_item_model_data/function/enable.mcfunction new file mode 100644 index 0000000..7126853 --- /dev/null +++ b/data/custom_item_model_data/function/enable.mcfunction @@ -0,0 +1,2 @@ +scoreboard players set @s CustomModel 0 +scoreboard players enable @s CustomModel \ No newline at end of file diff --git a/data/custom_item_model_data/function/init.mcfunction b/data/custom_item_model_data/function/init.mcfunction new file mode 100644 index 0000000..9d58e2c --- /dev/null +++ b/data/custom_item_model_data/function/init.mcfunction @@ -0,0 +1,5 @@ +scoreboard objectives add CustomModel trigger +scoreboard players set @a CustomModel 0 +scoreboard players enable @a CustomModel + +function custom_item_model_data:second \ No newline at end of file diff --git a/data/custom_item_model_data/function/remove_model.mcfunction b/data/custom_item_model_data/function/remove_model.mcfunction new file mode 100644 index 0000000..663064a --- /dev/null +++ b/data/custom_item_model_data/function/remove_model.mcfunction @@ -0,0 +1,9 @@ +item modify entity @s weapon.mainhand \ + {\ + function:set_components, \ + components: {\ + "!minecraft:custom_model_data": {} \ + }\ + } +title @s actionbar [{"text": "Custom Model Data ", "color": "green"},{"text": "removed", "color": "red"}] +execute at @s run playsound minecraft:entity.villager.work_cartographer player @s ~ ~ ~ 0.6 0.6 \ No newline at end of file diff --git a/data/custom_item_model_data/function/second.mcfunction b/data/custom_item_model_data/function/second.mcfunction new file mode 100644 index 0000000..9b3c38c --- /dev/null +++ b/data/custom_item_model_data/function/second.mcfunction @@ -0,0 +1,7 @@ +schedule function custom_item_model_data:second 1s + +execute as @a[scores={CustomModel=1}] if items entity @s weapon.mainhand * run function custom_item_model_data:trigger +execute as @a[scores={CustomModel=2..}] if items entity @s weapon.mainhand * run function custom_item_model_data:remove_model + +# resets trigger +execute as @a run function custom_item_model_data:enable \ No newline at end of file diff --git a/data/custom_item_model_data/function/set_model.mcfunction b/data/custom_item_model_data/function/set_model.mcfunction new file mode 100644 index 0000000..6be5b0c --- /dev/null +++ b/data/custom_item_model_data/function/set_model.mcfunction @@ -0,0 +1,9 @@ +$item modify entity @s weapon.mainhand \ + {\ + function:set_components, \ + components: {\ + "minecraft:custom_model_data": { "strings": [ $(Model) ] } \ + }\ + } +$title @s actionbar [{"text": "Set Custom Model Data to ", "color": "green"},{"text": "$(Model)", "color": "aqua"}] +execute at @s run playsound minecraft:entity.villager.work_cartographer player @s ~ ~ ~ 0.6 0.6 \ No newline at end of file diff --git a/data/custom_item_model_data/function/trigger.mcfunction b/data/custom_item_model_data/function/trigger.mcfunction new file mode 100644 index 0000000..e21c638 --- /dev/null +++ b/data/custom_item_model_data/function/trigger.mcfunction @@ -0,0 +1,7 @@ +execute as @s run data remove storage custom_item_model_data:item_model Model +execute as @s run data modify storage custom_item_model_data:item_model Model set from entity @s Inventory[{Slot:-106b}].components.minecraft:writable_book_content.pages[0].raw +execute as @s run function custom_item_model_data:set_model with storage custom_item_model_data:item_model {} + +execute as @s run scoreboard players reset @s CustomModel +scoreboard players set @s CustomModel 0 +scoreboard players enable @a CustomModel \ No newline at end of file diff --git a/data/minecraft/tags/function/load.json b/data/minecraft/tags/function/load.json new file mode 100644 index 0000000..03a66e5 --- /dev/null +++ b/data/minecraft/tags/function/load.json @@ -0,0 +1,5 @@ +{ + "values": [ + "custom_item_model_data:init" + ] +} \ No newline at end of file diff --git a/pack.mcmeta b/pack.mcmeta new file mode 100644 index 0000000..b3299b5 --- /dev/null +++ b/pack.mcmeta @@ -0,0 +1,10 @@ +{ + "pack": { + "pack_format": 61, + "supported_formats": { + "min_inclusive": 61, + "max_inclusive": 61 + }, + "description": [{"text":"Custom Model Data","color":"gold"},{"text":"\nDatapack by LZ Stealth","color":"green"}] + } +} diff --git a/pack.png b/pack.png new file mode 100644 index 0000000000000000000000000000000000000000..366710203360bacc0d337414079e2a6c6fedcb38 GIT binary patch literal 4568 zcmd^DeM}qY88@L@lP1ur-O{G+vg@_eQmtp7eP{c8!J)xWK+KR5w6GFr&-Y=x*muX> zVGOKI8?9y&(Gqo2NE+HGnl%2Xve0%}5G0|At0dJN8ZF95R19@nU@he%rNN>=*n7sf zbb{Dh*FUCNI{Dt$&*$&?J##s=>&IZ%gaXRF->4HCP(p}350*hO0zIC~3}QSTKXheVnBG>Z@ z}Aq*|n$LakzhL8uEkc*TTSUXJ4g5Yzi9QE$+pYECghhEB+d zwUQ_1oT2rshxM|&A_G}NLRPF66hW>QRxq9T`D+dUwhl+a$Fi|_y$KhxlIH_y!~t1W zS}v;>S$!!h3$+r>=J`OFk1S>*E2ZpLc&4BZ#AC`LX_r_^5u`Ff@GO>j+hV?u(Wt|r zO*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