diff --git a/data/armor_statues/functions/storage_out.mcfunction b/data/armor_statues/functions/storage_out.mcfunction index 4341b61..541b889 100644 --- a/data/armor_statues/functions/storage_out.mcfunction +++ b/data/armor_statues/functions/storage_out.mcfunction @@ -3,20 +3,7 @@ # Called by: as_statue:trigger\copy # Entity @s: player # -# Copies data to a temp pig +# Copies data from storage to the players book # -summon minecraft:pig ~ 0 ~ {DeathLootTable:"armor_statues:replace", Invulnerable:1b, NoGravity:1b, Silent:1b, ActiveEffects:[{Id:14,Amplifier:0,Duration:2147483647}], NoAI:1b, PersistenceRequired:1b, Tags:["as_temp"], HandItems:[{id:"minecraft:stone_button", Count:1b, tag:{ Enchantments:[{ lvl:1s, id:"minecraft:looting"} ]}},{}] } -# -data modify entity @e[tag=as_temp, type=minecraft:pig, sort=nearest, limit=1] HandItems[1] set from storage customizable_armor_stands:book_storage SavedItem -# -# Copies count to looting for book count -# -execute store result entity @e[tag=as_temp, type=minecraft:pig, sort=nearest, limit=1] HandItems[0].tag.Enchantments[0].lvl short 1 run data get storage customizable_armor_stands:book_storage SavedItem.Count -# -execute if entity @s[nbt={SelectedItem:{id:"minecraft:written_book", tag:{datapack:"ArmorStatuesV2"}}}] as @e[tag=as_temp, type=minecraft:pig, limit=1,sort=nearest] run loot replace entity @p[tag=as_selected] weapon.mainhand kill @s -execute if entity @s[nbt={Inventory:[{id:"minecraft:written_book", Slot:-106b, tag:{datapack:"ArmorStatuesV2"}}]}] unless entity @s[nbt={SelectedItem:{id:"minecraft:written_book", tag:{datapack:"ArmorStatuesV2"}}}] as @e[tag=as_temp, type=minecraft:pig, sort=nearest, limit=1] run loot replace entity @p[tag=as_selected] weapon.offhand kill @s -# -# Kills temp pig -# -tp @e[type=minecraft:pig, tag=as_temp] ~ -300 ~ -kill @e[type=minecraft:pig, tag=as_temp] \ No newline at end of file +execute if entity @s[nbt={SelectedItem:{id:"minecraft:written_book", tag:{datapack:"ArmorStatuesV2"}}}] as @e[tag=as_temp, type=minecraft:pig, limit=1,sort=nearest] run item modify entity @s weapon.mainhand armor_statues:storage_out +execute if entity @s[nbt={Inventory:[{id:"minecraft:written_book", Slot:-106b, tag:{datapack:"ArmorStatuesV2"}}]}] unless entity @s[nbt={SelectedItem:{id:"minecraft:written_book", tag:{datapack:"ArmorStatuesV2"}}}] as @e[tag=as_temp, type=minecraft:pig, sort=nearest, limit=1] run item modify entity @s weapon.offhand armor_statues:storage_out \ No newline at end of file diff --git a/data/armor_statues/functions/trigger/copy.mcfunction b/data/armor_statues/functions/trigger/copy.mcfunction index 02837e3..f1802d1 100644 --- a/data/armor_statues/functions/trigger/copy.mcfunction +++ b/data/armor_statues/functions/trigger/copy.mcfunction @@ -5,9 +5,9 @@ # execute as @p[tag=as_selected] run function armor_statues:storage_in # -data modify storage customizable_armor_stands:book_storage SavedItem.tag.SavedPose set value {Pose:{}, NoBasePlate:0b, ShowArms:0b, Small:0b, Invisible:0b, CustomNameVisible:0b} +data modify storage customizable_armor_stands:book_storage SavedItem.tag.SavedPose set value {Pose: {RightArm: [0f, 0f, 0f], LeftLeg: [0f, 0f, 0f], Head: [0f, 0f, 0f], LeftArm: [0f, 0f, 0f], RightLeg: [0f, 0f, 0f], Body: [0f, 0f, 0f]}, NoBasePlate:0b, ShowArms:0b, Small:0b, Invisible:0b, CustomNameVisible:0b} # -data modify storage customizable_armor_stands:book_storage SavedItem.tag.SavedPose.Pose set from entity @s Pose +data modify storage customizable_armor_stands:book_storage SavedItem.tag.SavedPose.Pose merge from entity @s Pose data modify storage customizable_armor_stands:book_storage SavedItem.tag.SavedPose.NoBasePlate set from entity @s NoBasePlate data modify storage customizable_armor_stands:book_storage SavedItem.tag.SavedPose.ShowArms set from entity @s ShowArms data modify storage customizable_armor_stands:book_storage SavedItem.tag.SavedPose.Small set from entity @s Small diff --git a/data/armor_statues/item_modifiers/storage_out.json b/data/armor_statues/item_modifiers/storage_out.json new file mode 100644 index 0000000..dd5c3bb --- /dev/null +++ b/data/armor_statues/item_modifiers/storage_out.json @@ -0,0 +1,16 @@ +[ + { + "function": "minecraft:copy_nbt", + "source": { + "type": "storage", + "source": "customizable_armor_stands:book_storage" + }, + "ops": [ + { + "source": "SavedItem", + "target": "[]", + "op": "replace" + } + ] + } +] \ No newline at end of file