use of club.sk1er.website.api.requests.HypixelApiGuild in project Hyperium by HyperiumClient.
the class PlayerStatsGui method drawScreen.
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
if (!texturesImage.isEmpty()) {
texturesImage.forEach((s, value) -> {
if (!logos.containsKey(s))
logos.put(s, new DynamicTexture(value));
});
}
super.drawScreen(mouseX, mouseY, partialTicks);
ScaledResolution current = ResolutionUtil.current();
HypixelApiGuild guild = player.getGuild();
if (guild == null) {
GeneralChatHandler.instance().sendMessage("Player not found!");
mc.displayGuiScreen(null);
return;
}
boolean isInGuild = guild.isLoaded() && guild.isValid();
drawScaledText(player.getDisplayString() + (isInGuild ? " " + guild.getFormatedTag() : ""), current.getScaledWidth() / 2, 30, 2, -1, true, true);
if (focused == null) {
final int blockWidth = 64 + 32;
int blocksPerLine = (int) (current.getScaledWidth() / (1.2D * blockWidth));
if (blocksPerLine % 2 == 1) {
blocksPerLine--;
}
final int startX = ResolutionUtil.current().getScaledWidth() / 2 - (blocksPerLine * blockWidth / 2);
int x = -1;
int y = 0;
hovered = null;
for (AbstractHypixelStats field : fields) {
DynamicTexture dynamicTexture = logos.get(field);
x++;
if (x > blocksPerLine) {
x = 0;
y++;
}
if (dynamicTexture != null) {
int y1 = 100 + y * blockWidth - 10 - offset;
if (y1 < 70)
continue;
GlStateManager.pushMatrix();
GlStateManager.resetColor();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
int y2 = 100 + y * blockWidth - offset;
int x1 = startX + x * blockWidth;
GuiBlock value = new GuiBlock(x1, x1 + blockWidth / 2, y2, y2 + blockWidth / 2);
if (value.isMouseOver(mouseX, mouseY)) {
hovered = field;
}
location.put(field, value);
GlStateManager.translate(x1, y2, 0);
GlStateManager.bindTexture(dynamicTexture.getGlTextureId());
GlStateManager.scale(.2, .2, .2);
drawTexturedModalRect(0, 0, 0, 0, 128 * 2, 128 * 2);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(startX + x * blockWidth + 24, y1, 0);
drawScaledText(field.getName(), 0, 0, 1.0, Color.RED.getRGB(), true, true);
GlStateManager.popMatrix();
}
}
if (hovered != null) {
List<StatsDisplayItem> preview = hovered.getPreview(player);
int width = 0;
int height = 0;
for (StatsDisplayItem statsDisplayItem : preview) {
width = Math.max(width, statsDisplayItem.width);
height += statsDisplayItem.height;
}
GuiBlock block = location.get(hovered);
int xOffset = 0;
int yRenderOffset = 16;
int rightSide = block.getRight() + (width + yRenderOffset) * 2;
if (rightSide > current.getScaledWidth()) {
xOffset = rightSide - current.getScaledWidth();
}
float scale = 1.0F;
GlStateManager.scale(scale, scale, scale);
int left = block.getRight() - xOffset + yRenderOffset - 8;
int top = block.getTop();
int printY = 0;
if (top + height * 2 > current.getScaledHeight()) {
top = current.getScaledHeight() - height * 2 - 50;
}
RenderUtils.drawRect((left - 3) / scale, (top - 3) / scale, (left + (width + 3) * scale) / scale, (top + (height + 3) * scale) / scale, new Color(0, 0, 0, 220).getRGB());
for (StatsDisplayItem statsDisplayItem : preview) {
statsDisplayItem.draw((int) (left / scale), (int) ((top) / scale) + printY);
printY += statsDisplayItem.height;
}
GlStateManager.scale(1 / scale, 1 / scale, 1 / scale);
}
} else {
DynamicTexture dynamicTexture = logos.get(focused);
GlStateManager.resetColor();
GlStateManager.pushMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.bindTexture(dynamicTexture.getGlTextureId());
GlStateManager.translate((current.getScaledWidth() >> 1) - 24, 80, 0);
GlStateManager.scale(.2, .2, .2);
drawTexturedModalRect(0, 0, 0, 0, 128 * 2, 128 * 2);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
drawScaledText(focused.getName(), current.getScaledWidth() / 2, 60, 2.0, Color.RED.getRGB(), true, true);
Icons.EXTENSION.bind();
GlStateModifier.INSTANCE.reset();
Icons.EXIT.bind();
float scale = 2.0F;
GlStateManager.scale(scale, scale, scale);
GlStateManager.translate(current.getScaledWidth() / 2F / scale - 90 / scale, (73) / scale, 0);
GlStateManager.rotate(180, 0.0F, 0.0F, 1.0F);
GlStateManager.translate(-16, -16, 0);
drawScaledCustomSizeModalRect(0, 0, 0, 0, 64, 64, 16, 16, 64, 64);
GlStateManager.popMatrix();
}
}
use of club.sk1er.website.api.requests.HypixelApiGuild in project Hyperium by HyperiumClient.
the class StatsHandler method loadGuildByPlayer.
public void loadGuildByPlayer(String player) {
Multithreading.runAsync(() -> {
GeneralChatHandler.instance().sendMessage("Loading guild for: " + player);
try {
HypixelApiGuild apiGuild = HypixelAPI.INSTANCE.getGuildFromPlayer(player).get();
new GuildStatsGui(apiGuild).show();
} catch (Exception e) {
e.printStackTrace();
}
});
}
use of club.sk1er.website.api.requests.HypixelApiGuild in project Hyperium by HyperiumClient.
the class StatsHandler method loadGuildByName.
public void loadGuildByName(String name) {
Multithreading.runAsync(() -> {
GeneralChatHandler.instance().sendMessage("Loading guild by name: " + name);
try {
HypixelApiGuild apiGuild = HypixelAPI.INSTANCE.getGuildFromName(name).get();
new GuildStatsGui(apiGuild).show();
} catch (Exception e) {
e.printStackTrace();
}
});
}
Aggregations