From 54ac24c10498b8dcf630ad14a786dd8ea8665879 Mon Sep 17 00:00:00 2001 From: MukiTanuki Date: Tue, 1 Jun 2021 20:32:01 -0600 Subject: [PATCH] Added support for Glow Item Frames --- data/armor_statues/functions/3_second.mcfunction | 4 ++-- data/armor_statues/functions/animate.mcfunction | 2 +- .../functions/animate_time.mcfunction | 4 ++-- data/armor_statues/functions/if_trigger.mcfunction | 14 +++++++------- .../functions/item_frames/fixed.mcfunction | 2 +- .../functions/item_frames/invisible.mcfunction | 2 +- data/armor_statues/functions/second.mcfunction | 2 +- .../tags/entity_types/item_frames.json | 13 +++++++++++++ 8 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 data/armor_statues/tags/entity_types/item_frames.json diff --git a/data/armor_statues/functions/3_second.mcfunction b/data/armor_statues/functions/3_second.mcfunction index 4969a2a..d3cb6ef 100644 --- a/data/armor_statues/functions/3_second.mcfunction +++ b/data/armor_statues/functions/3_second.mcfunction @@ -7,6 +7,6 @@ schedule function armor_statues:3_second 3s # # Tags item frames with a book in them # -execute if score #animate_trigger as_angle matches 1.. as @e[type=item_frame,tag=!as_animatable,predicate=armor_statues:item_frame_with_book] run tag @s add as_animatable +execute if score #animate_trigger as_angle matches 1.. as @e[type=#armor_statues:item_frames,tag=!as_animatable,predicate=armor_statues:item_frame_with_book] run tag @s add as_animatable # Untags -execute if score #animate_trigger as_angle matches 1.. as @e[type=item_frame,tag=as_animatable,predicate=!armor_statues:item_frame_with_book] run tag @s remove as_animatable +execute if score #animate_trigger as_angle matches 1.. as @e[type=#armor_statues:item_frames,tag=as_animatable,predicate=!armor_statues:item_frame_with_book] run tag @s remove as_animatable diff --git a/data/armor_statues/functions/animate.mcfunction b/data/armor_statues/functions/animate.mcfunction index e99f936..ee6c960 100644 --- a/data/armor_statues/functions/animate.mcfunction +++ b/data/armor_statues/functions/animate.mcfunction @@ -1,7 +1,7 @@ # # Description: Animate armor stands based off of item frames # Called by: armor_statues:tick -# Entity @s: None +# Entity @s: #item frames # tag @s add as_powered data modify entity @e[type=minecraft:armor_stand,distance=..8,tag=!as_locked,sort=nearest,limit=1,nbt=!{Marker:1b},nbt=!{Invulnerable:1b}] {} merge from entity @s Item.tag.SavedPose diff --git a/data/armor_statues/functions/animate_time.mcfunction b/data/armor_statues/functions/animate_time.mcfunction index 039d17f..c0b54b0 100644 --- a/data/armor_statues/functions/animate_time.mcfunction +++ b/data/armor_statues/functions/animate_time.mcfunction @@ -3,6 +3,6 @@ # Called by: armor_statues:tick # Entity @s: None # -execute as @e[type=minecraft:item_frame,tag=as_animatable,tag=!as_powered] at @s if entity @p[distance=..35] if block ~ ~ ~ minecraft:redstone_wire unless block ~ ~ ~ minecraft:redstone_wire[power=0] run function armor_statues:animate -execute as @e[type=minecraft:item_frame,tag=as_animatable,tag=as_powered] at @s if block ~ ~ ~ minecraft:redstone_wire[power=0] run tag @s remove as_powered +execute as @e[type=#armor_statues:item_frames,tag=as_animatable,tag=!as_powered] at @s if entity @p[distance=..35] if block ~ ~ ~ minecraft:redstone_wire unless block ~ ~ ~ minecraft:redstone_wire[power=0] run function armor_statues:animate +execute as @e[type=#armor_statues:item_frames,tag=as_animatable,tag=as_powered] at @s if block ~ ~ ~ minecraft:redstone_wire[power=0] run tag @s remove as_powered scoreboard players set #animate_time as_angle 0 \ No newline at end of file diff --git a/data/armor_statues/functions/if_trigger.mcfunction b/data/armor_statues/functions/if_trigger.mcfunction index 44b57c7..f3ec664 100644 --- a/data/armor_statues/functions/if_trigger.mcfunction +++ b/data/armor_statues/functions/if_trigger.mcfunction @@ -6,31 +6,31 @@ # Tag the player and an item frame 1 block in front of their eyes # tag @s add as_selected -execute anchored eyes positioned ^ ^ ^1 as @e[type=item_frame,distance=..1,tag=!as_locked,sort=nearest,limit=1,nbt=!{Invulnerable:1b},nbt={Item:{Count:1b}}] unless entity @s[tag=!if_fixed,nbt={Fixed:1b}] run tag @s add as_selected +execute anchored eyes positioned ^ ^ ^1 as @e[type=#armor_statues:item_frames,distance=..1,tag=!as_locked,sort=nearest,limit=1,nbt=!{Invulnerable:1b},nbt={Item:{Count:1b}}] unless entity @s[tag=!if_fixed,nbt={Fixed:1b}] run tag @s add as_selected # # Copy the trigger score to the selected item frame # -scoreboard players operation @e[type=item_frame,tag=as_selected] if_invisible = @s if_invisible +scoreboard players operation @e[type=#armor_statues:item_frames,tag=as_selected] if_invisible = @s if_invisible # # Makes item frame 1 block in front of you invisible if it has an item # -execute if entity @s[scores={if_invisible=1}] as @e[type=item_frame,tag=as_selected,nbt=!{Invisible:1b}] run function armor_statues:item_frames/invisible +execute if entity @s[scores={if_invisible=1}] as @e[type=#armor_statues:item_frames,tag=as_selected,nbt=!{Invisible:1b}] run function armor_statues:item_frames/invisible # # Item frame fixing # # Creative -execute if entity @s[scores={if_invisible=2..3},gamemode=creative] as @e[type=item_frame,tag=as_selected] run function armor_statues:item_frames/fixed +execute if entity @s[scores={if_invisible=2..3},gamemode=creative] as @e[type=#armor_statues:item_frames,tag=as_selected] run function armor_statues:item_frames/fixed # Enabled -execute if data storage customizable_armor_stands:settings as_admin{fixed_item_frame:"Enabled"} if entity @s[scores={if_invisible=2..3},gamemode=survival] as @e[type=item_frame,tag=as_selected] run function armor_statues:item_frames/fixed +execute if data storage customizable_armor_stands:settings as_admin{fixed_item_frame:"Enabled"} if entity @s[scores={if_invisible=2..3},gamemode=survival] as @e[type=#armor_statues:item_frames,tag=as_selected] run function armor_statues:item_frames/fixed # Disabled execute if data storage customizable_armor_stands:settings as_admin{fixed_item_frame:"Disabled"} if entity @s[scores={if_invisible=2..3},gamemode=survival] if entity @p[tag=as_selected,predicate=!armor_statues:mainhand_potion,predicate=!armor_statues:offhand_potion] run title @a[tag=as_selected,tag=!as_chat] actionbar [{"text":"Must be enabled from admin menu","color":"dark_red"}] execute if data storage customizable_armor_stands:settings as_admin{fixed_item_frame:"Disabled"} if entity @s[scores={if_invisible=2..3},gamemode=survival] if entity @p[tag=as_selected,predicate=!armor_statues:mainhand_potion,predicate=!armor_statues:offhand_potion] run tellraw @a[tag=as_selected,tag=as_chat] [{"text":" ","color":"dark_green"},{"text":"Must be enabled from admin menu","color":"dark_red"}] # # Reset item frame's trigger score and remove selected tag from player and item frame # -scoreboard players reset @e[type=item_frame,tag=as_selected] if_invisible +scoreboard players reset @e[type=#armor_statues:item_frames,tag=as_selected] if_invisible tag @s remove as_selected -tag @e[type=item_frame,tag=as_selected] remove as_selected +tag @e[type=#armor_statues:item_frames,tag=as_selected] remove as_selected # # Reset player's trigger score and re-enable # diff --git a/data/armor_statues/functions/item_frames/fixed.mcfunction b/data/armor_statues/functions/item_frames/fixed.mcfunction index 33ed16b..ed0dc07 100644 --- a/data/armor_statues/functions/item_frames/fixed.mcfunction +++ b/data/armor_statues/functions/item_frames/fixed.mcfunction @@ -1,7 +1,7 @@ # # Description: turns item frame invisible # Called by: armor_statues:if_trigger -# Entity @s: item frame +# Entity @s: #item frame # # Makes item frame fixed # diff --git a/data/armor_statues/functions/item_frames/invisible.mcfunction b/data/armor_statues/functions/item_frames/invisible.mcfunction index 38ed839..11814ee 100644 --- a/data/armor_statues/functions/item_frames/invisible.mcfunction +++ b/data/armor_statues/functions/item_frames/invisible.mcfunction @@ -1,7 +1,7 @@ # # Description: turns item frame invisible if successful # Called by: armor_statues:if_trigger -# Entity @s: item frame +# Entity @s: #item frame # # Makes item frame invisible # diff --git a/data/armor_statues/functions/second.mcfunction b/data/armor_statues/functions/second.mcfunction index 55827b1..01381a8 100644 --- a/data/armor_statues/functions/second.mcfunction +++ b/data/armor_statues/functions/second.mcfunction @@ -19,7 +19,7 @@ execute as @a[scores={if_invisible=1..}] at @s run function armor_statues:if_tri # # Makes empty invisible item frames visible # -execute as @e[type=item_frame,tag=if_invisible,nbt=!{Item:{Count:1b}}] run function armor_statues:item_frames/visible +execute as @e[type=#armor_statues:item_frames,tag=if_invisible,nbt=!{Item:{Count:1b}}] run function armor_statues:item_frames/visible # # Check for players at the particle shrine # diff --git a/data/armor_statues/tags/entity_types/item_frames.json b/data/armor_statues/tags/entity_types/item_frames.json new file mode 100644 index 0000000..bcc60b8 --- /dev/null +++ b/data/armor_statues/tags/entity_types/item_frames.json @@ -0,0 +1,13 @@ +{ + "replace": "false", + "values": [ + { + "id": "minecraft:item_frame", + "required": "true" + }, + { + "id": "minecraft:glow_item_frame", + "required": "true" + } + ] +} \ No newline at end of file