@@ -46,6 +46,8 @@ public class HUDModule extends Module {
4646 public static final IntSetting green = new IntSetting ("Green" , 255 , 0 , 255 , 1 );
4747 public static final IntSetting blue = new IntSetting ("Blue" , 255 , 0 , 255 , 1 );
4848
49+ private final Minecraft mc = Minecraft .getMinecraft ();
50+
4951 private final List <Long > fpsCounter = new ArrayList <>();
5052
5153 public HUDModule () {
@@ -57,10 +59,10 @@ public HUDModule() {
5759 @ EventLink
5860 public final Listener <RenderScreenEvent > renderScreenListener = event -> {
5961 final ScaledResolution scaledResolution = event .getScaledResolution ();
60- final FontRenderer fontRenderer = Minecraft . getMinecraft () .fontRenderer ;
62+ final FontRenderer fontRenderer = mc .fontRenderer ;
6163
62- int bottomRightOffset = (Minecraft . getMinecraft () .currentScreen instanceof GuiChat ? 14 : 0 );
63- int bottomLeftOffset = (Minecraft . getMinecraft () .currentScreen instanceof GuiChat ? 14 : 0 );
64+ int bottomRightOffset = (mc .currentScreen instanceof GuiChat ? 14 : 0 );
65+ int bottomLeftOffset = (mc .currentScreen instanceof GuiChat ? 14 : 0 );
6466
6567 if (this .watermark .getValue ()) {
6668 String display = Osiris .getInstance ().getName () + "§7" ;
@@ -79,12 +81,12 @@ public HUDModule() {
7981 if (this .coordinates .getValue ()) {
8082 if (this .netherCoordinates .getValue ()) {
8183 // get the deminsion the player is in (0 = overworld, -1 = nether, 1 = end)
82- final int dimension = Minecraft . getMinecraft () .thePlayer .dimension ;
84+ final int dimension = mc .thePlayer .dimension ;
8385
8486 // create overworld coordinates (if in nether * 8)
85- double x = Minecraft . getMinecraft () .thePlayer .posX * (dimension == -1 ? 8 : 1 );
86- double y = Minecraft . getMinecraft () .thePlayer .posY ;
87- double z = Minecraft . getMinecraft () .thePlayer .posZ * (dimension == -1 ? 8 : 1 );
87+ double x = mc .thePlayer .posX * (dimension == -1 ? 8 : 1 );
88+ double y = mc .thePlayer .posY ;
89+ double z = mc .thePlayer .posZ * (dimension == -1 ? 8 : 1 );
8890
8991 x = Math .round (x * 10.0 ) / 10.0 ;
9092 y = Math .round (y * 10.0 ) / 10.0 ;
@@ -93,17 +95,17 @@ public HUDModule() {
9395 fontRenderer .drawStringWithShadow (String .format ("Overworld§7 %.1f %.1f %.1f" , x , y , z ), 2 , scaledResolution .getScaledHeight () - bottomLeftOffset - 10 , new Color (red .getValue (), green .getValue (), blue .getValue ()).getRGB ());
9496
9597 // create nether coordinates (if in overworld / 8)
96- double netherX = Minecraft . getMinecraft () .thePlayer .posX / (dimension == 0 ? 8 : 1 );
97- double netherZ = Minecraft . getMinecraft () .thePlayer .posZ / (dimension == 0 ? 8 : 1 );
98+ double netherX = mc .thePlayer .posX / (dimension == 0 ? 8 : 1 );
99+ double netherZ = mc .thePlayer .posZ / (dimension == 0 ? 8 : 1 );
98100
99101 netherX = Math .round (netherX * 10.0 ) / 10.0 ;
100102 netherZ = Math .round (netherZ * 10.0 ) / 10.0 ;
101103
102104 fontRenderer .drawStringWithShadow (String .format ("Nether§7 %.1f %.1f" , netherX , netherZ ), 2 , scaledResolution .getScaledHeight () - bottomLeftOffset - 20 , new Color (red .getValue (), green .getValue (), blue .getValue ()).getRGB ());
103105 } else {
104- double x = Minecraft . getMinecraft () .thePlayer .posX ;
105- double y = Minecraft . getMinecraft () .thePlayer .posY ;
106- double z = Minecraft . getMinecraft () .thePlayer .posZ ;
106+ double x = mc .thePlayer .posX ;
107+ double y = mc .thePlayer .posY ;
108+ double z = mc .thePlayer .posZ ;
107109
108110 x = Math .round (x * 10.0 ) / 10.0 ;
109111 y = Math .round (y * 10.0 ) / 10.0 ;
@@ -114,11 +116,11 @@ public HUDModule() {
114116 }
115117
116118 if (this .durability .getValue ()) {
117- if (Minecraft . getMinecraft (). thePlayer .inventory .getCurrentItem () != null && Minecraft . getMinecraft () .thePlayer .inventory .getCurrentItem ().getMaxDamage () != 0 ) {
118- final int x = scaledResolution .getScaledWidth () - 2 - fontRenderer .getStringWidth ("Durability " + (Minecraft . getMinecraft (). thePlayer .inventory .getCurrentItem ().getMaxDamage () - Minecraft . getMinecraft () .thePlayer .inventory .getCurrentItem ().getItemDamage ()));
119+ if (mc . thePlayer .inventory .getCurrentItem () != null && mc .thePlayer .inventory .getCurrentItem ().getMaxDamage () != 0 ) {
120+ final int x = scaledResolution .getScaledWidth () - 2 - fontRenderer .getStringWidth ("Durability " + (mc . thePlayer .inventory .getCurrentItem ().getMaxDamage () - mc .thePlayer .inventory .getCurrentItem ().getItemDamage ()));
119121 final int y = scaledResolution .getScaledHeight () - bottomRightOffset - 10 ;
120122
121- fontRenderer .drawStringWithShadow ("Durability §7" + (Minecraft . getMinecraft (). thePlayer .inventory .getCurrentItem ().getMaxDamage () - Minecraft . getMinecraft () .thePlayer .inventory .getCurrentItem ().getItemDamage ()), x , y , new Color (red .getValue (), green .getValue (), blue .getValue ()).getRGB ());
123+ fontRenderer .drawStringWithShadow ("Durability §7" + (mc . thePlayer .inventory .getCurrentItem ().getMaxDamage () - mc .thePlayer .inventory .getCurrentItem ().getItemDamage ()), x , y , new Color (red .getValue (), green .getValue (), blue .getValue ()).getRGB ());
122124 bottomRightOffset += 10 ;
123125 }
124126 }
@@ -158,7 +160,7 @@ public HUDModule() {
158160 if (welcomer .getValue ()) {
159161 String display = getWelcomeMessage ();
160162
161- fontRenderer .drawStringWithShadow (display + " §7" + Minecraft . getMinecraft (). thePlayer .username + "§r!" , (float ) (scaledResolution .getScaledWidth () / 2 - fontRenderer .getStringWidth (display + " §7" + Minecraft . getMinecraft () .thePlayer .username + "§r!" ) / 2 ), (float ) 5 , new Color (red .getValue (), green .getValue (), blue .getValue ()).getRGB ());
163+ fontRenderer .drawStringWithShadow (display + " §7" + mc . thePlayer .username + "§r!" , (float ) (scaledResolution .getScaledWidth () / 2 - fontRenderer .getStringWidth (display + " §7" + mc .thePlayer .username + "§r!" ) / 2 ), (float ) 5 , new Color (red .getValue (), green .getValue (), blue .getValue ()).getRGB ());
162164 }
163165 };
164166
0 commit comments