diff options
Diffstat (limited to 'src/main/java/io')
12 files changed, 482 insertions, 8 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 99a48a36..6d2904be 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -843,6 +843,10 @@ public class NEUEventListener { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "[NEU] API Key automatically configured")); NotEnoughUpdates.INSTANCE.config.apiKey.apiKey = NotEnoughUpdates.INSTANCE.config.apiKey.apiKey.substring(0, 36); + } else if (unformatted.startsWith("Player List Info is now disabled!")) { + SBInfo.getInstance().hasNewTab = false; + } else if (unformatted.startsWith("Player List Info is now enabled!")) { + SBInfo.getInstance().hasNewTab = true; } if (e.message.getFormattedText().equals(EnumChatFormatting.RESET.toString() + EnumChatFormatting.RED + "You haven't unlocked this recipe!" + EnumChatFormatting.RESET)) { @@ -1080,6 +1084,16 @@ public class NEUEventListener { x += 80 + 28; } } + if (NEUOverlay.isRenderingArmorHud()) { + if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop && y < guiTop + 84) { + x -= 25; + } + } + if (NEUOverlay.isRenderingPetHud()) { + if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop + 60 && y < guiTop + 120) { + x -= 25; + } + } GlStateManager.color(1, 1, 1, 1f); @@ -1191,6 +1205,16 @@ public class NEUEventListener { x += 80 + 28; } } + if (NEUOverlay.isRenderingArmorHud()) { + if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop && y < guiTop + 84) { + x -= 25; + } + } + if (NEUOverlay.isRenderingPetHud()) { + if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop + 60 && y < guiTop + 120) { + x -= 25; + } + } if (x - guiLeft >= 85 && x - guiLeft <= 115 && y - guiTop >= 4 && y - guiTop <= 25) { disableCraftingText = true; @@ -1565,6 +1589,16 @@ public class NEUEventListener { x += 80 + 28; } } + if (NEUOverlay.isRenderingArmorHud()) { + if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop && y < guiTop + 84) { + x -= 25; + } + } + if (NEUOverlay.isRenderingPetHud()) { + if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop + 60 && y < guiTop + 120) { + x -= 25; + } + } if (mouseX >= x && mouseX <= x + 18 && mouseY >= y && mouseY <= y + 18) { if (Minecraft.getMinecraft().thePlayer.inventory.getItemStack() == null) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index 064b1fa7..b3d13351 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -96,7 +96,7 @@ public class NEUManager { } public void setCurrentProfile(String currentProfile) { - this.currentProfile = currentProfile; + SBInfo.getInstance().currentProfile = currentProfile; } public String getCurrentProfile() { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index acc15e8d..ca8a48d8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -16,6 +16,7 @@ import io.github.moulberry.notenoughupdates.mbgui.MBAnchorPoint; import io.github.moulberry.notenoughupdates.mbgui.MBGuiElement; import io.github.moulberry.notenoughupdates.mbgui.MBGuiGroupAligned; import io.github.moulberry.notenoughupdates.mbgui.MBGuiGroupFloating; +import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay; import io.github.moulberry.notenoughupdates.miscfeatures.SunTzu; import io.github.moulberry.notenoughupdates.miscgui.GuiPriceGraph; import io.github.moulberry.notenoughupdates.options.NEUConfigEditor; @@ -26,8 +27,11 @@ import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; +import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.entity.RenderManager; @@ -39,6 +43,8 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Items; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -73,6 +79,33 @@ public class NEUOverlay extends Gui { private static final ResourceLocation SEARCH_BAR = new ResourceLocation("notenoughupdates:search_bar.png"); private static final ResourceLocation SEARCH_BAR_GOLD = new ResourceLocation("notenoughupdates:search_bar_gold.png"); + private static final ResourceLocation ARMOR_DISPLAY = new ResourceLocation("notenoughupdates:armordisplay/armordisplay.png"); + private static final ResourceLocation ARMOR_DISPLAY_GREY = new ResourceLocation("notenoughupdates:armordisplay/armordisplay_grey.png"); + private static final ResourceLocation ARMOR_DISPLAY_DARK = new ResourceLocation("notenoughupdates:armordisplay/armordisplay_phq_dark.png"); + private static final ResourceLocation ARMOR_DISPLAY_FSR = new ResourceLocation("notenoughupdates:armordisplay/armordisplay_fsr.png"); + private static final ResourceLocation ARMOR_DISPLAY_TRANSPARENT = new ResourceLocation("notenoughupdates:armordisplay/armordisplay_transparent.png"); + private static final ResourceLocation ARMOR_DISPLAY_TRANSPARENT_PET = new ResourceLocation("notenoughupdates:armordisplay/armordisplay_transparent_pet.png"); + + private static final ResourceLocation QUESTION_MARK = new ResourceLocation("notenoughupdates:pv_unknown.png"); + + private static final ResourceLocation PET_DISPLAY = new ResourceLocation("notenoughupdates:petdisplay/petdisplaysolo.png"); + private static final ResourceLocation PET_DISPLAY_GREY = new ResourceLocation("notenoughupdates:petdisplay/petdisplaysolo_dark.png"); + private static final ResourceLocation PET_DISPLAY_DARK = new ResourceLocation("notenoughupdates:petdisplay/petdisplaysolo_phqdark.png"); + private static final ResourceLocation PET_DISPLAY_FSR = new ResourceLocation("notenoughupdates:petdisplay/petdisplaysolo_fsr.png"); + private static final ResourceLocation PET_DISPLAY_TRANSPARENT = new ResourceLocation("notenoughupdates:petdisplay/petdisplaysolo_transparent.png"); + + + private static final ResourceLocation PET_ARMOR_DISPLAY = new ResourceLocation("notenoughupdates:petdisplay/petdisplayarmor.png"); + private static final ResourceLocation PET_ARMOR_DISPLAY_GREY = new ResourceLocation("notenoughupdates:petdisplay/petdisplayarmor_dark.png"); + private static final ResourceLocation PET_ARMOR_DISPLAY_DARK = new ResourceLocation("notenoughupdates:petdisplay/petdisplayarmor_phqdark.png"); + private static final ResourceLocation PET_ARMOR_DISPLAY_FSR = new ResourceLocation("notenoughupdates:petdisplay/petdisplayarmor_fsr.png"); + private static final ResourceLocation PET_ARMOR_DISPLAY_TRANSPARENT = new ResourceLocation("notenoughupdates:petdisplay/petdisplayarmor_transparent.png"); + + private static boolean renderingArmorHud; + private static boolean renderingPetHud; + public static boolean shouldUseCachedPet; + public static long cachedPetTimer; + private final NEUManager manager; private final String mobRegex = ".*?((_MONSTER)|(_ANIMAL)|(_MINIBOSS)|(_BOSS)|(_SC))$"; @@ -1656,13 +1689,174 @@ public class NEUOverlay extends Gui { int guiScaleLast = 0; private boolean showVanillaLast = false; + private boolean wardrobeOpen = false; + private boolean isInNamedGui(String guiName) { + GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen; + if (guiScreen instanceof GuiChest) { + GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; + ContainerChest container = (ContainerChest) chest.inventorySlots; + IInventory lower = container.getLowerChestInventory(); + String containerName = lower.getDisplayName().getUnformattedText(); + if (containerName.contains(guiName)) { + wardrobeOpen = true; + } else wardrobeOpen = false; + } + if (guiScreen instanceof GuiInventory) { + wardrobeOpen = false; + } + return wardrobeOpen; + } + private int wardrobePage = -1; + private int getWardrobePage () { + GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen; + if (guiScreen instanceof GuiChest) { + if (isInNamedGui("Wardrobe")) { + GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; + ContainerChest container = (ContainerChest) chest.inventorySlots; + IInventory lower = container.getLowerChestInventory(); + String containerName = lower.getDisplayName().getUnformattedText(); + try { + wardrobePage = Integer.parseInt(containerName.substring(10, 11)); + } catch (NumberFormatException e) { + System.out.println(containerName.charAt(10)); + System.out.println("Did hypixel change the wardrobe string?"); + wardrobePage = -1; + } + } else wardrobePage = -1; + } + return wardrobePage; + } + private int petPage = -1; + private int getPetPage () { + GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen; + if (guiScreen instanceof GuiChest) { + if (isInNamedGui("Pets")) { + GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; + ContainerChest container = (ContainerChest) chest.inventorySlots; + IInventory lower = container.getLowerChestInventory(); + String containerName = lower.getDisplayName().getUnformattedText(); + try { + petPage = Integer.parseInt(containerName.substring(1, 2)); + } catch (NumberFormatException e) { + petPage = 1; + } + } else petPage = -1; + } + return petPage; + } + private ItemStack getChestSlotsAsItemStack(int slot) { + GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen; + if (guiScreen instanceof GuiChest) { + GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; + return chest.inventorySlots.getSlot(slot).getStack(); + } else { + return null; + } + } + private int selectedArmor = 9; + private int getEquippedArmor() { + if (isInNamedGui("Wardrobe")) { + ItemStack nullTest1 = getChestSlotsAsItemStack(8); + ItemStack nullTest2 = getChestSlotsAsItemStack(17); + ItemStack nullTest3 = getChestSlotsAsItemStack(26); + ItemStack nullTest4 = getChestSlotsAsItemStack(35); + ItemStack nullTest5 = getChestSlotsAsItemStack(44); + if (nullTest1 != null || nullTest2 != null || nullTest3 != null || nullTest4 != null || nullTest5 != null) { + selectedArmor = 9; + } + for (int ii = 1; ii < 5; ii++) { + if (ii == 1 || selectedArmor == 9) { + if (getWardrobePage() == ii) { + for (int i = 8; i < 54; i += 9) { + ItemStack stack1 = getChestSlotsAsItemStack(i); + if (stack1 != null) { + String[] lore1 = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack1.getTagCompound()); + for (String line : lore1) { + //System.out.println(line); + if (line.contains("to unequip this armor")) { + selectedArmor = i; + break; + } + } + } + } + } + } + } + } + return selectedArmor; + } + + private int selectedPet = 0; + private int getEquippedPet() { + if (isInNamedGui("Pets")) { + for (int ii = 1; ii < 3; ii++) { + if (ii == 1 || selectedPet == 0) { + if (getPetPage() == ii) { + for (int i = 0; i < 54; i ++) { + ItemStack stack1 = getChestSlotsAsItemStack(i); + if (stack1 != null) { + String[] lore1 = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack1.getTagCompound()); + for (String line : lore1) { + //System.out.println(line); + if (line.contains("\u00a77\u00a7cClick to despawn.")) { + selectedPet = i; + shouldUseCachedPet = true; + } + } + } else { + shouldUseCachedPet = false; + } + } + } + } + } + } + return selectedPet; + } + + private ItemStack getWardrobeSlot(int armourSlot) { + if (isInNamedGui("Wardrobe")) { + if (getChestSlotsAsItemStack(getEquippedArmor() - armourSlot) != null && getEquippedArmor() != 9) { + return getChestSlotsAsItemStack(getEquippedArmor() - armourSlot); + } else return null; + } else return null; + } + + public boolean isWardrobeSystemOnMainServer() { + JsonElement alphaWardrobeElement = Utils.getElement( Constants.DISABLE, "wardrobeFeature"); + if (alphaWardrobeElement == null || !alphaWardrobeElement.isJsonObject()) { + return true; + } + JsonObject isWardrobe = alphaWardrobeElement.getAsJsonObject(); + if (isWardrobe.has("enableNewWardrob")) { + return isWardrobe.get("enableNewWardrob").getAsBoolean(); + } else { + return true; + } + } + + public ItemStack slot1 = null; + public ItemStack slot2 = null; + public ItemStack slot3 = null; + public ItemStack slot4 = null; + public ItemStack petSlot = null; + public ItemStack petSlot2 = null; + public static boolean isRenderingArmorHud() { + return renderingArmorHud; + } + public static boolean isRenderingPetHud() { + return renderingPetHud; + } /** - * Renders the search bar, quick commands, item selection (right) and item info (left) gui elements. + * Renders the search bar, quick commands, item selection (right), item info (left) and armor hud gui elements. */ public void render(boolean hoverInv) { if (disabled) { return; } + renderingArmorHud = false; + renderingPetHud = false; GlStateManager.enableDepth(); FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; @@ -1686,6 +1880,177 @@ public class NEUOverlay extends Gui { Utils.drawTexturedRect((width - 64) / 2f, (height - 64) / 2f - 114, 64, 64, GL11.GL_LINEAR); GlStateManager.bindTexture(0); } + GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen; + + if (NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud && NotEnoughUpdates.INSTANCE.config.misc.hidePotionEffect + && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && isWardrobeSystemOnMainServer()) { + if (getWardrobeSlot(1) != null) { + slot1 = getWardrobeSlot(4); + slot2 = getWardrobeSlot(3); + slot3 = getWardrobeSlot(2); + slot4 = getWardrobeSlot(1); + } + if (guiScreen instanceof GuiInventory) { + renderingArmorHud = true; + selectedArmor = 9; + + List<String> tooltipToDisplay = null; + if (NotEnoughUpdates.INSTANCE.config.customArmour.colourStyle == 0) { + Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY); + } + if (NotEnoughUpdates.INSTANCE.config.customArmour.colourStyle == 1) { + Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY_GREY); + } + if (NotEnoughUpdates.INSTANCE.config.customArmour.colourStyle == 2) { + Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY_DARK); + } + if (NotEnoughUpdates.INSTANCE.config.customArmour.colourStyle == 3) { + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 3 && NotEnoughUpdates.INSTANCE.config.petOverlay.petInvDisplay) { + Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY_TRANSPARENT_PET); + } else { + Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY_TRANSPARENT); + } + } + if (NotEnoughUpdates.INSTANCE.config.customArmour.colourStyle == 4) { + Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY_FSR); + } + + GlStateManager.color(1, 1, 1, 1); + GL11.glTranslatef(0, 0, 80); + float yNumber = (float) (height - 167) / 2f; + Utils.drawTexturedRect((float) ((width - 224.1) / 2f), yNumber, 31, 86, GL11.GL_NEAREST); + GlStateManager.bindTexture(0); + + Utils.drawItemStack(slot1, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105)); + Utils.drawItemStack(slot2, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 18); + Utils.drawItemStack(slot3, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 36); + Utils.drawItemStack(slot4, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 54); + if (slot1 == null) { + Minecraft.getMinecraft().getTextureManager().bindTexture(QUESTION_MARK); + GlStateManager.color(1, 1, 1, 1); + GL11.glTranslatef(0, 0, 100); + Utils.drawTexturedRect(((width - 208) / 2f), ((height + 60) / 2f - 105), 16, 16, GL11.GL_NEAREST); + GlStateManager.bindTexture(0); + + tooltipToDisplay = Lists.newArrayList( + EnumChatFormatting.RED+"Warning", + EnumChatFormatting.GREEN+"You need to open /wardrobe", + EnumChatFormatting.GREEN+"To cache your armour" + ); + if (mouseX >= ((width - 208) / 2f) && mouseX < ((width - 208) / 2f) + 16) { + //top slot + if (mouseY >= ((height + 60) / 2f - 105) && mouseY <= ((height + 60) / 2f - 105) + 16) { + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); + } + } + + } + if (slot1 != null && slot2 != null && slot3 != null && slot4 != null) { + if (mouseX >= ((width - 208) / 2f) && mouseX < ((width - 208) / 2f) + 16) { + //top slot + if (mouseY >= ((height + 60) / 2f - 105) && mouseY <= ((height + 60) / 2f - 105) + 16) { + tooltipToDisplay = slot1.getTooltip(Minecraft.getMinecraft().thePlayer, false); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); + tooltipToDisplay = null; + GL11.glTranslatef(0, 0, -80); + } + if (mouseY >= ((height + 60) / 2f - 105) + 18 && mouseY <= ((height + 60) / 2f - 105) + 34) { + tooltipToDisplay = slot2.getTooltip(Minecraft.getMinecraft().thePlayer, false); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); + tooltipToDisplay = null; + GL11.glTranslatef(0, 0, -80); + } + if (mouseY >= ((height + 60) / 2f - 105) + 36 && mouseY <= ((height + 60) / 2f - 105) + 52) { + tooltipToDisplay = slot3.getTooltip(Minecraft.getMinecraft().thePlayer, false); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); + tooltipToDisplay = null; + GL11.glTranslatef(0, 0, -80); + } + if (mouseY >= ((height + 60) / 2f - 105) + 54 && mouseY <= ((height + 60) / 2f - 105) + 70) { + tooltipToDisplay = slot4.getTooltip(Minecraft.getMinecraft().thePlayer, false); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); + tooltipToDisplay = null; + GL11.glTranslatef(0, 0, -80); + } + } + GL11.glTranslatef(0, 0, -80); + } + } + } + if (PetInfoOverlay.getCurrentPet() != null) { + if (NotEnoughUpdates.INSTANCE.config.petOverlay.petInvDisplay + && NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(PetInfoOverlay.getCurrentPet().petType + ";" + PetInfoOverlay.getCurrentPet().rarity.petId)).hasDisplayName() + && NotEnoughUpdates.INSTANCE.config.misc.hidePotionEffect && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) { + petSlot = NotEnoughUpdates.INSTANCE.manager.jsonToStack( + NotEnoughUpdates.INSTANCE.manager.getItemInformation().get( + PetInfoOverlay.getCurrentPet().petType + ";" + PetInfoOverlay.getCurrentPet().rarity.petId)); + if (isInNamedGui("Pets")) { + petSlot2 = getChestSlotsAsItemStack(getEquippedPet()); + } + ItemStack petInfo = null; + + if (shouldUseCachedPet) { + petInfo = petSlot2; + } else { + petInfo = petSlot; + } + if (guiScreen instanceof GuiInventory) { + GL11.glTranslatef(0, 0, 80); + if (!NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud || !isWardrobeSystemOnMainServer()) { + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 0) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_DISPLAY); + } + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 1) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_DISPLAY_GREY); + } + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 2) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_DISPLAY_DARK); + } + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 3) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_DISPLAY_TRANSPARENT); + } + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 4) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_DISPLAY_FSR); + } + } else { + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 0) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_ARMOR_DISPLAY); + } + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 1) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_ARMOR_DISPLAY_GREY); + } + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 2) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_ARMOR_DISPLAY_DARK); + } + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 3) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_ARMOR_DISPLAY_TRANSPARENT); + } + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 4) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_ARMOR_DISPLAY_FSR); + } + } + + GlStateManager.color(1, 1, 1, 1); + float yNumber = (float) (height - 23) / 2f; + Utils.drawTexturedRect((float) ((width - 224.1) / 2f), yNumber, 31, 32, GL11.GL_NEAREST); + GlStateManager.bindTexture(0); + + Utils.drawItemStack(petInfo, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 72); + renderingPetHud = true; + List<String> tooltipToDisplay = null; + if (petInfo != null) { + if (mouseX >= ((width - 208) / 2f) && mouseX < ((width - 208) / 2f) + 16) { + if (mouseY >= ((height + 60) / 2f - 105) + 72 && mouseY <= ((height + 60) / 2f - 105) + 88) { + tooltipToDisplay = petInfo.getTooltip(Minecraft.getMinecraft().thePlayer, false); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); + tooltipToDisplay = null; + GL11.glTranslatef(0, 0, -80); + } + } + } + } + } + } SunTzu.setEnabled(textField.getText().toLowerCase().startsWith("potato")); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/StatsCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/StatsCommand.java index 99bfe368..525e8aea 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/commands/StatsCommand.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/StatsCommand.java @@ -122,6 +122,7 @@ public class StatsCommand extends ClientCommandBase { builder.append("On Skyblock", NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() ? "TRUE" : "FALSE"); builder.append("Mod Version", Loader.instance().getIndexedModList().get(NotEnoughUpdates.MODID).getSource().getName()); builder.append("SB Profile", SBInfo.getInstance().currentProfile); + builder.append("Has Advanced Tab", SBInfo.getInstance().hasNewTab ? "TRUE" : "FALSE"); builder.category("Repo Stats"); builder.append("Last Commit", NotEnoughUpdates.INSTANCE.manager.latestRepoCommit); builder.append("Loaded Items", String.valueOf(NotEnoughUpdates.INSTANCE.manager.getItemInformation().size())); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementBoolean.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementBoolean.java index be13e410..0936fb93 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementBoolean.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementBoolean.java @@ -7,6 +7,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; import java.util.function.Consumer; @@ -43,10 +44,8 @@ public class GuiElementBoolean extends GuiElement { @Override public void render() { GlStateManager.color(1, 1, 1, 1); - Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.BAR); - RenderUtils.drawTexturedRect(x, y, xSize, ySize); - ResourceLocation buttonLoc = GuiTextures.ON; + ResourceLocation barLoc = GuiTextures.BAR_ON; long currentMillis = System.currentTimeMillis(); long deltaMillis = currentMillis - lastMillis; lastMillis = currentMillis; @@ -83,16 +82,25 @@ public class GuiElementBoolean extends GuiElement { int animation = (int) (LerpUtils.sigmoidZeroOne(this.animation / 36f) * 36); if (animation < 3) { buttonLoc = GuiTextures.OFF; + barLoc = GuiTextures.BAR; } else if (animation < 13) { buttonLoc = GuiTextures.ONE; + barLoc = GuiTextures.BAR_ONE; } else if (animation < 23) { buttonLoc = GuiTextures.TWO; + barLoc = GuiTextures.BAR_TWO; } else if (animation < 33) { buttonLoc = GuiTextures.THREE; + barLoc = GuiTextures.BAR_THREE; } + GL11.glTranslatef(0, 0, 100); Minecraft.getMinecraft().getTextureManager().bindTexture(buttonLoc); RenderUtils.drawTexturedRect(x + animation, y, 12, 14); + GL11.glTranslatef(0, 0, -100); + + Minecraft.getMinecraft().getTextureManager().bindTexture(barLoc); + RenderUtils.drawTexturedRect(x, y, xSize, ySize); } @Override diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java index 9663868b..8fe64b55 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -3,6 +3,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures; import com.google.common.collect.Lists; import com.google.gson.*; import io.github.moulberry.notenoughupdates.NEUEventListener; +import io.github.moulberry.notenoughupdates.NEUOverlay; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils; @@ -1114,7 +1115,11 @@ public class PetInfoOverlay extends TextOverlay { String chatMessage = Utils.cleanColour(event.message.getUnformattedText()); Matcher autopetMatcher = AUTOPET_EQUIP.matcher(event.message.getFormattedText()); - if (autopetMatcher.matches()) { + if (event.message.getUnformattedText().startsWith("You summoned your") || System.currentTimeMillis() - NEUOverlay.cachedPetTimer < 500) { + NEUOverlay.cachedPetTimer = System.currentTimeMillis(); + NEUOverlay.shouldUseCachedPet = false; + } else if (autopetMatcher.matches()) { + NEUOverlay.shouldUseCachedPet = false; try { lastLevelHovered = Integer.parseInt(autopetMatcher.group(1)); } catch (NumberFormatException ignored) {} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java index 4bd65acd..a239e741 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -12,6 +12,7 @@ import io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour; import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor; import io.github.moulberry.notenoughupdates.miscgui.NEUOverlayPlacements; import io.github.moulberry.notenoughupdates.options.seperateSections.*; +import io.github.moulberry.notenoughupdates.overlays.CustomArmour; import io.github.moulberry.notenoughupdates.overlays.MiningOverlay; import io.github.moulberry.notenoughupdates.overlays.OverlayManager; import io.github.moulberry.notenoughupdates.overlays.TextOverlay; @@ -245,6 +246,13 @@ public class NEUConfig extends Config { @Expose @Category( + name = "Custom Armour Hud", + desc = "Custom Armour Hud" + ) + public CustomArmour customArmour = new CustomArmour(); + + @Expose + @Category( name = "Calendar", desc = "Calendar" ) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java index f37280fa..7e49222c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java @@ -71,4 +71,22 @@ public class PetOverlay { )
@ConfigEditorBoolean
public boolean dualPets = false;
+
+ @Expose
+ @ConfigOption(
+ name = "GUI Colour",
+ desc = "Change the colour of the GUI"
+ )
+ @ConfigEditorDropdown(
+ values = {"Vanilla", "Grey", "Dark", "Transparent", "FSR"}
+ )
+ public int colourStyle = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Pet Inventory Display",
+ desc = "Shows an overlay in your inventory showing your current pet"
+ )
+ @ConfigEditorBoolean
+ public boolean petInvDisplay = true;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CustomArmour.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CustomArmour.java new file mode 100644 index 00000000..35e325bb --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CustomArmour.java @@ -0,0 +1,28 @@ +package io.github.moulberry.notenoughupdates.overlays; + +import com.google.gson.annotations.Expose; +import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean; +import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDropdown; +import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption; + +public class CustomArmour { + + @Expose + @ConfigOption( + name = "Enables Custom Amour Hud", + desc = "Shows an overlay in your inventory showing your 4 extra armour slots" + ) + @ConfigEditorBoolean + public boolean enableArmourHud = true; + + @Expose + @ConfigOption( + name = "GUI Colour", + desc = "Change the colour of the GUI" + ) + @ConfigEditorDropdown( + values = {"Vanilla", "Grey", "Dark", "Transparent", "FSR"} + ) + public int colourStyle = 0; + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java index bdffb42f..592caa92 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java @@ -359,9 +359,9 @@ public class ProfileViewer { if (networth == 0) return -1; //System.out.println(profileId); - for (Map.Entry<String, Long> entry : mostExpensiveInternal.entrySet()) { + //for (Map.Entry<String, Long> entry : mostExpensiveInternal.entrySet()) { //System.out.println(entry.getKey() + ":" + entry.getValue()); - } + //} networth = (int) (networth * 1.3f); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/GuiTextures.java b/src/main/java/io/github/moulberry/notenoughupdates/util/GuiTextures.java index d7d5dcc6..fad58b17 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/GuiTextures.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/GuiTextures.java @@ -85,6 +85,10 @@ public class GuiTextures { public static final ResourceLocation descending_overlay = new ResourceLocation("notenoughupdates:descending_overlay.png"); public static final ResourceLocation BAR = new ResourceLocation("notenoughupdates:core/bar.png"); + public static final ResourceLocation BAR_ONE = new ResourceLocation("notenoughupdates:core/bar_1.png"); + public static final ResourceLocation BAR_TWO = new ResourceLocation("notenoughupdates:core/bar_2.png"); + public static final ResourceLocation BAR_THREE = new ResourceLocation("notenoughupdates:core/bar_3.png"); + public static final ResourceLocation BAR_ON = new ResourceLocation("notenoughupdates:core/bar_on.png"); public static final ResourceLocation OFF = new ResourceLocation("notenoughupdates:core/toggle_off.png"); public static final ResourceLocation ONE = new ResourceLocation("notenoughupdates:core/toggle_1.png"); public static final ResourceLocation TWO = new ResourceLocation("notenoughupdates:core/toggle_2.png"); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java index 352d2d1a..008738fd 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java @@ -56,6 +56,7 @@ public class SBInfo { public long unloadedWorld = -1; private JsonObject locraw = null; public boolean isInDungeon = false; + public boolean hasNewTab = false; public String currentProfile = null; @@ -79,6 +80,7 @@ public class SBInfo { mode = null; joinedWorld = System.currentTimeMillis(); lastOpenContainerName = ""; + hasNewTab = false; } @SubscribeEvent @@ -144,6 +146,7 @@ public class SBInfo { String name = Minecraft.getMinecraft().ingameGUI.getTabList().getPlayerName(info); if (name.startsWith(profilePrefix)) { currentProfile = Utils.cleanColour(name.substring(profilePrefix.length())); + hasNewTab = true; } else if (name.startsWith(skillsPrefix)) { String levelInfo = name.substring(skillsPrefix.length()).trim(); Matcher matcher = SKILL_LEVEL_PATTERN.matcher(Utils.cleanColour(levelInfo).split(":")[0]); |