|
@@ -1,9 +1,14 @@
|
|
|
package me.km.networking;
|
|
|
|
|
|
+import java.lang.reflect.Field;
|
|
|
+import java.util.Map;
|
|
|
import me.km.KajetansMod;
|
|
|
+import me.km.utils.ReflectionUtils;
|
|
|
+import net.minecraft.block.Block;
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
import net.minecraft.client.gui.FontRenderer;
|
|
|
import net.minecraft.client.gui.Gui;
|
|
|
+import net.minecraft.client.gui.GuiBossOverlay;
|
|
|
import net.minecraft.client.gui.ScaledResolution;
|
|
|
import net.minecraft.client.renderer.GlStateManager;
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
@@ -38,8 +43,8 @@ public class ItemStackDisplayGui extends Gui
|
|
|
if(index >= 0 && index < 9)
|
|
|
{
|
|
|
index *= 3;
|
|
|
- icons[index] = i < 48 ? 64 + ((i % 12) << 4) : (((i - 48) & 0xF) << 4);
|
|
|
- icons[index + 1] = i < 48 ? (i / 12) << 4 : 64 + (((i - 48) >> 4) << 4);
|
|
|
+ icons[index] = i < 8 ? 192 + ((i % 4) << 4) : (((i - 8) & 0xF) << 4);
|
|
|
+ icons[index + 1] = i < 8 ? (i / 4) << 4 : 32 + (((i - 8) >> 4) << 4);
|
|
|
icons[index + 2] = count;
|
|
|
}
|
|
|
}
|
|
@@ -48,15 +53,17 @@ public class ItemStackDisplayGui extends Gui
|
|
|
{
|
|
|
for(int i = 0; i < 27; i += 3)
|
|
|
{
|
|
|
- icons[i] = 64;
|
|
|
+ icons[i] = -1;
|
|
|
icons[i + 1] = 0;
|
|
|
icons[i + 2] = 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private final static Field MAP_BOSS_INFO = ReflectionUtils.getField(GuiBossOverlay.class, "field_184060_g", "mapBossInfos");
|
|
|
+
|
|
|
public void paint()
|
|
|
{
|
|
|
- if(inactive || mc.ingameGUI.getChatGUI().getChatOpen())
|
|
|
+ if(inactive)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
@@ -66,18 +73,31 @@ public class ItemStackDisplayGui extends Gui
|
|
|
mc.getTextureManager().bindTexture(CUSTOM_ICONS);
|
|
|
|
|
|
ScaledResolution scaledresolution = new ScaledResolution(mc);
|
|
|
- int screenWidth = scaledresolution.getScaledWidth();
|
|
|
- int screenHeight = scaledresolution.getScaledHeight();
|
|
|
- drawTexturedModalRect(screenWidth - 62, screenHeight - 62, 0, 0, 62, 62);
|
|
|
+ int screenWidth = (scaledresolution.getScaledWidth() >> 1) - 91;
|
|
|
+ int y = 3;
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Map info = (Map) MAP_BOSS_INFO.get(mc.ingameGUI.getBossOverlay());
|
|
|
+ if(!info.isEmpty())
|
|
|
+ {
|
|
|
+ y += 20;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(IllegalAccessException | IllegalArgumentException ex)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ drawTexturedModalRect(screenWidth, y - 3, 0, 0, 182, 22);
|
|
|
|
|
|
int i = 0;
|
|
|
- for(int y = 59; y > 0; y -= 20)
|
|
|
+ for(int x = 3; x < 164; x += 20)
|
|
|
{
|
|
|
- for(int x = 59; x > 0; x -= 20)
|
|
|
+ if(icons[i] != -1)
|
|
|
{
|
|
|
- drawTexturedModalRect(screenWidth - x, screenHeight - y, icons[i], icons[i + 1], 16, 16);
|
|
|
- i += 3;
|
|
|
+ drawTexturedModalRect(screenWidth + x, y, icons[i], icons[i + 1], 16, 16);
|
|
|
}
|
|
|
+ i += 3;
|
|
|
}
|
|
|
|
|
|
GlStateManager.disableBlend();
|
|
@@ -85,17 +105,14 @@ public class ItemStackDisplayGui extends Gui
|
|
|
FontRenderer fr = mc.fontRenderer;
|
|
|
String s;
|
|
|
i = 2;
|
|
|
- for(int y = 50; y > 0; y -= 20)
|
|
|
+ for(int x = 20; x < 181; x += 20)
|
|
|
{
|
|
|
- for(int x = 42; x > 0; x -= 20)
|
|
|
+ if(icons[i] != 0)
|
|
|
{
|
|
|
- if(icons[i] != 0)
|
|
|
- {
|
|
|
- s = String.valueOf(icons[i]);
|
|
|
- fr.drawStringWithShadow(s, (float)(screenWidth - x - fr.getStringWidth(s)), (float)(screenHeight - y), 16777215);
|
|
|
- }
|
|
|
- i += 3;
|
|
|
- }
|
|
|
+ s = String.valueOf(icons[i]);
|
|
|
+ fr.drawStringWithShadow(s, (float)(screenWidth + x - fr.getStringWidth(s)), y + 9, 16777215);
|
|
|
+ }
|
|
|
+ i += 3;
|
|
|
}
|
|
|
}
|
|
|
}
|