diff options
Diffstat (limited to 'src/main/java/io')
16 files changed, 940 insertions, 259 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/GuiItemRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/GuiItemRecipe.java index 200569df..d0301b2c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/GuiItemRecipe.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/GuiItemRecipe.java @@ -170,7 +170,7 @@ public class GuiItemRecipe extends GuiScreen { @Override public void handleKeyboardInput() throws IOException { - super.handleKeyboardInput(); //TODO: r and u + super.handleKeyboardInput(); ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); int width = scaledResolution.getScaledWidth(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index edf1d31c..b879c383 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -1079,8 +1079,6 @@ public class NEUManager { } if(craftMatrices.size() > 0) { - Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow( - Minecraft.getMinecraft().thePlayer.openContainer.windowId)); Minecraft.getMinecraft().displayGuiScreen(new GuiItemRecipe("Item Usages", craftMatrices, results, this)); return true; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index a33c13b3..25b27cc5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -96,7 +96,6 @@ public class NEUOverlay extends Gui { private JsonObject[] searchedItemsArr = null; private boolean itemPaneOpen = false; - private boolean hoveringItemPaneToggle = false; private int page = 0; @@ -1636,21 +1635,16 @@ public class NEUOverlay extends Gui { int rightSide = leftSide+paneWidth-getBoxPadding()-getItemBoxXPadding(); //Tab - Minecraft.getMinecraft().getTextureManager().bindTexture(itemPaneTabArrow); - GlStateManager.color(1f, 1f, 1f, 0.3f); - Utils.drawTexturedRect(width-itemPaneTabOffset.getValue(), height/2 - 50, 20, 100); - GlStateManager.bindTexture(0); + if(!manager.config.disableItemTabOpen.value) { + Minecraft.getMinecraft().getTextureManager().bindTexture(itemPaneTabArrow); + GlStateManager.color(1f, 1f, 1f, 0.3f); + Utils.drawTexturedRect(width-itemPaneTabOffset.getValue(), height/2 - 50, 20, 100); + GlStateManager.bindTexture(0); - if(mouseX > width-itemPaneTabOffset.getValue() && mouseY > height/2 - 50 - && mouseY < height/2 + 50) { - if(!hoveringItemPaneToggle) { - if(!manager.config.disableItemTabOpen.value) { - itemPaneOpen = !itemPaneOpen; - } - hoveringItemPaneToggle = true; + if(!itemPaneOpen && mouseX > width-itemPaneTabOffset.getValue() && mouseY > height/2 - 50 + && mouseY < height/2 + 50) { + itemPaneOpen = true; } - } else { - hoveringItemPaneToggle = false; } //Atomic reference used so that below lambda doesn't complain about non-effectively-final variable diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index a7a30233..734f7ca1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -14,7 +14,7 @@ import io.github.moulberry.notenoughupdates.infopanes.CosmeticsInfoPane; import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer; import io.github.moulberry.notenoughupdates.questing.GuiQuestLine; -import io.github.moulberry.notenoughupdates.questing.NEUQuesting; +import io.github.moulberry.notenoughupdates.questing.SBScoreboardData; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -31,20 +31,15 @@ import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.Scoreboard; import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.Session; import net.minecraftforge.client.ClientCommandHandler; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.client.event.GuiOpenEvent; -import net.minecraftforge.client.event.GuiScreenEvent; -import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.event.*; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.fml.client.registry.ClientRegistry; @@ -139,10 +134,13 @@ public class NotEnoughUpdates { if(args.length != 1) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "idiot.")); + } else { + profileViewer.getProfileByName(args[0], profile -> { + profile.resetCache(); + openGui = new GuiProfileViewer(profile); + }); } - profileViewer.getProfileByName(args[0], profile -> { - openGui = new GuiProfileViewer(profile); - }); + //openGui = new GuiProfileViewer(null); } }); @@ -398,7 +396,7 @@ public class NotEnoughUpdates { joinedSB = false; } } - //NEUQuesting.getInstance().tick(); + SBScoreboardData.getInstance().tick(); //GuiQuestLine.questLine.tick(); } if(currChatMessage != null && System.currentTimeMillis() - lastChatMessage > CHAT_MSG_COOLDOWN) { @@ -473,6 +471,15 @@ public class NotEnoughUpdates { } } + @SubscribeEvent(priority=EventPriority.HIGHEST) + public void onRenderEntitySpecials(RenderLivingEvent.Specials.Pre event) { + if(Minecraft.getMinecraft().currentScreen instanceof GuiProfileViewer) { + if(((GuiProfileViewer)Minecraft.getMinecraft().currentScreen).getEntityPlayer() == event.entity) { + event.setCanceled(true); + } + } + } + @SubscribeEvent public void onRenderGameOverlay(RenderGameOverlayEvent event) { if(event.type != null && event.type.equals(RenderGameOverlayEvent.ElementType.BOSSHEALTH) && diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java index 65f6545e..53cc4639 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java @@ -168,7 +168,9 @@ public class APIManager { args.put("uuid", ""+uuid); manager.hypixelApi.getHypixelApiAsync(manager.config.apiKey.value, "skyblock/profiles", args, jsonObject -> { - if(jsonObject.has("success") && jsonObject.get("success").getAsBoolean()) { + if(jsonObject == null) return; + + if(jsonObject.has("success") && jsonObject.get("success").getAsBoolean()) { incPlayerInfoVersion(); playerInformation = jsonObject.get("profiles").getAsJsonArray(); if(playerInformation == null) return; @@ -366,7 +368,9 @@ public class APIManager { args.put("page", ""+page); manager.hypixelApi.getHypixelApiAsync(manager.config.apiKey.value, "skyblock/auctions", args, jsonObject -> { - if (jsonObject.get("success").getAsBoolean()) { + if(jsonObject == null) return; + + if (jsonObject.get("success").getAsBoolean()) { totalPages = jsonObject.get("totalPages").getAsInt(); activeAuctions = jsonObject.get("totalAuctions").getAsInt(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java index 17ce216e..77fa8425 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java @@ -103,7 +103,7 @@ public class CustomAH extends Gui { private Category CATEGORY_TRAVEL_SCROLLS = new Category("travelscroll", "Travel Scrolls", "map"); private Category CATEGORY_REFORGE_STONES = new Category("reforgestone", "Reforge Stones", "anvil"); - private Category CATEGORY_RUNES = new Category("rune", "Runes", "end_portal_frame"); + private Category CATEGORY_RUNES = new Category("rune", "Runes", "magma_cream"); private Category CATEGORY_FURNITURE = new Category("furniture", "Furniture", "armor_stand"); private Category CATEGORY_COMBAT = new Category("weapon", "Combat", "golden_sword", CATEGORY_SWORD, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java index 81ecc9b4..9607a888 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -1,5 +1,6 @@ package io.github.moulberry.notenoughupdates.profileviewer; +import com.google.common.base.Splitter; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -7,35 +8,49 @@ import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.properties.Property; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager; +import io.github.moulberry.notenoughupdates.questing.SBScoreboardData; import io.github.moulberry.notenoughupdates.util.TexLoc; import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityOtherPlayerMP; +import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.resources.DefaultPlayerSkin; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; import net.minecraft.client.resources.SkinManager; +import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.Charsets; +import org.luaj.vm2.ast.Str; import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL14; +import org.lwjgl.opengl.GL20; import java.awt.*; +import java.io.IOException; import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.UUID; +import java.util.*; +import java.util.List; public class GuiProfileViewer extends GuiScreen { @@ -48,6 +63,14 @@ public class GuiProfileViewer extends GuiScreen { private int guiLeft; private int guiTop; + private float backgroundRotation = 0; + + private long currentTime = 0; + private long lastTime = 0; + private long startTime = 0; + + private List<String> tooltipToDisplay = null; + public enum ProfileViewerPage { BASIC } @@ -58,6 +81,9 @@ public class GuiProfileViewer extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { + currentTime = System.currentTimeMillis(); + if(startTime == 0) startTime = currentTime; + super.drawScreen(mouseX, mouseY, partialTicks); drawDefaultBackground(); @@ -67,6 +93,12 @@ public class GuiProfileViewer extends GuiScreen { break; } + lastTime = currentTime; + + if(tooltipToDisplay != null) { + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj); + tooltipToDisplay = null; + } } private String niceUuid(String uuidStr) { @@ -85,33 +117,196 @@ public class GuiProfileViewer extends GuiScreen { return niceAucId.toString(); } + public EntityOtherPlayerMP getEntityPlayer() { + return entityPlayer; + } + private EntityOtherPlayerMP entityPlayer = null; private ResourceLocation playerLocationSkin = null; private ResourceLocation playerLocationCape = null; private String skinType = null; - TexLoc tl = new TexLoc(0, 0, Keyboard.KEY_M); - TexLoc tl2 = new TexLoc(0, 0, Keyboard.KEY_B); - TexLoc tl3 = new TexLoc(0, 0, Keyboard.KEY_J); + private HashMap<String, ResourceLocation[]> panoramasMap = new HashMap<>(); + + public ResourceLocation[] getPanoramasForLocation(String location, String identifier) { + if(panoramasMap.containsKey(location)) return panoramasMap.get(location); + try { + ResourceLocation[] panoramasArray = new ResourceLocation[6]; + for(int i=0; i<6; i++) { + panoramasArray[i] = new ResourceLocation("notenoughupdates:panoramas/"+location+"_"+identifier+"/panorama_"+i+".png"); + Minecraft.getMinecraft().getResourceManager().getResource(panoramasArray[i]); + } + panoramasMap.put(location, panoramasArray); + return panoramasArray; + } catch(IOException e) { + try { + ResourceLocation[] panoramasArray = new ResourceLocation[6]; + for(int i=0; i<6; i++) { + panoramasArray[i] = new ResourceLocation("notenoughupdates:panoramas/"+location+"/panorama_"+i+".png"); + Minecraft.getMinecraft().getResourceManager().getResource(panoramasArray[i]); + } + panoramasMap.put(location, panoramasArray); + return panoramasArray; + } catch(IOException e2) { + ResourceLocation[] panoramasArray = new ResourceLocation[6]; + for(int i=0; i<6; i++) { + panoramasArray[i] = new ResourceLocation("notenoughupdates:panoramas/unknown/panorama_"+i+".png"); + } + panoramasMap.put(location, panoramasArray); + return panoramasArray; + } + } + } + + private int backgroundClickedX = -1; + + private static char[] c = new char[]{'k', 'm', 'b', 't'}; + + public static String shortNumberFormat(double n, int iteration) { + double d = ((long) n / 100) / 10.0; + boolean isRound = (d * 10) %10 == 0; + return (d < 1000? + ((d > 99.9 || isRound || (!isRound && d > 9.99)? + (int) d * 10 / 10 : d + "" + ) + "" + c[iteration]) + : shortNumberFormat(d, iteration+1)); + } + private void drawBasicPage(int mouseX, int mouseY, float partialTicks) { + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + this.sizeX = 431; this.sizeY = 202; this.guiLeft = (this.width-this.sizeX)/2; this.guiTop = (this.height-this.sizeY)/2; + String location = null; + JsonObject status = profile.getPlayerStatus(); + if(status != null && status.has("mode")) { + location = status.get("mode").getAsString(); + } + + int extraRotation = 0; + if(Mouse.isButtonDown(0)) { + if(backgroundClickedX == -1) { + if(mouseX > guiLeft+23 && mouseX < guiLeft+23+81) { + if(mouseY > guiTop+44 && mouseY < guiTop+44+108) { + backgroundClickedX = mouseX; + } + } + } + } else { + if(backgroundClickedX != -1) { + backgroundRotation += mouseX - backgroundClickedX; + backgroundClickedX = -1; + } + } + if(backgroundClickedX == -1) { + backgroundRotation += (currentTime - lastTime)/400f; + } else { + extraRotation = mouseX - backgroundClickedX; + } + backgroundRotation %= 360; + + String panoramaIdentifier = "day"; + if(SBScoreboardData.getInstance().currentTimeDate != null) { + if(SBScoreboardData.getInstance().currentTimeDate.before(new Date(0, 0, 0, 6, 0, 0))) { + if(SBScoreboardData.getInstance().currentTimeDate.after(new Date(0, 0, 0, 20, 0, 0))) { + panoramaIdentifier = "night"; + } + } + } + + Panorama.drawPanorama(-backgroundRotation-extraRotation, guiLeft+23, guiTop+44, 81, 108, + getPanoramasForLocation(location==null?"unknown":location, panoramaIdentifier)); + Minecraft.getMinecraft().getTextureManager().bindTexture(pv_basic); Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST); - tl.handleKeyboardInput(); - tl2.handleKeyboardInput(); - tl3.handleKeyboardInput(); + if(entityPlayer != null && profile.getHypixelProfile() != null) { + String rank = Utils.getElementAsString(profile.getHypixelProfile().get("rank"), Utils.getElementAsString(profile.getHypixelProfile().get("newPackageRank"), "NONE")); + EnumChatFormatting rankPlusColorECF = EnumChatFormatting.getValueByName(Utils.getElementAsString(profile.getHypixelProfile().get("rankPlusColor"), "WHITE")); + String rankPlusColor = EnumChatFormatting.WHITE.toString(); + if(rankPlusColorECF != null) { + rankPlusColor = rankPlusColorECF.toString(); + } + + JsonObject misc = Utils.getConstant("misc"); + if(misc != null) { + if(misc.has("ranks")) { + String rankName = Utils.getElementAsString(Utils.getElement(misc, "ranks."+rank+".tag"), null); + String rankColor = Utils.getElementAsString(Utils.getElement(misc, "ranks."+rank+".color"), "7"); + String rankPlus = Utils.getElementAsString(Utils.getElement(misc, "ranks."+rank+".plus"), ""); + + String name = entityPlayer.getName(); + + if(misc.has("special_bois")) { + JsonArray special_bois = misc.get("special_bois").getAsJsonArray(); + for(int i=0; i<special_bois.size(); i++) { + if(special_bois.get(i).getAsString().equals(profile.getUuid())) { + name = Utils.chromaString(name); + break; + } + } + } + + String playerName = EnumChatFormatting.GRAY.toString() + name; + if(rankName != null) { + StringBuilder sb = new StringBuilder(); + sb.append("\u00A7"+rankColor); + sb.append("["); + sb.append(rankName); + sb.append(rankPlusColor); + sb.append(rankPlus); + sb.append("\u00A7"+rankColor); + sb.append("] "); + sb.append(name); + playerName = sb.toString(); + } + + int rankPrefixLen = fr.getStringWidth(playerName); + int halfRankPrefixLen = rankPrefixLen/2; + + int x = guiLeft+63; + int y = guiTop+54; + + drawRect(x-halfRankPrefixLen-1, y-1, x+halfRankPrefixLen+1, y+8, new Color(0, 0, 0, 64).getRGB()); + + fr.drawString(playerName, x-halfRankPrefixLen, y, 0, true); + } + } + } + + if(status != null) { + JsonElement onlineElement = Utils.getElement(status, "online"); + boolean online = onlineElement != null && onlineElement.isJsonPrimitive() && onlineElement.getAsBoolean(); + String statusStr = online ? EnumChatFormatting.GREEN + "ONLINE" : EnumChatFormatting.RED + "OFFLINE"; + String locationStr = null; + if(profile.getUuid().equals("20934ef9488c465180a78f861586b4cf")) { + locationStr = "Ignoring DMs"; + } else { + if(location != null) { + JsonObject misc = Utils.getConstant("misc"); + if(misc != null) { + locationStr = Utils.getElementAsString(Utils.getElement(misc, "area_names."+location), "Unknown Location"); + } + } + } + if(locationStr != null) { + statusStr += EnumChatFormatting.GRAY+" - "+EnumChatFormatting.GREEN+locationStr; + } + + Utils.drawStringCentered(statusStr, fr, guiLeft+63, guiTop+160, true, 0); + } + + if(profile.getPlayerInformation(null) == null) { + //TODO: "Downloading player information" + return; + } if(entityPlayer == null) { UUID playerUUID = UUID.fromString(niceUuid(profile.getUuid())); GameProfile fakeProfile = Minecraft.getMinecraft().getSessionService().fillProfileProperties(new GameProfile(playerUUID, "CoolGuy123"), false); - for(Property prop : fakeProfile.getProperties().get("textures")) { - System.out.println(new String(Base64.decodeBase64(prop.getValue()), Charsets.UTF_8)); - } entityPlayer = new EntityOtherPlayerMP(Minecraft.getMinecraft().theWorld, fakeProfile) { public ResourceLocation getLocationSkin() { return playerLocationSkin == null ? DefaultPlayerSkin.getDefaultSkin(this.getUniqueID()) : playerLocationSkin; @@ -125,6 +320,10 @@ public class GuiProfileViewer extends GuiScreen { return skinType == null ? DefaultPlayerSkin.getSkinType(this.getUniqueID()) : skinType; } }; + entityPlayer.setAlwaysRenderNameTag(false); + entityPlayer.setCustomNameTag(""); + } else { + entityPlayer.refreshDisplayName(); } JsonObject profileInfo = profile.getProfileInformation(null); @@ -132,7 +331,7 @@ public class GuiProfileViewer extends GuiScreen { JsonObject skillInfo = profile.getSkillInfo(null); JsonObject inventoryInfo = profile.getInventoryInfo(null); - JsonObject collectionInfo =profile. getCollectionInfo(null); + JsonObject collectionInfo = profile. getCollectionInfo(null); if(inventoryInfo != null && inventoryInfo.has("inv_armor")) { JsonArray items = inventoryInfo.get("inv_armor").getAsJsonArray(); @@ -165,122 +364,176 @@ public class GuiProfileViewer extends GuiScreen { } catch(Exception e){} } - drawEntityOnScreen(guiLeft+63, guiTop+129, 30, guiLeft+63-mouseX, guiTop+129-mouseY, entityPlayer); + GlStateManager.color(1, 1, 1, 1); + drawEntityOnScreen(guiLeft+63, guiTop+128+7, 36, guiLeft+63-mouseX, guiTop+129-mouseY, entityPlayer); PlayerStats.Stats stats = profile.getStats(null); - for(int i=0; i<PlayerStats.defaultStatNames.length; i++) { - String statName = PlayerStats.defaultStatNames[i]; - String statNamePretty = PlayerStats.defaultStatNamesPretty[i]; - int val = Math.round(stats.get(statName)); + if(stats != null) { + Splitter splitter = Splitter.on(" ").omitEmptyStrings().limit(2); + for(int i=0; i<PlayerStats.defaultStatNames.length; i++) { + String statName = PlayerStats.defaultStatNames[i]; + String statNamePretty = PlayerStats.defaultStatNamesPretty[i]; + int val = Math.round(stats.get(statName)); + GlStateManager.color(1, 1, 1, 1); + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + for(int xOff=-2; xOff<=2; xOff++) { + for(int yOff=-2; yOff<=2; yOff++) { + if(Math.abs(xOff) != Math.abs(yOff)) { + Utils.drawStringCenteredScaledMaxWidth(Utils.cleanColourNotModifiers(statNamePretty) + " " + val, Minecraft.getMinecraft().fontRendererObj, + guiLeft+172f+xOff/2f, guiTop+36+12.5f*i+yOff/2f, false, 80, new Color(0, 0, 0, + 200/Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB()); + } + } + } - for(int xOff=-1; xOff<=1; xOff++) { - for(int yOff=-1; yOff<=1; yOff++) { - if(Math.abs(xOff) != Math.abs(yOff)) { - //Utils.drawStringCenteredScaledMaxWidth(Utils.cleanColourNotModifiers(statNamePretty) + " " + val, Minecraft.getMinecraft().fontRendererObj, - // guiLeft+172f+xOff, guiTop+36+12.5f*i+yOff, false, 85, new Color(100, 100, 100, 100).getRGB()); + GlStateManager.color(1, 1, 1, 1); + Utils.drawStringCenteredScaledMaxWidth(statNamePretty + " " + EnumChatFormatting.WHITE + val, Minecraft.getMinecraft().fontRendererObj, + guiLeft+172f, guiTop+36+12.5f*i, false, 80, 4210752); + + + if(mouseX > guiLeft+132 && mouseX < guiLeft+212) { + if(mouseY > guiTop+32+12.5f*i && mouseY < guiTop+40+12.5f*i) { + List<String> split = splitter.splitToList(statNamePretty); + PlayerStats.Stats baseStats = PlayerStats.getBaseStats(); + tooltipToDisplay = new ArrayList<>(); + tooltipToDisplay.add(statNamePretty); + int base = Math.round(baseStats.get(statName)); + tooltipToDisplay.add(EnumChatFormatting.GRAY+"Base "+split.get(1)+": "+EnumChatFormatting.GREEN+base+" "+split.get(0)); + int passive = Math.round(profile.getPassiveStats(null).get(statName)-baseStats.get(statName)); + tooltipToDisplay.add(EnumChatFormatting.GRAY+"Passive "+split.get(1)+" Bonus: +"+EnumChatFormatting.YELLOW+passive+" "+split.get(0)); + int itemBonus = Math.round(stats.get(statName)-profile.getPassiveStats(null).get(statName)); + tooltipToDisplay.add(EnumChatFormatting.GRAY+"Item "+split.get(1)+" Bonus: +"+EnumChatFormatting.DARK_PURPLE+itemBonus+" "+split.get(0)); + int finalStat = Math.round(stats.get(statName)); + tooltipToDisplay.add(EnumChatFormatting.GRAY+"Final "+split.get(1)+": +"+EnumChatFormatting.RED+finalStat+" "+split.get(0)); } } } - - GlStateManager.color(1, 1, 1, 1); - Utils.drawStringCenteredScaledMaxWidth(statNamePretty + " " + EnumChatFormatting.WHITE + val, Minecraft.getMinecraft().fontRendererObj, - guiLeft+172f, guiTop+36+12.5f*i, true, 85, Color.BLACK.getRGB()); + } else { + //"stats not enabled in api" } - int position = 0; - for(Map.Entry<String, String> entry : skillToSkillNameMap.entrySet()) { - int yPosition = position % 7; - int xPosition = position / 7; + if(skillInfo != null) { + int position = 0; + for(Map.Entry<String, ItemStack> entry : ProfileViewer.getSkillToSkillDisplayMap().entrySet()) { + int yPosition = position % 7; + int xPosition = position / 7; - String skillName = entry.getValue(); + String skillName = entry.getValue().getDisplayName(); - float level = (int)skillInfo.get(entry.getKey()).getAsFloat(); + float level = Utils.getElementAsFloat(skillInfo.get("level_"+entry.getKey()), 0); + int levelFloored = (int)Math.floor(level); - for(int xOff=-1; xOff<=1; xOff++) { - for(int yOff=-1; yOff<=1; yOff++) { - if(Math.abs(xOff) != Math.abs(yOff)) { - //Utils.drawStringCenteredScaledMaxWidth(Utils.cleanColourNotModifiers(skillName) + " " + level, Minecraft.getMinecraft().fontRendererObj, - // guiLeft+tl.x+tl2.x*xPosition+xOff, guiTop+tl.y+tl2.y*yPosition+yOff, false, 85, new Color(100, 100, 100, 100).getRGB()); + int x = guiLeft+237+86*xPosition; + int y = guiTop+31+21*yPosition; + + for(int xOff=-2; xOff<=2; xOff++) { + for(int yOff=-2; yOff<=2; yOff++) { + if(Math.abs(xOff) != Math.abs(yOff)) { + Utils.drawStringCenteredYScaledMaxWidth(Utils.cleanCo |
