Skip to content

Commit 660d8f7

Browse files
committed
Use Text Displays for Holographic Tags
- Colors now represent wool colores - Glow Item Frames now cause the hologram to appear lit
1 parent 2bba74a commit 660d8f7

10 files changed

Lines changed: 71 additions & 47 deletions

File tree

gm4_holographic_tags/beet.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
id: gm4_holographic_tags
22
name: Holographic Tags
3-
version: 1.4.X
3+
version: 1.5.X
44

55
data_pack:
66
load: .
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
# @s = item frame with renamed name tag
22
# run from main
33

4-
summon area_effect_cloud ~ ~ ~ {Radius:0.0f,CustomNameVisible:1b,Particle:{type:"minecraft:block",block_state:"minecraft:air"},Duration:-1,Tags:["gm4_hologram","smithed.entity","smithed.strict"]}
5-
data modify entity @e[type=area_effect_cloud,tag=gm4_hologram,limit=1,sort=nearest,distance=..0.1] CustomName set from entity @s Item.components."minecraft:custom_name"
6-
data modify entity @e[type=area_effect_cloud,tag=gm4_hologram,limit=1,sort=nearest,distance=..0.1] Rotation set from entity @s Rotation
7-
scoreboard players set @e[type=area_effect_cloud,tag=gm4_hologram,limit=1,sort=nearest,distance=..0.1] gm4_entity_version 1
8-
execute if block ^ ^ ^-0.75 #minecraft:wool as @e[type=area_effect_cloud,tag=gm4_hologram,limit=1,sort=nearest,distance=..0.1] run function gm4_holographic_tags:set_color
4+
# init text display
5+
data modify storage gm4_holographic_tags:temp properties.raw_text set from entity @s Item.components."minecraft:custom_name"
6+
execute if entity @s[type=glow_item_frame] run data modify storage gm4_holographic_tags:temp properties.glowing set value 1b
7+
data modify storage gm4_holographic_tags:temp properties.rotation set from entity @s Rotation
8+
execute summon text_display run function gm4_holographic_tags:initialize_hologram
9+
data remove storage gm4_holographic_tags:temp properties
10+
11+
# sights and sounds
912
advancement grant @a[distance=..4,gamemode=!spectator] only gm4:holographic_tags
1013
playsound minecraft:entity.item_frame.remove_item block @a
1114
particle minecraft:block{block_state:"minecraft:stripped_acacia_log"} ~ ~ ~ .2 .2 .2 .1 10
1215

13-
execute if entity @s[type=item_frame] run summon item ~ ~ ~ {Item:{id:"minecraft:item_frame",count:1},PickupDelay:10s,Motion:[0.0,0.25,0.0]}
14-
execute if entity @s[type=glow_item_frame] run summon item ~ ~ ~ {Item:{id:"minecraft:glow_item_frame",count:1},PickupDelay:10s,Motion:[0.0,0.25,0.0]}
16+
# return item frame item
17+
execute unless data storage gm4_holographic_tags:temp properties.glowing run summon item ~ ~ ~ {Item:{id:"minecraft:item_frame",count:1},PickupDelay:10s,Motion:[0.0,0.25,0.0]}
18+
execute if data storage gm4_holographic_tags:temp properties.glowing run summon item ~ ~ ~ {Item:{id:"minecraft:glow_item_frame",count:1},PickupDelay:10s,Motion:[0.0,0.25,0.0]}
1519

1620
kill @s
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# @s = hologram AEC if empty item frame is nearby
22
# run from main
33

