commit 1f861cba2b075892ce3222baf0704e863db92906 Author: Mark Rapson Date: Thu Dec 12 13:00:57 2024 +0000 Initial 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 0000000..3667102 Binary files /dev/null and b/pack.png differ