1
0
mirror of https://github.com/LZStealth/armor-statues.git synced 2025-06-07 17:16:44 +01:00

Made some optimizations and compatability fixes for 1.17

This commit is contained in:
MukiTanuki 2021-06-01 21:21:16 -06:00
parent 54ac24c104
commit 351ce5c526
3 changed files with 21 additions and 18 deletions

View File

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

View File

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

View File

@ -0,0 +1,16 @@
[
{
"function": "minecraft:copy_nbt",
"source": {
"type": "storage",
"source": "customizable_armor_stands:book_storage"
},
"ops": [
{
"source": "SavedItem",
"target": "[]",
"op": "replace"
}
]
}
]