4-
data merge entity @e[type=item_frame,limit=1,sort=nearest,distance=..0.1] {Tags:["gm4_hologram"],Item:{id:"minecraft:name_tag",count:1,components:{"minecraft:repair_cost":0}}}
5-
data modify entity @e[type=item_frame,limit=1,sort=nearest,distance=..0.1] Item.components."minecraft:custom_name" set from entity @s CustomName
4+
data merge entity @e[type=#gm4_holographic_tags:item_frames,limit=1,sort=nearest,distance=..0.1] {Tags:["gm4_hologram"],Item:{id:"minecraft:name_tag",count:1,components:{"minecraft:repair_cost":0}}}
5+
data modify entity @e[type=#gm4_holographic_tags:item_frames,limit=1,sort=nearest,distance=..0.1] Item.components."minecraft:custom_name" set from entity @s text.text
66

7-
data merge entity @e[type=glow_item_frame,limit=1,sort=nearest,distance=..0.1] {Tags:["gm4_hologram"],Item:{id:"minecraft:name_tag",count:1,components:{"minecraft:repair_cost":0}}}
8-
data modify entity @e[type=glow_item_frame,limit=1,sort=nearest,distance=..0.1] Item.components."minecraft:custom_name" set from entity @s CustomName
97
particle minecraft:block{block_state:"minecraft:stripped_birch_log"} ~ ~ ~ .2 .2 .2 .1 10
108
kill @s
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# initializes data on the text display
2+
# @s = inewly spawned text display
3+
# run from main
4+
5+
data merge entity @s {text:{color:"#FFFFFF",text:"test"},line_width:2147483647 ,billboard:"center",Tags:["gm4_hologram","smithed.entity","smithed.strict"],background:0}
6+
data modify entity @s text.text set from storage gm4_holographic_tags:temp properties.raw_text
7+
data modify entity @s Rotation set from storage gm4_holographic_tags:temp properties.rotation
8+
execute if data storage gm4_holographic_tags:temp properties.glowing run data modify entity @s brightness set value {block:15,sky:15}
9+
10+
execute positioned as @s if block ^ ^ ^-0.75 #minecraft:wool run function gm4_holographic_tags:set_color
11+
12+
scoreboard players set @s gm4_entity_version 2
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
2-
execute as @e[type=area_effect_cloud,tag=gm4_hologram,tag=!smithed.entity] run function gm4_holographic_tags:upgrade_path/smithed_compat
3-
4-
execute as @e[type=area_effect_cloud,tag=gm4_hologram] at @s positioned ^ ^ ^-0.3 positioned ~ ~.3 ~ if entity @e[type=item_frame,predicate=!gm4_holographic_tags:has_item,distance=..0.1,limit=1] run function gm4_holographic_tags:destroy_hologram
5-
execute as @e[type=item_frame,tag=!smithed.entity,tag=!gm4_hologram,predicate=gm4_holographic_tags:has_name_tag] if items entity @s contents *[custom_name] at @s positioned ^ ^ ^0.3 positioned ~ ~-.3 ~ unless entity @e[type=area_effect_cloud,tag=gm4_hologram,distance=..0.1] run function gm4_holographic_tags:create_hologram
6-
tag @e[type=item_frame,tag=gm4_hologram,predicate=!gm4_holographic_tags:has_name_tag] remove gm4_hologram
7-
8-
execute as @e[type=area_effect_cloud,tag=gm4_hologram] at @s positioned ^ ^ ^-0.3 positioned ~ ~.3 ~ if entity @e[type=glow_item_frame,predicate=!gm4_holographic_tags:has_item,distance=..0.1,limit=1] run function gm4_holographic_tags:destroy_hologram
9-
execute as @e[type=glow_item_frame,tag=!smithed.entity,tag=!gm4_hologram,predicate=gm4_holographic_tags:has_name_tag] if items entity @s contents *[custom_name] at @s positioned ^ ^ ^0.3 positioned ~ ~-.3 ~ unless entity @e[type=area_effect_cloud,tag=gm4_hologram,distance=..0.1] run function gm4_holographic_tags:create_hologram
10-
tag @e[type=glow_item_frame,tag=gm4_hologram,predicate=!gm4_holographic_tags:has_name_tag] remove gm4_hologram
1+
execute as @e[type=text_display,tag=gm4_hologram] at @s positioned ^ ^ ^-0.3 if entity @e[type=#gm4_holographic_tags:item_frames,predicate=!gm4_holographic_tags:has_item,distance=..0.1,limit=1] run function gm4_holographic_tags:destroy_hologram
2+
execute as @e[type=#gm4_holographic_tags:item_frames,tag=!smithed.entity,tag=!gm4_hologram,predicate=gm4_holographic_tags:has_name_tag] if items entity @s contents *[custom_name] at @s positioned ^ ^ ^0.3 unless entity @e[type=text_display,tag=gm4_hologram,distance=..0.1] run function gm4_holographic_tags:create_hologram
3+
tag @e[type=#gm4_holographic_tags:item_frames,tag=gm4_hologram,predicate=!gm4_holographic_tags:has_name_tag] remove gm4_hologram
114

125
schedule function gm4_holographic_tags:main 16t
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# @s = item frame with renamed name tag if on a wool block
2-
# run from create_hologram
2+
# run from initialize_hologram
33

4-
execute if block ^ ^ ^-.75 white_wool run team join gm4_white
5-
execute if block ^ ^ ^-.75 orange_wool run team join gm4_orange
6-
execute if block ^ ^ ^-.75 magenta_wool run team join gm4_magenta
7-
execute if block ^ ^ ^-.75 light_blue_wool run team join gm4_lightblue
8-
execute if block ^ ^ ^-.75 yellow_wool run team join gm4_yellow
9-
execute if block ^ ^ ^-.75 lime_wool run team join gm4_lime
10-
execute if block ^ ^ ^-.75 pink_wool run team join gm4_pink
11-
execute if block ^ ^ ^-.75 gray_wool run team join gm4_gray
12-
execute if block ^ ^ ^-.75 light_gray_wool run team join gm4_lightgray
13-
execute if block ^ ^ ^-.75 cyan_wool run team join gm4_cyan
14-
execute if block ^ ^ ^-.75 purple_wool run team join gm4_purple
15-
execute if block ^ ^ ^-.75 blue_wool run team join gm4_blue
16-
execute if block ^ ^ ^-.75 brown_wool run team join gm4_brown
17-
execute if block ^ ^ ^-.75 green_wool run team join gm4_green
18-
execute if block ^ ^ ^-.75 red_wool run team join gm4_red
19-
execute if block ^ ^ ^-.75 black_wool run team join gm4_black
4+
execute if block ^ ^ ^-.75 white_wool run data modify entity @s text.color set value "#e8ebeb"
5+
execute if block ^ ^ ^-.75 orange_wool run data modify entity @s text.color set value "#ee7311"
6+
execute if block ^ ^ ^-.75 magenta_wool run data modify entity @s text.color set value "#be45b5"
7+
execute if block ^ ^ ^-.75 light_blue_wool run data modify entity @s text.color set value "#37abd6"
8+
execute if block ^ ^ ^-.75 yellow_wool run data modify entity @s text.color set value "#f7c527"
9+
execute if block ^ ^ ^-.75 lime_wool run data modify entity @s text.color set value "#6fb718"
10+
execute if block ^ ^ ^-.75 pink_wool run data modify entity @s text.color set value "#eb88a8"
11+
execute if block ^ ^ ^-.75 gray_wool run data modify entity @s text.color set value "#3c4245"
12+
execute if block ^ ^ ^-.75 light_gray_wool run data modify entity @s text.color set value "#8b8b84"
13+
execute if block ^ ^ ^-.75 cyan_wool run data modify entity @s text.color set value "#15878f"
14+
execute if block ^ ^ ^-.75 purple_wool run data modify entity @s text.color set value "#7426a7"
15+
execute if block ^ ^ ^-.75 blue_wool run data modify entity @s text.color set value "#323599"
16+
execute if block ^ ^ ^-.75 brown_wool run data modify entity @s text.color set value "#6f4425"
17+
execute if block ^ ^ ^-.75 green_wool run data modify entity @s text.color set value "#51691a"
18+
execute if block ^ ^ ^-.75 red_wool run data modify entity @s text.color set value "#9f2521"
19+
execute if block ^ ^ ^-.75 black_wool run data modify entity @s text.color set value "#101115"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# updates old area effect cloud based holographic tags into new text display based ones
2+
# @s = player
3+
# as @s
4+
# run via upgrade paths util
5+
6+
execute as @e[type=area_effect_cloud,tag=gm4_hologram,scores={gm4_entity_version=1}] at @s run function gm4_holographic_tags:upgrade_path/1.5/convert_to_text_display
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# collects data from the existing aec and initiates summoning of a replacement text display
2+
# @s = outdated aec-based holographic tag
3+
# at @s
4+
# run from upgrade_path/1.5
5+
6+
# summon text display based on aec
7+
tp ^ ^ ^.3
8+
data modify storage gm4_holographic_tags:temp properties.raw_text set from entity @s CustomName
9+
data modify storage gm4_holographic_tags:temp properties.rotation set from entity @s Rotation
10+
execute at @s summon text_display run function gm4_holographic_tags:initialize_hologram
11+
data remove storage gm4_holographic_tags:temp properties
12+
kill @s

gm4_holographic_tags/data/gm4_holographic_tags/function/upgrade_path/smithed_compat.mcfunction

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"values":
3+
[
4+
"minecraft:item_frame",
5+
"minecraft:glow_item_frame"
6+
]
7+
}

0 commit comments

Comments
 (0)