This commit is contained in:
Mark Rapson 2024-12-12 13:00:57 +00:00
commit 1f861cba2b
11 changed files with 57 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.zip

View File

@ -0,0 +1,2 @@
scoreboard players set @s CustomModel 0
scoreboard players enable @s CustomModel

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,5 @@
{
"values": [
"custom_item_model_data:init"
]
}

10
pack.mcmeta Normal file
View File

@ -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"}]
}
}

BIN
pack.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB