44import dev .overgrown .aspectslib .data .Aspect ;
55import dev .overgrown .aspectslib .data .AspectData ;
66import dev .overgrown .aspectslib .data .ModRegistries ;
7+ import dev .overgrown .aspectslib .entity .aura_node .AuraNodeEntity ;
78import dev .overgrown .thaumaturge .block .vessel .VesselBlock ;
89import dev .overgrown .thaumaturge .block .vessel .entity .VesselBlockEntity ;
910import dev .overgrown .thaumaturge .item .aetheric_goggles .AethericGogglesItem ;
1213import net .minecraft .client .font .TextRenderer ;
1314import net .minecraft .client .gui .DrawContext ;
1415import net .minecraft .entity .Entity ;
15- import net .minecraft .entity .ItemEntity ;
1616import net .minecraft .entity .LivingEntity ;
17+ import net .minecraft .entity .ItemEntity ;
1718import net .minecraft .item .ItemStack ;
19+ import net .minecraft .text .Text ;
1820import net .minecraft .util .Formatting ;
1921import net .minecraft .util .Identifier ;
2022import net .minecraft .util .hit .BlockHitResult ;
2123import net .minecraft .util .hit .EntityHitResult ;
2224import net .minecraft .util .hit .HitResult ;
2325import net .minecraft .util .math .BlockPos ;
24- import net .minecraft .text .Text ;
2526import net .fabricmc .fabric .api .client .rendering .v1 .HudRenderCallback ;
2627
2728import java .util .Map ;
@@ -53,7 +54,7 @@ public void onHudRender(DrawContext drawContext, float tickDelta) {
5354 BlockHitResult blockHit = (BlockHitResult ) hit ;
5455 BlockPos pos = blockHit .getBlockPos ();
5556 BlockState state = client .world .getBlockState (pos );
56-
57+
5758 if (state .getBlock () instanceof VesselBlock ) {
5859 if (client .world .getBlockEntity (pos ) instanceof VesselBlockEntity vessel ) {
5960 Map <String , Integer > aspects = vessel .getAspects ();
@@ -63,6 +64,15 @@ public void onHudRender(DrawContext drawContext, float tickDelta) {
6364 }
6465 }
6566 }
67+ } else if (hit .getType () == HitResult .Type .ENTITY ) {
68+ EntityHitResult entityHit = (EntityHitResult ) hit ;
69+ Entity entity = entityHit .getEntity ();
70+
71+ // Handle Aura Node entities specifically
72+ if (entity instanceof AuraNodeEntity auraNode ) {
73+ renderAuraNodeAspects (drawContext , auraNode , x , y );
74+ return ;
75+ }
6676 }
6777
6878 AspectData aspectData = getAspectDataForTarget (client , hit );
@@ -90,6 +100,62 @@ private AspectData getAspectDataForTarget(MinecraftClient client, HitResult hit)
90100 return null ;
91101 }
92102
103+ private void renderAuraNodeAspects (DrawContext context , AuraNodeEntity auraNode , int centerX , int centerY ) {
104+ TextRenderer textRenderer = MinecraftClient .getInstance ().textRenderer ;
105+ boolean showNames = MinecraftClient .getInstance ().options .sneakKey .isPressed ();
106+
107+ // Get aspects from the aura node
108+ var aspects = auraNode .getAspects ();
109+ if (aspects .isEmpty ()) return ;
110+
111+ // Calculate total width for centering
112+ int totalWidth = 0 ;
113+ for (var entry : aspects .entrySet ()) {
114+ Aspect aspect = ModRegistries .ASPECTS .get (entry .getKey ());
115+ if (aspect == null ) continue ;
116+
117+ int currentValue = entry .getValue ().current ;
118+ int textWidth = showNames ?
119+ textRenderer .getWidth (aspect .getTranslatedName ()) :
120+ textRenderer .getWidth (currentValue + "/" + entry .getValue ().original );
121+
122+ totalWidth += ASPECT_ICON_SIZE + textWidth + ASPECT_SPACING ;
123+ }
124+
125+ // Start position for drawing
126+ int currentX = centerX - totalWidth / 2 ;
127+
128+ for (var entry : aspects .entrySet ()) {
129+ Identifier aspectId = entry .getKey ();
130+ Aspect aspect = ModRegistries .ASPECTS .get (aspectId );
131+ if (aspect == null ) continue ;
132+
133+ int currentValue = entry .getValue ().current ;
134+ int originalValue = entry .getValue ().original ;
135+
136+ Identifier texture = aspect .textureLocation ();
137+ context .drawTexture (texture , currentX , centerY , 0 , 0 ,
138+ ASPECT_ICON_SIZE , ASPECT_ICON_SIZE ,
139+ ASPECT_ICON_SIZE , ASPECT_ICON_SIZE );
140+
141+ if (showNames ) {
142+ Text aspectText = aspect .getTranslatedName ().formatted (Formatting .WHITE );
143+ context .drawText (textRenderer , aspectText ,
144+ currentX + ASPECT_TEXT_OFFSET ,
145+ centerY + TEXT_Y_OFFSET ,
146+ 0xFFFFFF , false );
147+ currentX += ASPECT_ICON_SIZE + textRenderer .getWidth (aspectText ) + ASPECT_SPACING ;
148+ } else {
149+ String value = currentValue + "/" + originalValue ;
150+ context .drawText (textRenderer , value ,
151+ currentX + ASPECT_TEXT_OFFSET ,
152+ centerY + TEXT_Y_OFFSET ,
153+ 0xFFFFFF , false );
154+ currentX += ASPECT_ICON_SIZE + textRenderer .getWidth (value ) + ASPECT_SPACING ;
155+ }
156+ }
157+ }
158+
93159 private void renderAspectData (DrawContext context , AspectData data , int centerX , int centerY ) {
94160 TextRenderer textRenderer = MinecraftClient .getInstance ().textRenderer ;
95161 boolean showNames = MinecraftClient .getInstance ().options .sneakKey .isPressed ();
0 commit comments