22
22
import com .solegendary .reignofnether .minimap .MinimapClientEvents ;
23
23
import com .solegendary .reignofnether .orthoview .OrthoviewClientEvents ;
24
24
import com .solegendary .reignofnether .player .PlayerClientEvents ;
25
- import com .solegendary .reignofnether .research .ResearchClient ;
26
- import com .solegendary .reignofnether .resources .*;
25
+ import com .solegendary .reignofnether .resources .ResourceName ;
26
+ import com .solegendary .reignofnether .resources .ResourceSources ;
27
+ import com .solegendary .reignofnether .resources .Resources ;
28
+ import com .solegendary .reignofnether .resources .ResourcesClientEvents ;
27
29
import com .solegendary .reignofnether .sandbox .SandboxActionButtons ;
28
30
import com .solegendary .reignofnether .sandbox .SandboxClientEvents ;
29
31
import com .solegendary .reignofnether .sandbox .SandboxMenuType ;
48
50
import com .solegendary .reignofnether .util .MiscUtil ;
49
51
import com .solegendary .reignofnether .util .MyRenderer ;
50
52
import net .minecraft .client .Minecraft ;
53
+ import net .minecraft .client .gui .GuiGraphics ;
51
54
import net .minecraft .client .gui .screens .ChatScreen ;
52
55
import net .minecraft .client .model .Model ;
53
56
import net .minecraft .client .resources .language .I18n ;
54
57
import net .minecraft .core .BlockPos ;
55
- import net .minecraft .network .chat .Component ;
56
58
import net .minecraft .network .chat .Style ;
57
59
import net .minecraft .resources .ResourceLocation ;
58
60
import net .minecraft .util .FormattedCharSequence ;
@@ -172,13 +174,16 @@ public static String getSimpleEntityName(Entity entity) {
172
174
}
173
175
174
176
// not to be used for resource paths
175
- public static String getModifiedEntityName (Entity entity ) {
177
+ public static String getModifiedEntityName (LivingEntity entity ) {
176
178
String name = getSimpleEntityName (entity );
177
179
180
+ if (entity .isBaby ())
181
+ name = I18n .get ("units.neutral.reignofnether.baby" ) + " " + name ;
182
+
178
183
if (!(entity instanceof Unit ))
179
184
return name .toLowerCase ();
180
185
181
- ItemStack itemStack = (( LivingEntity ) entity ) .getItemBySlot (EquipmentSlot .HEAD );
186
+ ItemStack itemStack = entity .getItemBySlot (EquipmentSlot .HEAD );
182
187
183
188
if (itemStack .getItem () instanceof BannerItem ) {
184
189
name += " " + I18n .get ("units.villagers.reignofnether.captain" );
@@ -676,7 +681,7 @@ else if (hudSelectedEntity != null && portraitRendererUnit.model != null
676
681
677
682
Button button = new Button (unitName ,
678
683
iconSize ,
679
- new ResourceLocation (ReignOfNether .MOD_ID , buttonImagePath ),
684
+ unit instanceof Unit ? new ResourceLocation (ReignOfNether .MOD_ID , buttonImagePath ) : null ,
680
685
unit ,
681
686
() -> hudSelectedEntity == null || getModifiedEntityName (hudSelectedEntity ).equals (
682
687
getModifiedEntityName (unit )),
@@ -694,7 +699,7 @@ else if (hudSelectedEntity != null && portraitRendererUnit.model != null
694
699
null ,
695
700
List .of (fcs (capitaliseAndSpace (getModifiedEntityName (unit ))))
696
701
);
697
- if (unit .isVehicle ()) {
702
+ if (unit .isVehicle () && unit instanceof Unit ) {
698
703
String passengerName = getSimpleEntityName (unit .getFirstPassenger ());
699
704
button .bgIconResource = new ResourceLocation (ReignOfNether .MOD_ID ,
700
705
"textures/mobheads/" + passengerName + ".png"
@@ -763,6 +768,18 @@ else if (hudSelectedEntity != null && portraitRendererUnit.model != null
763
768
} else {
764
769
unitButton .render (evt .getGuiGraphics (), blitX , blitY , mouseX , mouseY );
765
770
renderedButtons .add (unitButton );
771
+ if (unitButton .iconResource == null ) {
772
+ String str = unitButton .name .substring (0 ,1 ).toUpperCase ();
773
+ if (unitButton .name .length () > 1 ) {
774
+ str += unitButton .name .substring (1 , 2 );
775
+ }
776
+ evt .getGuiGraphics ().drawCenteredString (MC .font ,
777
+ fcs (str , true ),
778
+ blitX + (unitButton .iconSize / 2 ) + 4 ,
779
+ blitY + (unitButton .iconSize / 2 ),
780
+ 0xFFFFFF
781
+ );
782
+ }
766
783
unitButton .renderHealthBar (evt .getGuiGraphics ().pose ());
767
784
blitX += iconFrameSize ;
768
785
if (buttonsRendered == buttonsPerRow - 1 ) {
0 commit comments