diff options
author | Moulberry <jjenour@student.unimelb.edu.au> | 2021-09-02 14:09:31 +0930 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-02 14:09:31 +0930 |
commit | 81eea6bf1f653fa194735d892b40614389975dd3 (patch) | |
tree | a955e0d03401302332c743f6c396184e45c94c80 /src | |
parent | 05428d1ccb15f58ccbdb4b14eb9e10b61b0477cc (diff) | |
parent | 05d6207281e18980b8a28046621c741fa81c1606 (diff) | |
download | NotEnoughUpdates-81eea6bf1f653fa194735d892b40614389975dd3.tar.gz NotEnoughUpdates-81eea6bf1f653fa194735d892b40614389975dd3.tar.bz2 NotEnoughUpdates-81eea6bf1f653fa194735d892b40614389975dd3.zip |
Merge pull request #226 from DoKM/master
Pre31 update
Diffstat (limited to 'src')
84 files changed, 4813 insertions, 1437 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java index ff618f10..83c4b7ae 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java @@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates; import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.auction.APIManager; +import io.github.moulberry.notenoughupdates.core.config.KeybindHelper; import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.item.ItemStack; @@ -20,6 +21,12 @@ public class ItemPriceInformation { } public static boolean addToTooltip(List<String> tooltip, String internalname, ItemStack stack, boolean useStackSize) { + if(stack.getTagCompound().hasKey("disableNeuTooltip") && stack.getTagCompound().getBoolean("disableNeuTooltip")){ + return false; + } + if(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.disablePriceKey && !KeybindHelper.isKeyDown(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.disablePriceKeyKeybind)){ + return false; + } JsonObject auctionInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname); JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalname); float lowestBinAvg = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAvgBin(internalname); @@ -98,6 +105,7 @@ public class ItemPriceInformation { break; case 4: if(craftCost.fromRecipe) { + if((int)craftCost.craftCost == 0){ continue;} if(!added) { tooltip.add(""); added = true; @@ -165,6 +173,7 @@ public class ItemPriceInformation { break; case 3: if(craftCost.fromRecipe) { + if((int)craftCost.craftCost == 0){ continue;} if(!added) { tooltip.add(""); added = true; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUApi.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUApi.java new file mode 100644 index 00000000..56a196b4 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUApi.java @@ -0,0 +1,10 @@ +package io.github.moulberry.notenoughupdates; + +import net.minecraftforge.fml.relauncher.ReflectionHelper; + +public class NEUApi { + static boolean disableInventoryButtons = false; + public static void setInventoryButtonsToDisabled(){ + disableInventoryButtons = true; + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index b849c890..48cd0e57 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -1,10 +1,7 @@ package io.github.moulberry.notenoughupdates; import com.google.common.collect.Lists; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; +import com.google.gson.*; import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.MinecraftProfileTexture; import io.github.moulberry.notenoughupdates.auction.CustomAHGui; @@ -15,14 +12,10 @@ import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.cosmetics.CapeManager; import io.github.moulberry.notenoughupdates.dungeons.DungeonBlocks; import io.github.moulberry.notenoughupdates.dungeons.DungeonWin; -import io.github.moulberry.notenoughupdates.gamemodes.SBGamemodes; import io.github.moulberry.notenoughupdates.miscfeatures.*; import io.github.moulberry.notenoughupdates.miscgui.*; import io.github.moulberry.notenoughupdates.options.NEUConfig; -import io.github.moulberry.notenoughupdates.overlays.AuctionSearchOverlay; -import io.github.moulberry.notenoughupdates.overlays.OverlayManager; -import io.github.moulberry.notenoughupdates.overlays.RancherBootOverlay; -import io.github.moulberry.notenoughupdates.overlays.TextOverlay; +import io.github.moulberry.notenoughupdates.overlays.*; import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; import io.github.moulberry.notenoughupdates.util.*; import net.minecraft.client.Minecraft; @@ -41,6 +34,7 @@ import net.minecraft.init.Blocks; 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; import net.minecraft.nbt.NBTTagCompound; @@ -51,6 +45,7 @@ import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.client.event.*; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -64,6 +59,7 @@ import java.awt.*; import java.awt.datatransfer.StringSelection; import java.io.File; import java.io.IOException; +import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.List; import java.util.*; @@ -170,10 +166,12 @@ public class NEUEventListener { @SubscribeEvent public void onWorldLoad(WorldEvent.Unload event) { NotEnoughUpdates.INSTANCE.saveConfig(); + CrystalMetalDetectorSolver.reset(); } private static long notificationDisplayMillis = 0; private static List<String> notificationLines = null; + private static boolean showNotificationOverInv = false; private static final Pattern BAD_ITEM_REGEX = Pattern.compile("x[0-9]{1,2}$"); @@ -192,18 +190,23 @@ public class NEUEventListener { private int inventoryLoadedTicks = 0; private String loadedInvName = ""; public static boolean inventoryLoaded = false; - public static void displayNotification(List<String> lines, boolean showForever) { + displayNotification(lines, showForever, false); + } + + public static void displayNotification(List<String> lines, boolean showForever, boolean overInventory) { if(showForever) { notificationDisplayMillis = -420; } else { notificationDisplayMillis = System.currentTimeMillis(); } notificationLines = lines; + showNotificationOverInv = overInventory; } @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { + Keyboard.enableRepeatEvents(false); if(event.phase != TickEvent.Phase.START) return; if(Minecraft.getMinecraft().theWorld == null) return; if(Minecraft.getMinecraft().thePlayer == null) return; @@ -340,7 +343,7 @@ public class NEUEventListener { if(!joinedSB) { joinedSB = true; - SBGamemodes.loadFromFile(); + //SBGamemodes.loadFromFile(); if(NotEnoughUpdates.INSTANCE.config.notifications.showUpdateMsg) { @@ -363,14 +366,26 @@ public class NEUEventListener { if(!NotEnoughUpdates.INSTANCE.config.hidden.loadedModBefore) { NotEnoughUpdates.INSTANCE.config.hidden.loadedModBefore = true; - + if(Constants.MISC == null || !Constants.MISC.has("featureslist")){ + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD+"WARNING: "+EnumChatFormatting.RESET+EnumChatFormatting.RED+"Could not load Feature List URL from repo.")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.RED+ "Please run "+EnumChatFormatting.BOLD+"/neuresetrepo"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" and "+EnumChatFormatting.BOLD+"restart your game"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" in order to fix. "+EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD+"If that doesn't fix it"+EnumChatFormatting.RESET+EnumChatFormatting.RED+", please join discord.gg/moulberry and post in #neu-support")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.GOLD+"To view the feature list after restarting type /neufeatures")); + } else { + String url = Constants.MISC.get("featureslist").getAsString(); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + EnumChatFormatting.BLUE + "It seems this is your first time using NotEnoughUpdates.")); + ChatComponentText clickTextFeatures = new ChatComponentText( + EnumChatFormatting.YELLOW + "Click this message if you would like to view a list of NotEnoughUpdate's Features."); + clickTextFeatures.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, url)); + Minecraft.getMinecraft().thePlayer.addChatMessage(clickTextFeatures); + } Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - EnumChatFormatting.BLUE+"It seems this is your first time using NotEnoughUpdates.")); - ChatComponentText clickText = new ChatComponentText( - EnumChatFormatting.YELLOW+"Click this message if you would like to view a short tutorial."); - clickText.setChatStyle(Utils.createClickStyle(ClickEvent.Action.RUN_COMMAND, "/neututorial")); - Minecraft.getMinecraft().thePlayer.addChatMessage(clickText); + ChatComponentText clickTextHelp = new ChatComponentText( + EnumChatFormatting.YELLOW+"Click this message if you would like to view a list of NotEnoughUpdate's commands."); + clickTextHelp.setChatStyle(Utils.createClickStyle(ClickEvent.Action.RUN_COMMAND, "/neuhelp")); + Minecraft.getMinecraft().thePlayer.addChatMessage(clickTextHelp); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); } } @@ -501,13 +516,20 @@ public class NEUEventListener { if(Keyboard.isKeyDown(Keyboard.KEY_X)) { notificationDisplayMillis = 0; } + + if(event.type == RenderGameOverlayEvent.ElementType.ALL){ + renderNotification(); + } + + } + private static void renderNotification(){ + long timeRemaining = 15000 - (System.currentTimeMillis() - notificationDisplayMillis); boolean display = timeRemaining > 0 || notificationDisplayMillis == -420; - if(event.type == RenderGameOverlayEvent.ElementType.ALL && - display && notificationLines != null && notificationLines.size() > 0) { + if(display && notificationLines != null && notificationLines.size() > 0) { int width = 0; int height = notificationLines.size()*10+10; - + for(String line : notificationLines) { int len = Minecraft.getMinecraft().fontRendererObj.getStringWidth(line) + 8; if(len > width) { @@ -556,6 +578,9 @@ public class NEUEventListener { AtomicBoolean missingRecipe = new AtomicBoolean(false); @SubscribeEvent public void onGuiOpen(GuiOpenEvent event) { + CraftingOverlay.shouldRender = false; + NEUApi.disableInventoryButtons = false; + if((Minecraft.getMinecraft().currentScreen instanceof GuiScreenElementWrapper || Minecraft.getMinecraft().currentScreen instanceof GuiItemRecipe) && event.gui == null && !(Keyboard.getEventKeyState() && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) && @@ -756,7 +781,7 @@ public class NEUEventListener { private String processText(String text) { if(SBInfo.getInstance().getLocation() == null) return text; - if(!SBInfo.getInstance().getLocation().startsWith("mining_")) return text; + if(!SBInfo.getInstance().getLocation().startsWith("mining_")&&!SBInfo.getInstance().getLocation().equals("crystal_hollows")) return text; if(Minecraft.getMinecraft().thePlayer == null) return text; if(!NotEnoughUpdates.INSTANCE.config.mining.drillFuelBar) return text; @@ -764,6 +789,20 @@ public class NEUEventListener { return Utils.trimIgnoreColour(text.replaceAll(EnumChatFormatting.DARK_GREEN+"\\S+ Drill Fuel", "")); } + + private IChatComponent replaceSocialControlsWithPV(IChatComponent chatComponent){ + + if(NotEnoughUpdates.INSTANCE.config.misc.replaceSocialOptions && chatComponent.getChatStyle() != null && chatComponent.getChatStyle().getChatClickEvent() != null && chatComponent.getChatStyle().getChatClickEvent().getAction() == ClickEvent.Action.RUN_COMMAND){ + if(chatComponent.getChatStyle().getChatClickEvent().getValue().startsWith("/socialoptions")){ + String username = chatComponent.getChatStyle().getChatClickEvent().getValue().substring(15); + + chatComponent.setChatStyle(Utils.createClickStyle(ClickEvent.Action.RUN_COMMAND, "/pv "+username, ""+EnumChatFormatting.YELLOW+"Click to open "+EnumChatFormatting.AQUA+EnumChatFormatting.BOLD+username+EnumChatFormatting.RESET+EnumChatFormatting.YELLOW+"'s profile in "+EnumChatFormatting.DARK_PURPLE+EnumChatFormatting.BOLD+"NEU's"+EnumChatFormatting.RESET+EnumChatFormatting.YELLOW+ " profile viewer.")); + return chatComponent; + } + } + return chatComponent; + } + /** * 1) When receiving "You are playing on profile" messages, will set the current profile. * 2) When a /viewrecipe command fails (i.e. player does not have recipe unlocked, will open the custom recipe GUI) @@ -772,8 +811,11 @@ public class NEUEventListener { @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) public void onGuiChat(ClientChatReceivedEvent e) { if(e.type == 2) { + CrystalMetalDetectorSolver.process(e.message); e.message = processChatComponent(e.message); return; + } else if(e.type == 0){ + e.message = replaceSocialControlsWithPV(e.message); } DungeonWin.onChatMessage(e); @@ -819,6 +861,12 @@ public class NEUEventListener { e.message = new ChatComponentText(m2); } } + if (unformatted.startsWith("You found ") && SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows")){ + CrystalMetalDetectorSolver.reset(); + } + if(unformatted.startsWith("[NPC] Keeper of ") | unformatted.startsWith("[NPC] Professor Robot: ") || unformatted.startsWith(" ") || unformatted.startsWith("✦") || + unformatted.equals(" You've earned a Crystal Loot Bundle!")) + OverlayManager.crystalHollowOverlay.message(unformatted); } public static boolean drawingGuiScreen = false; @@ -836,6 +884,11 @@ public class NEUEventListener { */ @SubscribeEvent public void onGuiBackgroundDraw(GuiScreenEvent.BackgroundDrawnEvent event) { + if(showNotificationOverInv){ + + renderNotification(); + + } if((shouldRenderOverlay(event.gui) || event.gui instanceof CustomAHGui) && neu.isOnSkyblock()) { ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft()); int width = scaledresolution.getScaledWidth(); @@ -913,6 +966,21 @@ public class NEUEventListener { GuiChest eventGui = (GuiChest) guiScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); + if(containerName.contains(" Profile") && cc.inventorySlots.size() >= 54){ + if(cc.inventorySlots.get(22).getStack() != null && cc.inventorySlots.get(22).getStack().getTagCompound() != null){ + NBTTagCompound tag = eventGui.inventorySlots.inventorySlots.get(22).getStack().getTagCompound(); + if(tag.hasKey("SkullOwner") && tag.getCompoundTag("SkullOwner").hasKey("Name")){ + String tagName = tag.getCompoundTag("SkullOwner").getString("Name"); + String displayname = Utils.cleanColour(cc.inventorySlots.get(22).getStack().getDisplayName()); + if(tagName.equals(displayname.substring(displayname.length()-tagName.length()))){ + Slot slot = new Slot(cc.getLowerChestInventory(), 42, cc.inventorySlots.get(42).xDisplayPosition, cc.inventorySlots.get(42).yDisplayPosition); + slot.putStack(Utils.createItemStack(Item.getItemFromBlock(Blocks.command_block), EnumChatFormatting.GREEN + "Profile Viewer", + EnumChatFormatting.YELLOW + "Click to open NEU profile viewer!")); + cc.inventorySlots.set(42, slot); + } + } + } + } } if(GuiCustomEnchant.getInstance().shouldOverride(containerName)) { @@ -967,35 +1035,42 @@ public class NEUEventListener { GlStateManager.translate(0, 0, zOffset); - int xSize = ((GuiContainer)event.gui).xSize; - int ySize = ((GuiContainer)event.gui).ySize; - int guiLeft = ((GuiContainer)event.gui).guiLeft; - int guiTop = ((GuiContainer)event.gui).guiTop; + int xSize = ((GuiContainer) event.gui).xSize; + int ySize = ((GuiContainer) event.gui).ySize; + int guiLeft = ((GuiContainer) event.gui).guiLeft; + int guiTop = ((GuiContainer) event.gui).guiTop; - for(NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) { - if(!button.isActive()) continue; - if(button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue; + if (!NEUApi.disableInventoryButtons) { + for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) { + if (!button.isActive()) continue; + if (button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue; - int x = guiLeft+button.x; - int y = guiTop+button.y; - if(button.anchorRight) { - x += xSize; - } - if(button.anchorBottom) { - y += ySize; - } + int x = guiLeft + button.x; + int y = guiTop + button.y; + if (button.anchorRight) { + x += xSize; + } + if (button.anchorBottom) { + y += ySize; + } + if (AccessoryBagOverlay.isInAccessoryBag()) { + if (x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28 + 5 && y > guiTop - 18 && y < guiTop + 150) { + x += 80 + 28; + } + } - GlStateManager.color(1, 1, 1, 1f); + GlStateManager.color(1, 1, 1, 1f); - GlStateManager.enableDepth(); - GlStateManager.enableAlpha(); - Minecraft.getMinecraft().getTextureManager().bindTexture(EDITOR); - Utils.drawTexturedRect(x, y, 18, 18, - button.backgroundIndex*18/256f, (button.backgroundIndex*18+18)/256f, - 18/256f, 36/256f, GL11.GL_NEAREST); - - if(button.icon != null && !button.icon.trim().isEmpty()) { - GuiInvButtonEditor.renderIcon(button.icon, x+1, y+1); + GlStateManager.enableDepth(); + GlStateManager.enableAlpha(); + Minecraft.getMinecraft().getTextureManager().bindTexture(EDITOR); + Utils.drawTexturedRect(x, y, 18, 18, + button.backgroundIndex * 18 / 256f, (button.backgroundIndex * 18 + 18) / 256f, + 18 / 256f, 36 / 256f, GL11.GL_NEAREST); + + if (button.icon != null && !button.icon.trim().isEmpty()) { + GuiInvButtonEditor.renderIcon(button.icon, x + 1, y + 1); + } } } GlStateManager.translate(0, 0, -zOffset); @@ -1036,6 +1111,9 @@ public class NEUEventListener { GuiChest eventGui = (GuiChest) guiScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); + if (containerName.equals("Craft Item")) { + CraftingOverlay.render(); + } } if(GuiCustomEnchant.getInstance().shouldOverride(containerName)) { @@ -1069,46 +1147,53 @@ public class NEUEventListener { if(!doInventoryButtons) return; if(NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && shouldRenderOverlay(event.gui) && event.gui instanceof GuiContainer) { - int xSize = ((GuiContainer)event.gui).xSize; - int ySize = ((GuiContainer)event.gui).ySize; - int guiLeft = ((GuiContainer)event.gui).guiLeft; - int guiTop = ((GuiContainer)event.gui).guiTop; - - for(NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) { - if(!button.isActive()) continue; - if(button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue; + int xSize = ((GuiContainer) event.gui).xSize; + int ySize = ((GuiContainer) event.gui).ySize; + int guiLeft = ((GuiContainer) event.gui).guiLeft; + int guiTop = ((GuiContainer) event.gui).guiTop; + + if (!NEUApi.disableInventoryButtons) { + for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) { + if (!button.isActive()) continue; + if (button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue; + + int x = guiLeft + button.x; + int y = guiTop + button.y; + if (button.anchorRight) { + x += xSize; + } + if (button.anchorBottom) { + y += ySize; + } + if (AccessoryBagOverlay.isInAccessoryBag()) { + if (x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28 + 5 && y > guiTop - 18 && y < guiTop + 150) { + x += 80 + 28; + } + } - int x = guiLeft+button.x; - int y = guiTop+button.y; - if(button.anchorRight) { - x += xSize; - } - if(button.anchorBottom) { - y += ySize; - } + if (x - guiLeft >= 85 && x - guiLeft <= 115 && y - guiTop >= 4 && y - guiTop <= 25) { + disableCraftingText = true; + } - if(x-guiLeft >= 85 && x-guiLeft <= 115 && y-guiTop >= 4 && y-guiTop <= 25) { - disableCraftingText = true; - } + if (event.mouseX >= x && event.mouseX <= x + 18 && + event.mouseY >= y && event.mouseY <= y + 18) { + hoveringButton = true; + long currentTime = System.currentTimeMillis(); - if(event.mouseX >= x && event.mouseX <= x+18 && - event.mouseY >= y && event.mouseY <= y+18) { - hoveringButton = true; - long currentTime = System.currentTimeMillis(); + if (buttonHovered != button) { + buttonHoveredMillis = currentTime; + buttonHovered = button; + } - if(buttonHovered != button) { - buttonHoveredMillis = currentTime; - buttonHovered = button; - } + if (currentTime - buttonHoveredMillis > 600) { + String command = button.command.trim(); + if (!command.startsWith("/")) { + command = "/" + command; + } - if(currentTime - buttonHoveredMillis > 600) { - String command = button.command.trim(); - if(!command.startsWith("/")) { - command = "/" + command; + Utils.drawHoveringText(Lists.newArrayList("\u00a77" + command), event.mouseX, event.mouseY, + event.gui.width, event.gui.height, -1, Minecraft.getMinecraft().fontRendererObj); } - - Utils.drawHoveringText(Lists.newArrayList("\u00a77"+command), event.mouseX, event.mouseY, - event.gui.width, event.gui.height, -1, Minecraft.getMinecraft().fontRendererObj); } } } @@ -1349,6 +1434,19 @@ public class NEUEventListener { GuiChest eventGui = (GuiChest) guiScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); + if(containerName.contains(" Profile") && eventGui.getSlotUnderMouse() != null && + eventGui.getSlotUnderMouse().getSlotIndex() == 42 && Mouse.getEventButton() >= 0) { + event.setCanceled(true); + if(Mouse.getEventButtonState() && eventGui.inventorySlots.inventorySlots.get(22).getStack() != null && + eventGui.inventorySlots.inventorySlots.get(22).getStack().getTagCompound() != null){ + NBTTagCompound tag = eventGui.inventorySlots.inventorySlots.get(22).getStack().getTagCompound(); + if(tag.hasKey("SkullOwner") && tag.getCompoundTag("SkullOwner").hasKey("Name")){ + String username = tag.getCompoundTag("SkullOwner").getString("Name"); + Utils.playPressSound(); + NotEnoughUpdates.INSTANCE.viewProfileRunnable.processCommand(null, new String[]{username}); + } + } + } } if(GuiCustomEnchant.getInstance().shouldOverride(containerName) && @@ -1398,36 +1496,42 @@ public class NEUEventListener { int ySize = ((GuiContainer)event.gui).ySize; int guiLeft = ((GuiContainer)event.gui).guiLeft; int guiTop = ((GuiContainer)event.gui).guiTop; + if(!NEUApi.disableInventoryButtons) { + for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) { + if (!button.isActive()) continue; + if (button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue; + + int x = guiLeft + button.x; + int y = guiTop + button.y; + if (button.anchorRight) { + x += xSize; + } + if (button.anchorBottom) { + y += ySize; + } + if (AccessoryBagOverlay.isInAccessoryBag()) { + if (x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28 + 5 && y > guiTop - 18 && y < guiTop + 150) { + x += 80 + 28; + } + } - for(NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) { - if(!button.isActive()) continue; - if(button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue; - - int x = guiLeft+button.x; - int y = guiTop+button.y; - if(button.anchorRight) { - x += xSize; - } - if(button.anchorBottom) { - y += ySize; - } - - if(mouseX >= x && mouseX <= x+18 && mouseY >= y && mouseY <= y+18) { - if(Minecraft.getMinecraft().thePlayer.inventory.getItemStack() == null) { - int clickType = NotEnoughUpdates.INSTANCE.config.inventoryButtons.clickType; - if((clickType == 0 && Mouse.getEventButtonState()) || (clickType == 1 && !Mouse.getEventButtonState())) { - String command = button.command.trim(); - if(!command.startsWith("/")) { - command = "/" + command; - } - if(ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, command) == 0) { - NotEnoughUpdates.INSTANCE.sendChatMessage(command); + if (mouseX >= x && mouseX <= x + 18 && mouseY >= y && mouseY <= y + 18) { + if (Minecraft.getMinecraft().thePlayer.inventory.getItemStack() == null) { + int clickType = NotEnoughUpdates.INSTANCE.config.inventoryButtons.clickType; + if ((clickType == 0 && Mouse.getEventButtonState()) || (clickType == 1 && !Mouse.getEventButtonState())) { + String command = button.command.trim(); + if (!command.startsWith("/")) { + command = "/" + command; + } + if (ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, command) == 0) { + NotEnoughUpdates.INSTANCE.sendChatMessage(command); + } } + } else { + event.setCanceled(true); } - } else { - event.setCanceled(true); + return; } - return; } } } @@ -1460,6 +1564,9 @@ public class NEUEventListener { GuiChest eventGui = (GuiChest) guiScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); + if(CraftingOverlay.shouldRender && containerName.equals("Craft Item")){ + CraftingOverlay.keyInput(); + } } if(GuiCustomEnchant.getInstance().shouldOverride(containerName) && @@ -1639,6 +1746,10 @@ public class NEUEventListener { rarityArrMap.put("EPIC", rarityArrC[3]); rarityArrMap.put("LEGENDARY", rarityArrC[4]); rarityArrMap.put("MYTHIC", rarityArrC[5]); + rarityArrMap.put("SPECIAL", rarityArrC[6]); + rarityArrMap.put("VERY SPECIAL", rarityArrC[7]); + rarityArrMap.put("SUPREME", rarityArrC[8]); + } private HashSet<String> percentStats = new HashSet<>(); @@ -1657,12 +1768,26 @@ public class NEUEventListener { private boolean copied = false; + //just to try and optimize it a bit + private int sbaloaded = -1; + private boolean isSbaloaded(){ + if(sbaloaded == -1){ + if(Loader.isModLoaded("skyblockaddons")) { + sbaloaded = 1; + } else { + sbaloaded = 0; + } + } + return sbaloaded == 1; + } + @SubscribeEvent(priority = EventPriority.LOW) public void onItemTooltipLow(ItemTooltipEvent event) { if(!NotEnoughUpdates.INSTANCE.isOnSkyblock()) return; String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(event.itemStack); if(internalname == null) { + onItemToolTipInternalNameNull(event); return; } @@ -1720,10 +1845,13 @@ public class NEUEventListener { boolean dungeonProfit = false; int index = 0; List<String> newTooltip = new ArrayList<>(); + + for(String line : event.toolTip) { - if(line.endsWith(EnumChatFormatting.DARK_GRAY+"Reforge Stone")) { + if(line.endsWith(EnumChatFormatting.DARK_GRAY+"Reforge Stone") && NotEnoughUpdates.INSTANCE.config.tooltipTweaks.showReforgeStats) { JsonObject reforgeStones = Constants.REFORGESTONES; + if(reforgeStones != null && reforgeStones.has(internalname)) { boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); if(!pressedShiftLast && shift) { @@ -1777,85 +1905,89 @@ public class NEUEventListener { pressedArrowLast = left || right; JsonElement statsE = reforgeInfo.get("reforgeStats"); - if(statsE != null && statsE.isJsonObject()) { - JsonObject stats = statsE.getAsJsonObject(); - String rarityFormatted = rarityArrMap.getOrDefault(rarity, rarity); - JsonElement reforgeAbilityE = reforgeInfo.get("reforgeAbility"); - String reforgeAbility = null; - if(reforgeAbilityE != null) { - if(reforgeAbilityE.isJsonPrimitive() && reforgeAbilityE.getAsJsonPrimitive().isString()) { - reforgeAbility = Utils.getElementAsString(reforgeInfo.get("reforgeAbility"), ""); + String rarityFormatted = rarityArrMap.getOrDefault(rarity, rarity); - } else if(reforgeAbilityE.isJsonObject()) { - if(reforgeAbilityE.getAsJsonObject().has(rarity)) { - reforgeAbility = reforgeAbilityE.getAsJsonObject().get(rarity).getAsString(); - } + JsonElement reforgeAbilityE = reforgeInfo.get("reforgeAbility"); + String reforgeAbility = null; + if (reforgeAbilityE != null) { + if (reforgeAbilityE.isJsonPrimitive() && reforgeAbilityE.getAsJsonPrimitive().isString()) { + reforgeAbility = Utils.getElementAsString(reforgeInfo.get("reforgeAbility"), ""); + + } else if (reforgeAbilityE.isJsonObject()) { + if (reforgeAbilityE.getAsJsonObject().has(rarity)) { + reforgeAbility = reforgeAbilityE.getAsJsonObject().get(rarity).getAsString(); } } + } - if(reforgeAbility != null && !reforgeAbility.isEmpty()) { - String text = EnumChatFormatting.BLUE + (reforgeName.isEmpty() ? "Bonus: " : reforgeName + " Bonus: ") + - EnumChatFormatting.GRAY+reforgeAbility; - boolean first = true; - for(String s : Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(text, 150)) { - newTooltip.add((first ? "" : " ") + s); - first = false; - } - newTooltip.add(""); + if (reforgeAbility != null && !reforgeAbility.isEmpty()) { + String text = EnumChatFormatting.BLUE + (reforgeName.isEmpty() ? "Bonus: " : reforgeName + " Bonus: ") + + EnumChatFormatting.GRAY + reforgeAbility; + boolean first = true; + for (String s : Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(text, 150)) { + newTooltip.add((first ? "" : " ") + s); + first = false; } + newTooltip.add(""); + } + + newTooltip.add(EnumChatFormatting.BLUE + "Stats for " + rarityFormatted + "\u00a79: [\u00a7l\u00a7m< \u00a79Switch\u00a7l\u27a1\u00a79]"); - newTooltip.add(EnumChatFormatting.BLUE+"Stats for "+rarityFormatted+"\u00a79: [\u00a7l\u00a7m< \u00a79Switch\u00a7l\u27a1\u00a79]"); + if(statsE != null && statsE.isJsonObject()) { + JsonObject stats = statsE.getAsJsonObject(); JsonElement statsRarE = stats.get(rarity); - if(statsRarE != null && statsRarE.isJsonObject()) { + if (statsRarE != null && statsRarE.isJsonObject()) { + JsonObject statsRar = statsRarE.getAsJsonObject(); TreeSet<Map.Entry<String, JsonElement>> sorted = new TreeSet<>(Map.Entry.comparingByKey()); sorted.addAll(statsRar.entrySet()); - for(Map.Entry<String, JsonElement> entry : sorted) { - if(entry.getValue().isJsonPrimitive() && ((JsonPrimitive)entry.getValue()).isNumber()) { + for (Map.Entry<String, JsonElement> entry : sorted) { + if (entry.getValue().isJsonPrimitive() && ((JsonPrimitive) entry.getValue()).isNumber()) { float statNumF = entry.getValue().getAsFloat(); String statNumS; - if(statNumF % 1 == 0) { + if (statNumF % 1 == 0) { statNumS = String.valueOf(Math.round(statNumF)); } else { statNumS = Utils.floatToString(statNumF, 1); } String reforgeNamePretty = WordUtils.capitalizeFully(entry.getKey().replace("_", " ")); - String text = EnumChatFormatting.GRAY + reforgeNamePretty + ": " + EnumChatFormatting.GREEN+"+"+statNumS; - if(percentStats.contains(entry.getKey())) { + String text = EnumChatFormatting.GRAY + reforgeNamePretty + ": " + EnumChatFormatting.GREEN + "+" + statNumS; + if (percentStats.contains(entry.getKey())) { text += "%"; } - newTooltip.add(" "+text); + newTooltip.add(" " + text); } } } + } - JsonElement reforgeCostsE = reforgeInfo.get("reforgeCosts"); - int reforgeCost = -1; - if(reforgeCostsE != null) { - if(reforgeCostsE.isJsonPrimitive() && reforgeCostsE.getAsJsonPrimitive().isNumber()) { - reforgeCost = (int)Utils.getElementAsFloat(reforgeInfo.get("reforgeAbility"), -1); + JsonElement reforgeCostsE = reforgeInfo.get("reforgeCosts"); + int reforgeCost = -1; + if (reforgeCostsE != null) { + if (reforgeCostsE.isJsonPrimitive() && reforgeCostsE.getAsJsonPrimitive().isNumber()) { + reforgeCost = (int) Utils.getElementAsFloat(reforgeInfo.get("reforgeAbility"), -1); - } else if(reforgeCostsE.isJsonObject()) { - if(reforgeCostsE.getAsJsonObject().has(rarity)) { - reforgeCost = (int)Utils.getElementAsFloat(reforgeCostsE.getAsJsonObject().get(rarity), -1); - } + } else if (reforgeCostsE.isJsonObject()) { + if (reforgeCostsE.getAsJsonObject().has(rarity)) { + reforgeCost = (int) Utils.getElementAsFloat(reforgeCostsE.getAsJsonObject().get(rarity), -1); } } + } - if(reforgeCost >= 0) { - String text = EnumChatFormatting.BLUE + "Apply Cost: " + EnumChatFormatting.GOLD+NumberFormat.getNumberInstance().format(reforgeCost) +" coins"; - newTooltip.add(""); - newTooltip.add(text); - } - + if (reforgeCost >= 0) { + String text = EnumChatFormatting.BLUE + "Apply Cost: " + EnumChatFormatting.GOLD + NumberFormat.getNumberInstance().format(reforgeCost) + " coins"; + newTooltip.add(""); + newTooltip.add(text); } + } + continue; } @@ -1929,7 +2061,12 @@ public class NEUEventListener { } catch(Exception e) { continue; } if(comparatorI < 0) continue; - if("0123456789abcdefz".indexOf(colourCode.charAt(0)) < 0) continue; + String regexText = "0123456789abcdefz"; + if(isSbaloaded()) { + regexText = regexText + "Z"; + } + + if (regexText.indexOf(colourCode.charAt(0)) < 0) continue; //item_lore = item_lore.replaceAll("\\u00A79("+lvl4Max+" IV)", EnumChatFormatting.DARK_PURPLE+"$1"); //9([a-zA-Z ]+?) ([0-9]+|(I|II|III|IV|V|VI|VII|VIII|IX|X))(,|$) @@ -2048,6 +2185,7 @@ public class NEUEventListener { newTooltip.add(line); + if(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.showPriceInfoAucItem) { if(line.contains(EnumChatFormatting.GRAY+"Buy it now: ") || line.contains(EnumChatFormatting.GRAY+"Bidder: ") || @@ -2213,6 +2351,19 @@ public class NEUEventListener { index++; } + for (int i = newTooltip.size()-1; i >=0; i--) { + String line = Utils.cleanColour(newTooltip.get(i)); + for (int i1 = 0; i1 < Utils.rarityArr.length; i1++) { + if(line.equals(Utils.rarityArr[i1])){ + if(i-2 <0){ + break; + } + newTooltip.addAll(i-1, petToolTipXPExtend(event)); + break; + } + } + } + pressedShiftLast = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); pressedArrowLast = Keyboard.isKeyDown(Keyboard.KEY_LEFT) || Keyboard.isKeyDown(Keyboard.KEY_RIGHT); @@ -2232,8 +2383,112 @@ public class NEUEventListener { if(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.showPriceInfoInvItem) { ItemPriceInformation.addToTooltip(event.toolTip, internalname, event.itemStack); } + + + + + + } + + private Pattern xpLevelPattern = Pattern.compile("(.*) (\\xA7e(.*)\\xA76/\\xA7e(.*))"); + + private void onItemToolTipInternalNameNull(ItemTooltipEvent event){ + petToolTipXPExtendPetMenu(event); + + } + + private List<String> petToolTipXPExtend(ItemTooltipEvent event) { + List<String> tooltipText = new ArrayList(); + if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.petExtendExp) { + if(event.itemStack.getTagCompound().hasKey("DisablePetExp")){ + if(event.itemStack.getTagCompound().getBoolean("DisablePetExp")){ + return tooltipText; + } + } + //7 is just a random number i chose, prob no pets with less lines than 7 + if (event.toolTip.size() > 7) { + + if (Utils.cleanColour(event.toolTip.get(1)).matches("((Farming)|(Combat)|(Fishing)|(Mining)|(Foraging)|(Enchanting)|(Alchemy)) ((Mount)|(Pet)).*")) { + + GuiProfileViewer.PetLevel petlevel = null; + + //this is the item itself + NBTTagCompound tag = event.itemStack.getTagCompound(); + if (tag.hasKey("ExtraAttributes")) { + if (tag.getCompoundTag("ExtraAttributes").hasKey("petInfo")) { + JsonObject petInfo = NotEnoughUpdates.INSTANCE.manager.gson.fromJson( + tag.getCompoundTag("ExtraAttributes").getString("petInfo"), JsonObject.class); + if (petInfo.has("exp") && petInfo.get("exp").isJsonPrimitive()) { + JsonPrimitive exp = petInfo.getAsJsonPrimitive("exp"); + String petName = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(event.itemStack); + //Utils.getRarityFromInt(Utils.checkItemTypePet(event.toolTip))).getAsInt(); + petlevel = GuiProfileViewer.getPetLevel(petName, Utils.getRarityFromInt(Utils.checkItemTypePet(event.toolTip)), exp.getAsLong()); + } + } + } + + + + if (petlevel != null) { + tooltipText.add(""); + if(petlevel.totalXp > petlevel.maxXP) { + tooltipText.add(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD +"MAX LEVEL"); + } else { + tooltipText.add(EnumChatFormatting.GRAY+"Progress to Level "+(int)Math.floor(petlevel.level+1)+": "+EnumChatFormatting.YELLOW+Utils.round(petlevel.levelPercentage*100, 1)+"%"); + int levelpercentage = Math.round(petlevel.levelPercentage*20); + tooltipText.add(EnumChatFormatting.DARK_GREEN+String.join("", Collections.nCopies(levelpercentage, "-"))+EnumChatFormatting.WHITE+String.join("", Collections.nCopies(20-levelpercentage, "-"))); + tooltipText.add(EnumChatFormatting.YELLOW + "" + myFormatter.format(petlevel.levelXp) + "/" + myFormatter.format(petlevel.currentLevelRequirement) + " EXP"); + } + } + } + } + } + return tooltipText; + } + + + private void petToolTipXPExtendPetMenu(ItemTooltipEvent event) { + + if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.petExtendExp) { + //7 is just a random number i chose, prob no pets with less lines than 7 + if (event.toolTip.size() > 7) { + if (Utils.cleanColour(event.toolTip.get(1)).matches("((Farming)|(Combat)|(Fishing)|(Mining)|(Foraging)|(Enchanting)|(Alchemy)) ((Mount)|(Pet)).*")) { + GuiProfileViewer.PetLevel petlevel = null; + + int xpLine = -1; + for (int i = event.toolTip.size() - 1; i >= 0; i--) { + Matcher matcher = xpLevelPattern.matcher(event.toolTip.get(i)); + if (matcher.matches()) { + xpLine = i; + event.toolTip.set(xpLine, matcher.group(1)); + break; + } else if (event.toolTip.get(i).matches("MAX LEVEL")) { + return; + } + } + + PetInfoOverlay.Pet pet = PetInfoOverlay.getPetFromStack(event.itemStack.getDisplayName(), NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(event.itemStack.getTagCompound())); + if (pet == null) { + return; + } + petlevel = pet.petLevel; + + if (petlevel == null||xpLine==-1) { + return; + } + + event.toolTip.add(xpLine+1, EnumChatFormatting.YELLOW + "" + myFormatter.format(petlevel.levelXp) + "/" + myFormatter.format(petlevel.currentLevelRequirement) + " EXP"); + + } + } + } } + DecimalFormat myFormatter = new DecimalFormat("###,###.###"); + + + + /** * This makes it so that holding LCONTROL while hovering over an item with NBT will show the NBT of the item. * @param event @@ -2385,4 +2640,9 @@ public class NEUEventListener { } } } + + @SubscribeEvent + public void onRenderLast(RenderWorldLastEvent event){ + CrystalMetalDetectorSolver.render(event.partialTicks); + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index 967ef903..5fef4c62 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -4,6 +4,7 @@ import com.google.common.collect.Lists; import com.google.gson.*; import io.github.moulberry.notenoughupdates.auction.APIManager; import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe; +import io.github.moulberry.notenoughupdates.overlays.CraftingOverlay; import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.HypixelApi; import io.github.moulberry.notenoughupdates.util.SBInfo; @@ -12,6 +13,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraft.init.Blocks; import net.minecraft.init.Items; +import net.minecraft.inventory.ContainerChest; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.*; @@ -797,7 +799,12 @@ public class NEUManager { } public void showRecipe(JsonObject item) { - if(item.has("useneucraft") && item.get("useneucraft").getAsBoolean()) { + ContainerChest container = null; + if(Minecraft.getMinecraft().thePlayer.openContainer instanceof ContainerChest) + container = (ContainerChest) Minecraft.getMinecraft().thePlayer.openContainer; + if (item.has("recipe") && container != null && container.getLowerChestInventory().getDisplayName().getUnformattedText().equals("Craft Item")) { + CraftingOverlay.updateItem(item); + } else if(item.has("useneucraft") && item.get("useneucraft").getAsBoolean()) { displayGuiItemRecipe(item.get("internalname").getAsString(), ""); } else if(item.has("clickcommand")) { String clickcommand = item.get("clickcommand").getAsString(); @@ -1201,10 +1208,17 @@ public class NEUManager { HashMap<String, String> replacements = new HashMap<>(); if(level < 1) { - replacements.put("LVL", "1\u27A1100"); + if (Constants.PETS.has("custom_pet_leveling") && Constants.PETS.getAsJsonObject("custom_pet_leveling").has(petname) && Constants.PETS.getAsJsonObject("custom_pet_leveling").getAsJsonObject(petname).has("max_level")){ + int maxLvl = Constants.PETS.getAsJsonObject("custom_pet_leveling").getAsJsonObject(petname).get("max_level").getAsInt(); + replacements.put("LVL", "1\u27A1"+maxLvl); + } else { + replacements.put("LVL", "1\u27A1100"); + } } else { replacements.put("LVL", ""+level); } + + if(petnums != null) { if(petnums.has(petname)) { JsonObject petInfo = petnums.get(petname).getAsJsonObject(); @@ -1220,8 +1234,18 @@ public class NEUManager { if(level < 1) { JsonArray otherNumsMin = min.get("otherNums").getAsJsonArray(); JsonArray otherNumsMax = max.get("otherNums").getAsJsonArray(); + boolean addZero = false; + if(petInfoTier.has("stats_levelling_curve")){ + String[] stringArray = petInfoTier.get("stats_levelling_curve").getAsString().split(":"); + if(stringArray.length == 3) { + int type = Integer.parseInt(stringArray[2]); + if(type == 1){ + addZero = true; + } + } + } for(int i=0; i<otherNumsMax.size(); i++) { - replacements.put(""+i, removeUnusedDecimal(Math.floor(otherNumsMin.get(i).getAsFloat()*10)/10f)+ + replacements.put(""+i, (addZero?"0\u27A1":"")+removeUnusedDecimal(Math.floor(otherNumsMin.get(i).getAsFloat()*10)/10f)+ "\u27A1"+removeUnusedDecimal(Math.floor(otherNumsMax.get(i).getAsFloat()*10)/10f)); } @@ -1229,25 +1253,64 @@ public class NEUManager { int statMax = (int)Math.floor(entry.getValue().getAsFloat()); int statMin = (int)Math.floor(min.get("statNums").getAsJsonObject().get(entry.getKey()).getAsFloat()); String statStr = (statMin>0?"+":"")+statMin+"\u27A1"+statMax; + statStr = (addZero?"0\u27A1":"")+statStr; replacements.put(entry.getKey(), statStr); } } else { - float minMix = (100-level)/99f; - float maxMix = (level-1)/99f; + + int minStatsLevel = 0; + int maxStatsLevel = 100; + int statsLevelingType = -1; + + int statsLevel = level; + + + if(petInfoTier.has("stats_levelling_curve")) { + String[] stringArray = petInfoTier.get("stats_levelling_curve").getAsString().split(":"); + if (stringArray.length == 3) { + minStatsLevel = Integer.parseInt(stringArray[0]); + maxStatsLevel = Integer.parseInt(stringArray[1]); + statsLevelingType = Integer.parseInt(stringArray[2]); + switch (statsLevelingType) { + //Case for maybe a pet that might exist + case 0: + case 1: + if (level < minStatsLevel) { + statsLevel = 1; + } else if (level < maxStatsLevel) { + statsLevel = level - minStatsLevel + 1; + } else { + statsLevel = maxStatsLevel - minStatsLevel + 1; + } + break; + + } + } + } + float minMix = (maxStatsLevel-(minStatsLevel-(statsLevelingType==-1?0:1))-statsLevel)/99f; + float maxMix = (statsLevel-1)/99f; JsonArray otherNumsMin = min.get("otherNums").getAsJsonArray(); JsonArray otherNumsMax = max.get("otherNums").getAsJsonArray(); for(int i=0; i<otherNumsMax.size(); i++) { float val = otherNumsMin.get(i).getAsFloat()*minMix + otherNumsMax.get(i).getAsFloat()*maxMix; - replacements.put(""+i, removeUnusedDecimal(Math.floor(val*10)/10f)); + if(statsLevelingType == 1 && level < minStatsLevel){ + replacements.put("" + i, "0"); + } else { + replacements.put("" + i, removeUnusedDecimal(Math.floor(val * 10) / 10f)); + } } for(Map.Entry<String, JsonElement> entry : max.get("statNums").getAsJsonObject().entrySet()) { - float statMax = entry.getValue().getAsFloat(); - float statMin = min.get("statNums").getAsJsonObject().get(entry.getKey()).getAsFloat(); - float val = statMin*minMix + statMax*maxMix; - String statStr = (statMin>0?"+":"")+(int)Math.floor(val); - replacements.put(entry.getKey(), statStr); + if(statsLevelingType == 1 && level < minStatsLevel) { + replacements.put(entry.getKey(), "0"); + } else { + float statMax = entry.getValue().getAsFloat(); + float statMin = min.get("statNums").getAsJsonObject().get(entry.getKey()).getAsFloat(); + float val = statMin * minMix + statMax * maxMix; + String statStr = (statMin > 0 ? "+" : "") + (int) Math.floor(val); + replacements.put(entry.getKey(), statStr); + } } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index bf85a6a6..1c6ae7f7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -15,7 +15,6 @@ 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.SunTzu; -import io.github.moulberry.notenoughupdates.miscgui.HelpGUI; import io.github.moulberry.notenoughupdates.options.NEUConfigEditor; import io.github.moulberry.notenoughupdates.util.*; import net.minecraft.client.Minecraft; @@ -52,7 +51,6 @@ import org.lwjgl.util.vector.Vector2f; import java.awt.*; import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.List; import java.util.*; import java.util.concurrent.ExecutorService; @@ -180,6 +178,9 @@ public class NEUOverlay extends Gui { @Override public void mouseClick(float x, float y, int mouseX, int mouseY) { + if(!NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { + return; + } if(Mouse.getEventButtonState()) { setSearchBarFocus(true); if(Mouse.getEventButton() == 1) { //Right mouse button down @@ -188,6 +189,18 @@ public class NEUOverlay extends Gui { } else { if(System.currentTimeMillis() - millisLastLeftClick < 300) { searchMode = !searchMode; + if (searchMode && NotEnoughUpdates.INSTANCE.config.hidden.firstTimeSearchFocus) { + NEUEventListener.displayNotification(Lists.newArrayList( + "\u00a7eSearch Highlight", + "\u00a77In this mode NEU will gray out non matching items in", + "\u00a77your inventory or chests.", + "\u00a77This allows you easily find items as the item will stand out.", + "\u00a77To toggle this please double click on the search bar in your inventory.", + "\u00a77", + "\u00a77Press X on your keyboard to close this notifcation"), true, true); + NotEnoughUpdates.INSTANCE.config.hidden.firstTimeSearchFocus = false; + + } } textField.setCursorPosition(getClickedIndex(mouseX, mouseY)); millisLastLeftClick = System.currentTimeMillis(); @@ -202,6 +215,9 @@ public class NEUOverlay extends Gui { @Override public void render(float x, float y) { + if(!NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { + return; + } FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; int paddingUnscaled = getPaddingUnscaled(); @@ -282,6 +298,7 @@ public class NEUOverlay extends Gui { (int)x + 5 + textBeforeSelectionWidth, (int)y-4 + getHeight()/2, Color.BLACK.getRGB()); } + } @Override @@ -308,6 +325,9 @@ public class NEUOverlay extends Gui { @Override public void mouseClick(float x, float y, int mouseX, int mouseY) { + if(!NotEnoughUpdates.INSTANCE.config.toolbar.enableSettingsButton) { + return; + } if(Mouse.getEventButtonState()) { NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper(new NEUConfigEditor(NotEnoughUpdates.INSTANCE.config)); } @@ -322,15 +342,20 @@ public class NEUOverlay extends Gui { int paddingUnscaled = getPaddingUnscaled(); int searchYSize = getSearchBarYSize(); + + if(!NotEnoughUpdates.INSTANCE.config.toolbar.enableSettingsButton) { + return; + } Minecraft.getMinecraft().getTextureManager().bindTexture(quickcommand_background); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(x, y, - searchYSize + paddingUnscaled*2, searchYSize + paddingUnscaled*2, GL11.GL_NEAREST); + searchYSize + paddingUnscaled * 2, searchYSize + paddingUnscaled * 2, GL11.GL_NEAREST); Minecraft.getMinecraft().getTextureManager().bindTexture(settings); GlStateManager.color(1f, 1f, 1f, 1f); - Utils.drawTexturedRect((int)x + paddingUnscaled, (int)y + paddingUnscaled, + Utils.drawTexturedRect((int) x + paddingUnscaled, (int) y + paddingUnscaled, searchYSize, searchYSize); + GlStateManager.bindTexture(0); } }; @@ -354,10 +379,14 @@ public class NEUOverlay extends Gui { @Override public void mouseClick(float x, float y, int mouseX, int mouseY) { + if(!NotEnoughUpdates.INSTANCE.config.toolbar.enableHelpButton){ + return; + } if(Mouse.getEventButtonState()) { //displayInformationPane(HTMLInfoPane.createFromWikiUrl(overlay, manager, "Help", // "https://moulberry.github.io/files/neu_help.html")); - Minecraft.getMinecraft().displayGuiScreen(new HelpGUI()); + //Minecraft.getMinecraft().displayGuiScreen(new HelpGUI()); + ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/neuhelp"); Utils.playPressSound(); } } @@ -371,16 +400,21 @@ public class NEUOverlay extends Gui { int paddingUnscaled = getPaddingUnscaled(); int searchYSize = getSearchBarYSize(); + if(!NotEnoughUpdates.INSTANCE.config.toolbar.enableHelpButton) { + return; + } + Minecraft.getMinecraft().getTextureManager().bindTexture(quickcommand_background); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(x, y, - searchYSize + paddingUnscaled*2, searchYSize + paddingUnscaled*2, GL11.GL_NEAREST); + searchYSize + paddingUnscaled * 2, searchYSize + paddingUnscaled * 2, GL11.GL_NEAREST); Minecraft.getMinecraft().getTextureManager().bindTexture(help); GlStateManager.color(1f, 1f, 1f, 1f); - Utils.drawTexturedRect((int)x + paddingUnscaled, (int)y + paddingUnscaled, + Utils.drawTexturedRect((int) x + paddingUnscaled, (int) y + paddingUnscaled, getSearchBarYSize(), getSearchBarYSize()); GlStateManager.bindTexture(0); + } }; } @@ -517,20 +551,6 @@ public class NEUOverlay extends Gui { public int getPadding() { return getPaddingUnscaled()*4; } - - @Override - public void mouseClick(float x, float y, int mouseX, int mouseY) { - if(NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { - super.mouseClick(x, y, mouseX, mouseY); - } - } - - @Override - public void render(float x, float y) { - if(NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { - super.render(x, y); - } - } }; } @@ -633,7 +653,7 @@ public class NEUOverlay extends Gui { public void mouseInputInv() { if(Minecraft.getMinecraft().currentScreen instanceof GuiContainer) { - if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100) { + if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100 && NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { Slot slot = Utils.getSlotUnderMouse((GuiContainer)Minecraft.getMinecraft().currentScreen); if(slot != null) { ItemStack hover = slot.getStack(); @@ -691,7 +711,7 @@ public class NEUOverlay extends Gui { manager.showRecipe(item); } else if(Mouse.getEventButton() == 1) { showInfo(item); - } else if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100) { + } else if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100 && NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { textField.setText("id:"+item.get("internalname").getAsString()); updateSearch(); searchMode = true; @@ -724,7 +744,7 @@ public class NEUOverlay extends Gui { manager.showRecipe(item); } else if(Mouse.getEventButton() == 1) { showInfo(item); - } else if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100) { + } else if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100 && NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { textField.setText("id:"+item.get("internalname").getAsString()); updateSearch(); searchMode = true; @@ -1016,7 +1036,7 @@ public class NEUOverlay extends Gui { Minecraft.getMinecraft().displayGuiScreen(new NEUItemEditor(manager, internalname.get(), item)); return true; - } else if(keyPressed == manager.keybindItemSelect.getKeyCode()) { + } else if(keyPressed == manager.keybindItemSelect.getKeyCode() && NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { textField.setText("id:"+internalname.get()); itemPaneOpen = true; updateSearch(); @@ -1965,7 +1985,14 @@ public class NEUOverlay extends Gui { //Render tooltip JsonObject json = tooltipToDisplay.get(); if(json != null) { + ItemStack stack = manager.jsonToStack(json); + { + NBTTagCompound tag = stack.getTagCompound(); + tag.setBoolean("DisablePetExp", true); + stack.setTagCompound(tag); + } + List<String> text = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false); String internalname = json.get("internalname").getAsString(); @@ -1986,6 +2013,7 @@ public class NEUOverlay extends Gui { if(hasClick) text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"LMB/R : View recipe!"); if(hasInfo) text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"RMB : View additional information!"); + textToDisplay = text; } if(textToDisplay != null) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index c638eca6..38c46415 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -6,11 +6,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.mojang.authlib.Agent; -import com.mojang.authlib.minecraft.MinecraftSessionService; -import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; -import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService; -import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; import io.github.moulberry.notenoughupdates.auction.CustomAHGui; import io.github.moulberry.notenoughupdates.collectionlog.GuiCollectionLog; import io.github.moulberry.notenoughupdates.commands.SimpleCommand; @@ -24,9 +19,9 @@ import io.github.moulberry.notenoughupdates.dungeons.DungeonMap; import io.github.moulberry.notenoughupdates.dungeons.DungeonWin; import io.github.moulberry.notenoughupdates.dungeons.GuiDungeonMapEditor; import io.github.moulberry.notenoughupdates.gamemodes.GuiGamemodes; -import io.github.moulberry.notenoughupdates.gamemodes.SBGamemodes; import io.github.moulberry.notenoughupdates.miscfeatures.*; import io.github.moulberry.notenoughupdates.miscgui.*; +import io.github.moulberry.notenoughupdates.miscgui.tutorials.NeuTutorial; import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.options.NEUConfigEditor; import io.github.moulberry.notenoughupdates.overlays.FuelBar; @@ -68,8 +63,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.text.WordUtils; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.impl.client.HttpClients; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.GL11; @@ -77,7 +70,8 @@ import java.awt.*; import java.awt.datatransfer.StringSelection; import java.io.*; import java.lang.management.ManagementFactory; -import java.net.Proxy; +import java.net.URI; +import java.net.URISyntaxException; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.List; @@ -233,6 +227,92 @@ public class NotEnoughUpdates { } });*/ + SimpleCommand neuHelp = new SimpleCommand("neuhelp", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + ArrayList<String> neuHelpMessages = Lists.newArrayList( + "\u00a75\u00a7lNotEnoughUpdates commands", + "\u00a76/neu \u00a77- Opens the main neu GUI.", + "\u00a76/pv \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- Opens the profile viewer", + "\u00a76/neusouls {on/off/clear/unclear} \u00a7r\u00a77- Shows waypoints to fairy souls.", + "\u00a76/neubuttons \u00a7r\u00a77- Opens a GUI which allows you to customize inventory buttons.", + "\u00a76/neuec \u00a7r\u00a77- Opens the enchant colour GUI.", + + "\u00a76/join {floor} \u00a7r\u00a77- Short Command to join a Dungeon. \u00a7lNeed a Party of 5 People\u00a7r\u00a77 {4/f7/m5}.", + "\u00a76/neucosmetics \u00a7r\u00a77- Opens the cosmetic GUI.", + "\u00a76/neurename \u00a7r\u00a77- Opens the NEU Item Customizer.", + "\u00a76/cata \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- Opens the profile viewer's catacombs page.", + "\u00a76/neulinks \u00a7r\u00a77- Shows links to neu/moulberry.", + "\u00a76/neuoverlay \u00a7r\u00a77- Opens GUI Editor for quickcommands and searchbar.", + "\u00a76/neuah \u00a7r\u00a77- Opens neu's custom ah GUI.", + "\u00a76/neumap \u00a7r\u00a77- Opens the dungeon map GUI.", + "\u00a76/neucalendar \u00a7r\u00a77- Opens neu's custom calendar GUI.", + "", + "\u00a76\u00a7lOld commands:", + "\u00a76/peek \u00a7b?{user} \u00a72\u2D35 \u00a7r\u00a77- Shows quickly stats for a user.", + "", + "\u00a76\u00a7lDebug commands:", + "\u00a76/neustats \u00a7r\u00a77- Copies helpful info to the clipboard.", + "\u00a76/neustats modlist \u00a7r\u00a77- Copies modlist info to clipboard.", + "\u00a76/neuresetrepo \u00a7r\u00a77- Deletes all repo files.", + "\u00a76/neureloadrepo \u00a7r\u00a77- Debug command with repo.", + "", + "\u00a76\u00a7lDev commands:", + "\u00a76/neupackdev \u00a7r\u00a77- pack creator command - getnpc"); + for (int i = 0; i < neuHelpMessages.size(); i++) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(neuHelpMessages.get(i) + )); + + } + if(NotEnoughUpdates.INSTANCE.config.hidden.dev) { + ArrayList<String> neuDevHelpMessages = Lists.newArrayList( + "\u00a76/neudevtest \u00a7r\u00a77- dev test command", + "\u00a76/neuzeephere \u00a7r\u00a77- sphere", + "\u00a76/neudungeonwintest \u00a7r\u00a77- displays the dungeon win screen"); + + for (int i = 0; i < neuDevHelpMessages.size(); i++) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(neuDevHelpMessages.get(i) + )); + + } + } + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a77Commands marked with a \u00a72\"\u2D35\"\u00a77 require are api key. You can set your api key via \"/api new\" or by manually putting it in the api field in \"/neu\"")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a77Arguments marked with a \u00a7b\"?\"\u00a77 are optional.")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a76\u00a7lScroll up to see everything")); + } + }); + + SimpleCommand neuFeatures = new SimpleCommand("neufeatures", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + if(Constants.MISC == null || !Constants.MISC.has("featureslist")){ + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD+"WARNING: "+EnumChatFormatting.RESET+EnumChatFormatting.RED+"Could not load URL from repo.")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.RED+ "Please run "+EnumChatFormatting.BOLD+"/neuresetrepo"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" and "+EnumChatFormatting.BOLD+"restart your game"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" in order to fix. "+EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD+"If that doesn't fix it"+EnumChatFormatting.RESET+EnumChatFormatting.RED+", please join discord.gg/moulberry and post in #neu-support")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + return; + } + String url = Constants.MISC.get("featureslist").getAsString(); + + Desktop desk = Desktop.getDesktop(); + try { + desk.browse(new URI(url)); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE+""+EnumChatFormatting.BOLD+"NEU"+EnumChatFormatting.RESET+EnumChatFormatting.GOLD+"> Opening Feature List in browser.")); + } catch (URISyntaxException | IOException ignored){ + + ChatComponentText clickTextFeatures = new ChatComponentText( + EnumChatFormatting.DARK_PURPLE+""+EnumChatFormatting.BOLD+"NEU"+EnumChatFormatting.RESET+EnumChatFormatting.GOLD+"> Click here to open the Feature List in your browser."); + clickTextFeatures.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, url)); + Minecraft.getMinecraft().thePlayer.addChatMessage(clickTextFeatures); + + } + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + + } + }); + + SimpleCommand stWhyCommand = new SimpleCommand("neustwhy", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { NEUEventListener.displayNotification(Lists.newArrayList( @@ -609,21 +689,10 @@ public class NotEnoughUpdates { SimpleCommand.ProcessCommandRunnable viewProfileRunnable = new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { - if(Loader.isModLoaded("optifine") && - new File(Minecraft.getMinecraft().mcDataDir, "optionsof.txt").exists()) { - try(InputStream in = new FileInputStream(new File(Minecraft.getMinecraft().mcDataDir, "optionsof.txt"))) { - BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); - - String line; - while((line = reader.readLine()) != null) { - if(line.contains("ofFastRender:true")) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "Some parts of the profile viewer do not work with OF Fast Render. Go to Video > Performance to disable it.")); - break; - } - } - } catch(Exception e) { - } + if(!OpenGlHelper.isFramebufferEnabled()) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + + "Some parts of the profile viewer do not work with OF Fast Render. Go to ESC > Options > Video Settings > Performance > Fast Render to disable it.")); + } if (config.apiKey.apiKey == null || config.apiKey.apiKey.trim().isEmpty()) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + @@ -664,9 +733,13 @@ public class NotEnoughUpdates { } else { if(args.length != 1) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - EnumChatFormatting.RED+"Example Usage: /join f7 or /join 7")); + EnumChatFormatting.RED+"Example Usage: /join f7, /join m6 or /join 7")); } else { - String cmd = "/joindungeon catacombs " + args[0].charAt(args[0].length()-1); + String cataPrefix = "catacombs"; + if(args[0].startsWith("m")){ + cataPrefix = "master_catacombs"; + } + String cmd = "/joindungeon "+cataPrefix+" " + args[0].charAt(args[0].length()-1); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( EnumChatFormatting.YELLOW+"Running command: "+cmd)); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( @@ -940,7 +1013,7 @@ public class NotEnoughUpdates { SimpleCommand tutorialCommand = new SimpleCommand("neututorial", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { - openGui = new HelpGUI(); + openGui = new NeuTutorial(); } }); @@ -1046,21 +1119,10 @@ public class NotEnoughUpdates { SimpleCommand cosmeticsCommand = new SimpleCommand("neucosmetics", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { - if(Loader.isModLoaded("optifine") && - new File(Minecraft.getMinecraft().mcDataDir, "optionsof.txt").exists()) { - try(InputStream in = new FileInputStream(new File(Minecraft.getMinecraft().mcDataDir, "optionsof.txt"))) { - BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); - - String line; - while((line = reader.readLine()) != null) { - if(line.contains("ofFastRender:true")) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "NEU cosmetics do not work with OF Fast Render. Go to Video > Performance to disable it.")); - return; - } - } - } catch(Exception e) { - } + if(!OpenGlHelper.isFramebufferEnabled()) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + + "NEU cosmetics do not work with OF Fast Render. Go to ESC > Options > Video Settings > Performance > Fast Render to disable it.")); + } openGui = new GuiCosmetics(); @@ -1167,7 +1229,7 @@ public class NotEnoughUpdates { MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new NEUEventListener(this)); MinecraftForge.EVENT_BUS.register(CapeManager.getInstance()); - MinecraftForge.EVENT_BUS.register(new SBGamemodes()); + //MinecraftForge.EVENT_BUS.register(new SBGamemodes()); MinecraftForge.EVENT_BUS.register(new EnchantingSolvers()); MinecraftForge.EVENT_BUS.register(new CalendarOverlay()); MinecraftForge.EVENT_BUS.register(SBInfo.getInstance()); @@ -1201,7 +1263,7 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(nullzeeSphereCommand); ClientCommandHandler.instance.registerCommand(cosmeticsCommand); ClientCommandHandler.instance.registerCommand(linksCommand); - ClientCommandHandler.instance.registerCommand(gamemodesCommand); + //ClientCommandHandler.instance.registerCommand(gamemodesCommand); ClientCommandHandler.instance.registerCommand(stWhyCommand); ClientCommandHandler.instance.registerCommand(buttonsCommand); ClientCommandHandler.instance.registerCommand(resetRepoCommand); @@ -1218,7 +1280,7 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(packDevCommand); if(!Loader.isModLoaded("skyblockextras")) ClientCommandHandler.instance.registerCommand(viewCataCommand); ClientCommandHandler.instance.registerCommand(peekCommand); - ClientCommandHandler.instance.registerCommand(tutorialCommand); +// ClientCommandHandler.instance.registerCommand(tutorialCommand); ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand); ClientCommandHandler.instance.registerCommand(enchantColourCommand); ClientCommandHandler.instance.registerCommand(neuAhCommand); @@ -1230,6 +1292,9 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(dungeonWinTest); ClientCommandHandler.instance.registerCommand(calendarCommand); ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommand()); + ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommandAlt()); + ClientCommandHandler.instance.registerCommand(neuHelp); + ClientCommandHandler.instance.registerCommand(neuFeatures); BackgroundBlur.registerListener(); @@ -1288,6 +1353,7 @@ public class NotEnoughUpdates { public void displayLinks(JsonObject update) { String discord_link = update.get("discord_link").getAsString(); String youtube_link = update.get("youtube_link").getAsString(); + String twitch_link = update.get("twitch_link").getAsString(); String update_link = update.get("update_link").getAsString(); String github_link = update.get("github_link").getAsString(); String other_text = update.get("other_text").getAsString(); @@ -1300,11 +1366,13 @@ public class NotEnoughUpdates { } ChatComponentText links = new ChatComponentText(""); ChatComponentText separator = new ChatComponentText( - EnumChatFormatting.GRAY+EnumChatFormatting.BOLD.toString()+EnumChatFormatting.STRIKETHROUGH+(other==null?"---":"--")); + EnumChatFormatting.GRAY+EnumChatFormatting.BOLD.toString()+EnumChatFormatting.STRIKETHROUGH+(other==null?"--":"-")); ChatComponentText discord = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.BLUE+"Discord"+EnumChatFormatting.GRAY+"]"); discord.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, discord_link)); ChatComponentText youtube = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.RED+"YouTube"+EnumChatFormatting.GRAY+"]"); youtube.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, youtube_link)); + ChatComponentText twitch = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.DARK_PURPLE+"Twitch"+EnumChatFormatting.GRAY+"]"); + twitch.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, twitch_link)); ChatComponentText release = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.GREEN+"Release"+EnumChatFormatting.GRAY+"]"); release.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, update_link)); ChatComponentText github = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.DARK_PURPLE+"GitHub"+EnumChatFormatting.GRAY+"]"); @@ -1315,6 +1383,8 @@ public class NotEnoughUpdates { links.appendSibling(separator); links.appendSibling(youtube); links.appendSibling(separator); + links.appendSibling(twitch); + links.appendSibling(separator); links.appendSibling(release); links.appendSibling(separator); links.appendSibling(github); 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 f896f1c2..9351b208 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java @@ -429,15 +429,15 @@ public class APIManager { } catch(Exception e) {} } - String[] rarityArr = new String[] { - "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", - }; +// String[] rarityArr = new String[] { +// "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", "SUPREME", +// }; public int checkItemType(String lore, boolean contains, String... typeMatches) { String[] split = lore.split("\n"); for(int i=split.length-1; i>=0; i--) { String line = split[i]; - for(String rarity : rarityArr) { + for(String rarity : Utils.rarityArr) { for(int j=0; j<typeMatches.length; j++) { if(contains) { if(line.trim().contains(rarity + " " + typeMatches[j])) { 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 3f52ebf8..25d4d03b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java @@ -144,8 +144,8 @@ public class CustomAH extends Gui { private static final int SORT_MODE_LOW = 1; private static final int SORT_MODE_SOON = 2; - private static final String[] rarities = {"COMMON", "UNCOMMON", "RARE", "EPIC", - "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", "SUPREME"}; +// private static final String[] rarities = {"COMMON", "UNCOMMON", "RARE", "EPIC", +// "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", "SUPREME"}; private static final String[] rarityColours = {"" + EnumChatFormatting.WHITE, "" + EnumChatFormatting.GREEN, "" + EnumChatFormatting.BLUE, "" + EnumChatFormatting.DARK_PURPLE, "" + EnumChatFormatting.GOLD, "" + EnumChatFormatting.LIGHT_PURPLE, "" + EnumChatFormatting.RED, @@ -1075,9 +1075,9 @@ public class CustomAH extends Gui { lore.add(""); lore.add((rarityFilter == -1 ? EnumChatFormatting.DARK_GRAY + selPrefixNC : unselPrefix) + "No Filter"); - for (int i = 0; i < rarities.length; i++) { + for (int i = 0; i < Utils.rarityArr.length; i++) { lore.add((rarityFilter == i ? rarityColours[i] + selPrefixNC : unselPrefix) + - Utils.prettyCase(rarities[i])); + Utils.prettyCase(Utils.rarityArr[i])); } lore.add(""); lore.add(EnumChatFormatting.AQUA + "Right-Click to go backwards!"); @@ -1230,8 +1230,8 @@ public class CustomAH extends Gui { } } - if (rarityFilter >= 0 && rarityFilter < rarities.length) { - match &= rarities[rarityFilter].equals(auc.rarity); + if (rarityFilter >= 0 && rarityFilter < Utils.rarityArr.length) { + match &= Utils.rarityArr[rarityFilter].equals(auc.rarity); } if (binFilter == BIN_FILTER_BIN) { @@ -1674,10 +1674,10 @@ public class CustomAH extends Gui { case 2: if (rightClicked) { rarityFilter--; - if (rarityFilter < -1) rarityFilter = rarities.length - 1; + if (rarityFilter < -1) rarityFilter = Utils.rarityArr.length - 1; } else { rarityFilter++; - if (rarityFilter >= rarities.length) rarityFilter = -1; + if (rarityFilter >= Utils.rarityArr.length) rarityFilter = -1; } break; case 3: diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java index a43eb0e6..b63831ac 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java @@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.core.util.render; import io.github.moulberry.notenoughupdates.core.BackgroundBlur; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; @@ -9,8 +10,12 @@ import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.Entity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumChatFormatting; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; +import org.lwjgl.util.vector.Vector3f; public class RenderUtils { @@ -141,4 +146,84 @@ public class RenderUtils { GlStateManager.enableTexture2D(); } + public static void renderWayPoint(String str, BlockPos loc, float partialTicks) { + renderWayPoint(str, new Vector3f(loc.getX(), loc.getY(), loc.getZ()), partialTicks); + } + public static void renderWayPoint(String str, Vector3f loc, float partialTicks) { + GlStateManager.alphaFunc(516, 0.1F); + + GlStateManager.pushMatrix(); + + Entity viewer = Minecraft.getMinecraft().getRenderViewEntity(); + double viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * partialTicks; + double viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * partialTicks; + double viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * partialTicks; + + double x = loc.x-viewerX+0.5f; + double y = loc.y-viewerY-viewer.getEyeHeight(); + double z = loc.z-viewerZ+0.5f; + + double distSq = x*x + y*y + z*z; + double dist = Math.sqrt(distSq); + if(distSq > 144) { + x *= 12/dist; + y *= 12/dist; + z *= 12/dist; + } + GlStateManager.translate(x, y, z); + GlStateManager.translate(0, viewer.getEyeHeight(), 0); + + renderNametag(str); + + GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(0, -0.25f, 0); + GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); + + renderNametag(EnumChatFormatting.YELLOW.toString()+Math.round(dist)+"m"); + + GlStateManager.popMatrix(); + + GlStateManager.disableLighting(); + } + + public static void renderNametag(String str) { + FontRenderer fontrenderer = Minecraft.getMinecraft().fontRendererObj; + float f = 1.6F; + float f1 = 0.016666668F * f; + GlStateManager.pushMatrix(); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.scale(-f1, -f1, f1); + GlStateManager.disableLighting(); + GlStateManager.depthMask(false); + GlStateManager.disableDepth(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + int i = 0; + + int j = fontrenderer.getStringWidth(str) / 2; + GlStateManager.disableTexture2D(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos((double)(-j - 1), (double)(-1 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double)(-j - 1), (double)(8 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double)(j + 1), (double)(8 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double)(j + 1), (double)(-1 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, i, 553648127); + GlStateManager.depthMask(true); + + fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, i, -1); + + GlStateManager.enableDepth(); + GlStateManager.enableBlend(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + } + } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java index 893a1109..75a63644 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -103,6 +103,7 @@ public class CapeManager { new CapeData("subreddit_light", true, false), new CapeData("packshq", true, false), new CapeData("skytils", true, false), + new CapeData("sbp", true, false), //Special Other new CapeData("contrib", true, false), @@ -137,6 +138,7 @@ public class CapeManager { } private void updateCapes() { + NotEnoughUpdates.INSTANCE.manager.hypixelApi.getMyApiAsync("activecapes.json", (jsonObject) -> { if(jsonObject.get("success").getAsBoolean()) { lastJsonSync = jsonObject; @@ -310,7 +312,9 @@ public class CapeManager { playerMap.clear(); for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { String uuid = player.getUniqueID().toString().replace("-", ""); - playerMap.put(uuid, player); + try { + playerMap.put(uuid, player); + } catch(IllegalArgumentException ignored){} } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java index 31eaccb1..978f3d6a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java @@ -1,7 +1,14 @@ package io.github.moulberry.notenoughupdates.cosmetics; +import com.google.common.collect.Lists; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.reflect.TypeToken; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.GuiElementTextField; +import io.github.moulberry.notenoughupdates.util.Constants; +import io.github.moulberry.notenoughupdates.util.GuiTextures; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -41,7 +48,19 @@ public class GuiCosmetics extends GuiScreen { private String wantToEquipCape = null; private long lastCapeEquip = 0; - private List<String> tooltipToDisplay = null; + private List<String> cosmeticsInfoTooltip = null; + + + + public GuiCosmetics(){ + Gson gson = new Gson(); + + JsonElement cosmeticHelpTextElement = Utils.getElement(Constants.MISC, "cosmeticsinfo.lore"); + if(cosmeticHelpTextElement.isJsonArray()) { + cosmeticsInfoTooltip = gson.fromJson(cosmeticHelpTextElement, new TypeToken<List<String>>(){}.getType()); + } + + } public enum CosmeticsPage { CAPES(new ItemStack(Items.chainmail_chestplate)); @@ -92,14 +111,16 @@ public class GuiCosmetics extends GuiScreen { drawCapesPage(mouseX, mouseY, partialTicks); break; } + int helpX = guiLeft+sizeX-20; + if(mouseX >= helpX && mouseX <= helpX+20 && mouseY >= guiTop-20 && mouseY <= guiTop) { + if(cosmeticsInfoTooltip != null) { + List<String> grayTooltip = new ArrayList<>(cosmeticsInfoTooltip.size()); + for (String line : cosmeticsInfoTooltip) { + grayTooltip.add(EnumChatFormatting.GRAY + line); + } + Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj); - if(tooltipToDisplay != null) { - List<String> grayTooltip = new ArrayList<>(tooltipToDisplay.size()); - for(String line : tooltipToDisplay) { - grayTooltip.add(EnumChatFormatting.GRAY + line); } - Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj); - tooltipToDisplay = null; } StringBuilder statusMsg = new StringBuilder("Last Sync: "); @@ -116,7 +137,7 @@ public class GuiCosmetics extends GuiScreen { } Minecraft.getMinecraft().fontRendererObj.drawString(EnumChatFormatting.AQUA+statusMsg.toString(), - guiLeft+sizeX-Minecraft.getMinecraft().fontRendererObj.getStringWidth(statusMsg.toString()), guiTop-12, 0, true); + guiLeft+sizeX-Minecraft.getMinecraft().fontRendererObj.getStringWidth(statusMsg.toString())-20, guiTop-12, 0, true); if(currentPage == CosmeticsPage.CAPES) { GlStateManager.color(1, 1, 1, 1); @@ -148,6 +169,17 @@ public class GuiCosmetics extends GuiScreen { unlockTextField.setSize(80, 20); unlockTextField.render(guiLeft+sizeX-80, guiTop+sizeY+2); + + + + + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.help); + GlStateManager.color(1, 1, 1, 1); + Utils.drawTexturedRect(helpX, guiTop-20, 20, 20, GL11.GL_LINEAR); + + + + } private void renderTabs(boolean renderPressed) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java index c1d36e8f..6011f0ac 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java @@ -1,5 +1,6 @@ package io.github.moulberry.notenoughupdates.cosmetics; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils; import io.github.moulberry.notenoughupdates.util.ReverseWorldRenderer; import io.github.moulberry.notenoughupdates.util.TexLoc; @@ -79,32 +80,46 @@ public class NEUCape { public void setCapeTexture(String capeName) { if(this.capeName != null && this.capeName.equalsIgnoreCase(capeName)) return; - this.capeName = capeName; startTime = System.currentTimeMillis(); + boolean defaultBehaviour = true; - if(capeName.equalsIgnoreCase("fade")) { - shaderName = "fade_cape"; - } else if(capeName.equalsIgnoreCase("space")) { - shaderName = "space_cape"; - } else if(capeName.equalsIgnoreCase("mcworld") || capeName.equalsIgnoreCase("skyclient")) { - shaderName = "mcworld_cape"; - } else if(capeName.equalsIgnoreCase("lava")) { - shaderName = "lava_cape"; - } else if(capeName.equalsIgnoreCase("lightning")) { - shaderName = "lightning_cape"; - } else if(capeName.equalsIgnoreCase("thebakery")) { - shaderName = "biscuit_cape"; - } else if(capeName.equalsIgnoreCase("negative")) { - shaderName = "negative"; - } else if(capeName.equalsIgnoreCase("void")) { - shaderName = "void"; - } else if(capeName.equalsIgnoreCase("tunnel")) { - shaderName = "tunnel"; - } else if(capeName.equalsIgnoreCase("planets")) { - shaderName = "planets"; - } else { - shaderName = "shiny_cape"; + if(NotEnoughUpdates.INSTANCE.config.hidden.disableBrokenCapes){ + if(capeName.equals("negative")){ + defaultBehaviour = false; + this.capeName = "fade"; + this.shaderName = "fade_cape"; + } + + } + if(defaultBehaviour){ + this.capeName = capeName; + + + + if (capeName.equalsIgnoreCase("fade")) { + shaderName = "fade_cape"; + } else if (capeName.equalsIgnoreCase("space")) { + shaderName = "space_cape"; + } else if (capeName.equalsIgnoreCase("mcworld")) { + shaderName = "mcworld_cape"; + } else if(capeName.equalsIgnoreCase("lava") || capeName.equalsIgnoreCase("skyclient")) { + shaderName = "lava_cape"; + } else if (capeName.equalsIgnoreCase("lightning")) { + shaderName = "lightning_cape"; + } else if (capeName.equalsIgnoreCase("thebakery")) { + shaderName = "biscuit_cape"; + } else if (capeName.equalsIgnoreCase("negative")) { + shaderName = "negative"; + } else if (capeName.equalsIgnoreCase("void")) { + shaderName = "void"; + } else if (capeName.equalsIgnoreCase("tunnel")) { + shaderName = "tunnel"; + } else if (capeName.equalsIgnoreCase("planets")) { + shaderName = "planets"; + } else { + shaderName = "shiny_cape"; + } } ResourceLocation staticCapeTex = new ResourceLocation("notenoughupdates:capes/" + capeName + ".png"); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java index 01b27f3d..658f72df 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java @@ -22,6 +22,7 @@ import net.minecraft.client.shader.Shader; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; +import net.minecraft.item.Item; import net.minecraft.item.ItemMap; import net.minecraft.item.ItemStack; import net.minecraft.scoreboard.Score; @@ -1516,6 +1517,10 @@ public class DungeonMap { renderMap(pos.getAbsX(scaledResolution, size/2)+size/2, pos.getAbsY(scaledResolution, size/2)+size/2, colourMap, decorations, roomSizeBlocks, actualPlayers, true, event.partialTicks); Utils.pushGuiScale(-1); + } else if(stack != null && Item.getIdFromItem(stack.getItem()) == 399){ + //This should clear the map if you're in the dungeon boss room + //so when you're holding a bow it doesnt show the map anymore + this.colourMap = null; } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java index ab4d1b7b..95ca32c9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java @@ -139,18 +139,23 @@ public class DungeonWin { } } + public static void onChatMessage(ClientChatReceivedEvent e) { if(e.type == 2) return; if(NotEnoughUpdates.INSTANCE.config.dungeons.dungeonWinMillis < 100 || !NotEnoughUpdates.INSTANCE.config.dungeons.enableDungeonWin) return; + long currentTime = System.currentTimeMillis(); String unformatted = Utils.cleanColour(e.message.getUnformattedText()); - if(e.message.getFormattedText().startsWith(EnumChatFormatting.RESET+" ")) { + + //Added two more Resets, cant do Reset+Reset+Reset cause idk? + //hypixel please dont randomly add more + + if(e.message.getFormattedText().startsWith(EnumChatFormatting.RESET+""+EnumChatFormatting.RESET+""+EnumChatFormatting.RESET+" ")){ if(currentTime - lastDungeonFinish > 30000) { Matcher matcher = TEAM_SCORE_REGEX.matcher(unformatted); if(matcher.find()) { lastDungeonFinish = currentTime; - String score = matcher.group(1); switch (score.toUpperCase()) { case "S+": @@ -183,7 +188,7 @@ public class DungeonWin { displayWin(); } else { if(unformatted.trim().length() > 0) { - text.add(e.message.getFormattedText().substring(2).trim()); + text.add(e.message.getFormattedText().substring(6).trim()); } } } else { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java new file mode 100644 index 00000000..73e2b412 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -0,0 +1,126 @@ +package io.github.moulberry.notenoughupdates.miscfeatures; + +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; +import io.github.moulberry.notenoughupdates.util.SBInfo; +import net.minecraft.client.Minecraft; +import net.minecraft.util.*; + +import java.util.ArrayList; +import java.util.List; + +public class CrystalMetalDetectorSolver { + private static final Minecraft mc = Minecraft.getMinecraft(); + private static BlockPos prevPos; + private static double prevDist = 0; + private static List<BlockPos> possibleBlocks = new ArrayList<>(); + private static final List<BlockPos> locations = new ArrayList<>(); + + public static void process(IChatComponent message) { + if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") + && message.getUnformattedText().contains("TREASURE: ")) { + double dist = Double.parseDouble(message.getUnformattedText().split("TREASURE: ")[1].split("m")[0].replaceAll("(?!\\.)\\D", "")); + if (NotEnoughUpdates.INSTANCE.config.mining.metalDetectorEnabled && prevDist == dist && prevPos.getX() == mc.thePlayer.getPosition().getX() && + prevPos.getY() == mc.thePlayer.getPosition().getY() && + prevPos.getZ() == mc.thePlayer.getPosition().getZ() && !locations.contains(mc.thePlayer.getPosition())) { + if (possibleBlocks.size() == 0) { + locations.add(mc.thePlayer.getPosition()); + for (int zOffset = (int) Math.floor(-dist); zOffset <= Math.ceil(dist); zOffset++) { + for (int y = 65; y <= 75; y++) { + double calculatedDist = 0; + int xOffset = 0; + while (calculatedDist < dist) { + BlockPos pos = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, + y, Math.floor(mc.thePlayer.posZ) + zOffset); + BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, + y + 1, Math.floor(mc.thePlayer.posZ) + zOffset); + calculatedDist = getPlayerPos().distanceTo(new Vec3(pos).addVector(0D, 1D, 0D)); + if (round(calculatedDist, 1) == dist && treasureAllowed(pos) && !possibleBlocks.contains(pos) && + mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { + possibleBlocks.add(pos); + } + xOffset++; + } + xOffset = 0; + calculatedDist = 0; + while (calculatedDist < dist) { + BlockPos pos = new BlockPos(Math.floor(mc.thePlayer.posX) - xOffset, + y, Math.floor(mc.thePlayer.posZ) + zOffset); + BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) - xOffset, + y + 1, Math.floor(mc.thePlayer.posZ) + zOffset); + calculatedDist = getPlayerPos().distanceTo(new Vec3(pos).addVector(0D, 1D, 0D)); + if (round(calculatedDist, 1) == dist && treasureAllowed(pos) && !possibleBlocks.contains(pos) && + mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { + possibleBlocks.add(pos); + } + xOffset++; + } + } + } + sendMessage(); + } else if (possibleBlocks.size() != 1) { + locations.add(mc.thePlayer.getPosition()); + List<BlockPos> temp = new ArrayList<>(); + for (BlockPos pos : possibleBlocks) { + if (round(getPlayerPos().distanceTo(new Vec3(pos).addVector(0D, 1D, 0D)), 1) == dist) { + temp.add(pos); + } + } + possibleBlocks = temp; + sendMessage(); + } + } + prevPos = mc.thePlayer.getPosition(); + prevDist = dist; + } + } + + public static void reset() { + possibleBlocks.clear(); + locations.clear(); + } + + public static void render(float partialTicks) { + if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") && + SBInfo.getInstance().location.equals("Mines of Divan")) { + if (possibleBlocks.size() == 1) { + RenderUtils.renderWayPoint("Treasure", possibleBlocks.get(0).add(0, 2.5, 0), partialTicks); + } else if (possibleBlocks.size() > 1 && NotEnoughUpdates.INSTANCE.config.mining.metalDetectorShowPossible) { + for (BlockPos block : possibleBlocks) { + RenderUtils.renderWayPoint("Possible Treasure Location", block.add(0, 2.5, 0), partialTicks); + } + } + } + } + + private static double round(double value, int precision) { + int scale = (int) Math.pow(10, precision); + return (double) Math.round(value * scale) / scale; + } + + private static boolean treasureAllowed(BlockPos pos) { + return mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:gold_block") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:prismarine") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:chest") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:stained_glass") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:stained_glass_pane") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:wool") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:stained_hardened_clay"); + } + + private static void sendMessage() { + if (possibleBlocks.size() > 1) { + mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "[NEU] Need another position to find solution. Possible blocks: " + + possibleBlocks.size())); + } else if (possibleBlocks.size() == 0) { + mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Failed to find solution.")); + reset(); + } else { + mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "[NEU] Found solution.")); + } + } + + private static Vec3 getPlayerPos() { + return new Vec3(mc.thePlayer.posX, mc.thePlayer.posY + (mc.thePlayer.getEyeHeight() - mc.thePlayer.getDefaultEyeHeight()), mc.thePlayer.posZ); + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java index 83ad8a0d..d7d27f99 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -45,6 +45,8 @@ import java.awt.*; import java.io.ByteArrayInputStream; import java.util.*; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class CustomItemEffects { @@ -59,10 +61,7 @@ public class CustomItemEffects { public long lastUsedHyperion = 0; - private boolean heldBonemerang = false; - - public final Set<EntityLivingBase> bonemeragedEntities = new HashSet<>(); - public boolean bonemerangBreak = false; + private final Pattern etherwarpDistancePattern = Pattern.compile("up to (?<distance>\\d{2}) blocks away\\."); public int aoteTeleportationMillis = 0; public Vector3f aoteTeleportationCurr = null; @@ -197,55 +196,7 @@ public class CustomItemEffects { tick++; if(tick > Integer.MAX_VALUE/2) tick = 0; - heldBonemerang = false; - bonemerangBreak = false; - bonemeragedEntities.clear(); - if(Minecraft.getMinecraft().thePlayer == null) return; - if(Minecraft.getMinecraft().theWorld == null) return; - - ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); - - String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); - if(internal != null && internal.equals("BONE_BOOMERANG")) { - heldBonemerang = true; - - EntityPlayerSP p = Minecraft.getMinecraft().thePlayer; - float stepSize = 0.15f; - float bonemerangDistance = 15; - - Vector3f position = new Vector3f((float)p.posX, (float)p.posY + p.getEyeHeight(), (float)p.posZ); - Vec3 look = p.getLook(0); - - Vector3f step = new Vector3f((float)look.xCoord, (float)look.yCoord, (float)look.zCoord); - step.scale(stepSize / step.length()); - - for(int i=0; i<Math.floor(bonemerangDistance/stepSize)-2; i++) { - AxisAlignedBB bb = new AxisAlignedBB(position.x - 0.75f, position.y - 0.1, position.z - 0.75f, - position.x + 0.75f, position.y + 0.25, position.z + 0.75); - BlockPos blockPos = new BlockPos(position.x, position.y, position.z); - - if(!Minecraft.getMinecraft().theWorld.isAirBlock(blockPos) && - Minecraft.getMinecraft().theWorld.getBlockState(blockPos).getBlock().isFullCube()) { - if(NotEnoughUpdates.INSTANCE.config.itemOverlays.showBreak) { - bonemerangBreak = true; - } - break; - } - - if(NotEnoughUpdates.INSTANCE.config.itemOverlays.highlightTargeted) { - List<Entity> entities = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABBExcludingEntity(Minecraft.getMinecraft().thePlayer, bb); - for(Entity entity : entities) { - if(entity instanceof EntityLivingBase && !(entity instanceof EntityArmorStand) && !entity.isInvisible()) { - if(!bonemeragedEntities.contains(entity)) { - bonemeragedEntities.add((EntityLivingBase)entity); - } - } - } - } - position.translate(step.x, step.y, step.z); - } - } } private float lastPartialTicks = 0; @@ -301,7 +252,7 @@ public class CustomItemEffects { ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); - if(usingEtherwarp) { + if(usingEtherwarp && NotEnoughUpdates.INSTANCE.config.itemOverlays.enableEtherwarpHelperOverlay) { String denyTpReason = null; if(etherwarpRaycast == null) { denyTpReason = "Too far!"; @@ -313,7 +264,10 @@ public class CustomItemEffects { denyTpReason = "Not solid!"; } else { WorldClient world = Minecraft.getMinecraft().theWorld; - if(world.getBlockState(pos.add(0, 1, 0)).getBlock() != Blocks.air || + Block above = world.getBlockState(pos.add(0, 1, 0)).getBlock(); + if(above != Blocks.air && above.isCollidable() && + above.getCollisionBoundingBox(Minecraft.getMinecraft().theWorld, pos.add(0, 1, 0), + world.getBlockState(pos.add(0, 1, 0))) != null || world.getBlockState(pos.add(0, 2, 0)).getBlock() != Blocks.air) { denyTpReason = "No air above!"; } @@ -329,16 +283,12 @@ public class CustomItemEffects { } } - if(heldBonemerang) { - if(bonemerangBreak) { - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - Utils.drawStringCentered(EnumChatFormatting.RED+"Bonemerang will break!", - Minecraft.getMinecraft().fontRendererObj, - scaledResolution.getScaledWidth()/2f, scaledResolution.getScaledHeight()/2f+10, true, 0); - } - } else if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay && + boolean onPrivateIsland = SBInfo.getInstance().getLocation() == null || SBInfo.getInstance().getLocation().equals("dynamic"); + + + if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay && Minecraft.getMinecraft().objectMouseOver != null && - Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && onPrivateIsland) { IBlockState hover = Minecraft.getMinecraft().theWorld.getBlockState( Minecraft.getMinecraft().objectMouseOver.getBlockPos().offset( @@ -580,6 +530,7 @@ public class CustomItemEffects { ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); if(heldInternal != null) { + boolean onPrivateIsland = SBInfo.getInstance().getLocation() == null || SBInfo.getInstance().getLocation().equals("dynamic"); EntityPlayer player = event.player; double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)event.partialTicks; double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)event.partialTicks; @@ -600,41 +551,52 @@ public class CustomItemEffects { } if(usingEtherwarp) { - etherwarpRaycast = raycast(Minecraft.getMinecraft().thePlayer, 1f, 60, 0.1f); + int dist = 0; + for (String line : NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(held.getTagCompound())) { + String cleaned = Utils.cleanColour(line); + Matcher matcher = etherwarpDistancePattern.matcher(cleaned); + if (matcher.matches()) { + dist = Integer.parseInt(matcher.group("distance")); + break; + } + } + if (dist != 0) { + etherwarpRaycast = raycast(Minecraft.getMinecraft().thePlayer, 1f, dist, 0.1f); - if(etherwarpRaycast != null) { - AxisAlignedBB bb = etherwarpRaycast.state.getBlock().getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, etherwarpRaycast.pos) - .expand(0.01D, 0.01D, 0.01D).offset(-d0, -d1, -d2); - drawFilledBoundingBox(bb, 1f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); + if (etherwarpRaycast != null) { + AxisAlignedBB bb = etherwarpRaycast.state.getBlock().getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, etherwarpRaycast.pos) + .expand(0.01D, 0.01D, 0.01D).offset(-d0, -d1, -d2); + drawFilledBoundingBox(bb, 1f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); - GlStateManager.disableDepth(); - drawOutlineBoundingBox(bb, 2f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); - GlStateManager.enableDepth(); + GlStateManager.disableDepth(); + drawOutlineBoundingBox(bb, 2f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); + GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); + GlStateManager.depthMask(true); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); - if(NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { - float distFactor = 1 - (float)Math.sqrt(etherwarpRaycast.pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))/60; + if (NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { + float distFactor = 1 - (float) Math.sqrt(etherwarpRaycast.pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition())) / 60; - targetFOVMult = distFactor*distFactor*distFactor*0.75f + 0.25f; - if(targetFOVMult < 0.25f) targetFOVMult = 0.25f; + targetFOVMult = distFactor * distFactor * distFactor * 0.75f + 0.25f; + if (targetFOVMult < 0.25f) targetFOVMult = 0.25f; - targetSensMult = distFactor*0.76f + 0.25f; + targetSensMult = distFactor * 0.76f + 0.25f; + } + } else if (NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { + targetFOVMult = lastFOVMult; } - } else if(NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { - targetFOVMult = lastFOVMult; - } - return; + return; + } } } } if(heldInternal.equals("BLOCK_ZAPPER")) { - boolean privateIs = SBInfo.getInstance().getLocation() == null || SBInfo.getInstance().getLocation().equals("dynamic"); - if (!privateIs || !NotEnoughUpdates.INSTANCE.config.itemOverlays.enableZapperOverlay || + + if (!onPrivateIsland || !NotEnoughUpdates.INSTANCE.config.itemOverlays.enableZapperOverlay || event.target.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) { zapperBlocks.clear(); return; @@ -770,7 +732,7 @@ public class CustomItemEffects { GlStateManager.disableBlend(); } } else if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay) { - if(heldInternal.equals("BUILDERS_WAND")) { + if(heldInternal.equals("BUILDERS_WAND") && onPrivateIsland) { int maxBlocks = MAX_BUILDERS_BLOCKS; if (event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { IBlockState hover = Minecraft.getMinecraft().theWorld.getBlockState(event.target.getBlockPos().offset(event.target.sideHit, 1)); @@ -852,7 +814,7 @@ public class CustomItemEffects { GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); } - } else if((heldInternal.equals("WATER_BUCKET") || heldInternal.equals("MAGICAL_WATER_BUCKET")) && + } else if((heldInternal.equals("WATER_BUCKET") || heldInternal.equals("MAGICAL_WATER_BUCKET") && NotEnoughUpdates.INSTANCE.config.itemOverlays.enablePrismapumpOverlay && onPrivateIsland) && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { BlockPos hover = event.target.getBlockPos().offset(event.target.sideHit, 1); @@ -934,7 +896,7 @@ public class CustomItemEffects { GlStateManager.depthMask(true); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); - } else if((heldInternal.equals("HOE_OF_GREAT_TILLING") || heldInternal.equals("HOE_OF_GREATER_TILLING")) && + } else if((heldInternal.equals("HOE_OF_GREAT_TILLING") || heldInternal.equals("HOE_OF_GREATER_TILLING") && onPrivateIsland) && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { BlockPos target = event.target.getBlockPos(); IBlockState targetState = Minecraft.getMinecraft().theWorld.getBlockState(target); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java index 8e2874d3..ed4c8919 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java @@ -220,6 +220,9 @@ public class CustomSkulls implements IResourceManagerReloadListener { public boolean renderSkull(float xOffset, float yOffset, float zOffset, EnumFacing placedDirection, float rotationDeg, int skullType, GameProfile skullOwner, int damage) { + if(NotEnoughUpdates.INSTANCE.config.misc.disableSkullRetexturing) { + return false; + } if(placedDirection != EnumFacing.UP || skullType != 3) { return false; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java index 96f86c36..5c4fb61d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java @@ -1,6 +1,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.overlays.MiningOverlay; import io.github.moulberry.notenoughupdates.util.SBInfo; @@ -197,7 +198,7 @@ public class DwarvenMinesWaypoints { System.currentTimeMillis() - dynamicMillis < 30*1000) { for(Map.Entry<String, Vector3f> entry : waypointsMap.entrySet()) { if(entry.getKey().equals(dynamicLocation)) { - renderWayPoint(dynamicName, new Vector3f(entry.getValue()).translate(0, 15, 0), event.partialTicks); + RenderUtils.renderWayPoint(dynamicName, new Vector3f(entry.getValue()).translate(0, 15, 0), event.partialTicks); break; } } @@ -206,14 +207,14 @@ public class DwarvenMinesWaypoints { if(locWaypoint >= 1) { for(Map.Entry<String, Vector3f> entry : waypointsMap.entrySet()) { if(locWaypoint >= 2) { - renderWayPoint(EnumChatFormatting.AQUA+entry.getKey(), entry.getValue(), event.partialTicks); + RenderUtils.renderWayPoint(EnumChatFormatting.AQUA+entry.getKey(), entry.getValue(), event.partialTicks); } else { for(String commissionName : MiningOverlay.commissionProgress.keySet()) { if(commissionName.toLowerCase().contains(entry.getKey().toLowerCase())) { if(commissionName.contains("Titanium")) { - renderWayPoint(EnumChatFormatting.WHITE+entry.getKey(), entry.getValue(), event.partialTicks); + RenderUtils.renderWayPoint(EnumChatFormatting.WHITE+entry.getKey(), entry.getValue(), event.partialTicks); } else { - renderWayPoint(EnumChatFormatting.AQUA+entry.getKey(), entry.getValue(), event.partialTicks); + RenderUtils.renderWayPoint(EnumChatFormatting.AQUA+entry.getKey(), entry.getValue(), event.partialTicks); } } } @@ -247,7 +248,7 @@ public class DwarvenMinesWaypoints { double distSq = dX*dX + dY*dY + dZ*dZ; if(distSq >= 12*12) { - renderWayPoint(EnumChatFormatting.GOLD+emissary.name, + RenderUtils.renderWayPoint(EnumChatFormatting.GOLD+emissary.name, new Vector3f(emissary.loc).translate(0.5f, 2.488f, 0.5f), event.partialTicks); } @@ -258,81 +259,4 @@ public class DwarvenMinesWaypoints { } } - private void renderWayPoint(String str, Vector3f loc, float partialTicks) { - GlStateManager.alphaFunc(516, 0.1F); - - GlStateManager.pushMatrix(); - - Entity viewer = Minecraft.getMinecraft().getRenderViewEntity(); - double viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * partialTicks; - double viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * partialTicks; - double viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * partialTicks; - - double x = loc.x-viewerX+0.5f; - double y = loc.y-viewerY-viewer.getEyeHeight(); - double z = loc.z-viewerZ+0.5f; - - double distSq = x*x + y*y + z*z; - double dist = Math.sqrt(distSq); - if(distSq > 144) { - x *= 12/dist; - y *= 12/dist; - z *= 12/dist; - } - GlStateManager.translate(x, y, z); - GlStateManager.translate(0, viewer.getEyeHeight(), 0); - - renderNametag(str); - - GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); - GlStateManager.translate(0, -0.25f, 0); - GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); - GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); - - renderNametag(EnumChatFormatting.YELLOW.toString()+Math.round(dist)+"m"); - - GlStateManager.popMatrix(); - - GlStateManager.disableLighting(); - } - - private void renderNametag(String str) { - FontRenderer fontrenderer = Minecraft.getMinecraft().fontRendererObj; - float f = 1.6F; - float f1 = 0.016666668F * f; - GlStateManager.pushMatrix(); - GL11.glNormal3f(0.0F, 1.0F, 0.0F); - GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); - GlStateManager.scale(-f1, -f1, f1); - GlStateManager.disableLighting(); - GlStateManager.depthMask(false); - GlStateManager.disableDepth(); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - int i = 0; - - int j = fontrenderer.getStringWidth(str) / 2; - GlStateManager.disableTexture2D(); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); - worldrenderer.pos((double)(-j - 1), (double)(-1 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - worldrenderer.pos((double)(-j - 1), (double)(8 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - worldrenderer.pos((double)(j + 1), (double)(8 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - worldrenderer.pos((double)(j + 1), (double)(-1 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - tessellator.draw(); - GlStateManager.enableTexture2D(); - fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, i, 553648127); - GlStateManager.depthMask(true); - - fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, i, -1); - - GlStateManager.enableDepth(); - GlStateManager.enableBlend(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.popMatrix(); - } - } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java index 5fe5938b..05591e81 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java @@ -3,6 +3,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonObject; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.commands.SimpleCommand; import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.Constants; @@ -16,6 +17,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.command.ICommandSender; import net.minecraft.entity.Entity; import net.minecraft.util.*; +import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.world.WorldEvent; @@ -292,77 +294,87 @@ public class FairySouls { GlStateManager.enableDepth(); } + public static class FairySoulsCommandAlt extends SimpleCommand { + public FairySoulsCommandAlt() { + super("fairysouls", fairysoulRunnable); + } + } + public static class FairySoulsCommand extends SimpleCommand { public FairySoulsCommand() { - super("neusouls", new ProcessCommandRunnable() { - @Override - public void processCommand(ICommandSender sender, String[] args) { - if(args.length != 1) { - printHelp(); - return; + super("neusouls", fairysoulRunnable); + } + } + + private static SimpleCommand.ProcessCommandRunnable fairysoulRunnable = new SimpleCommand.ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + if(args.length != 1) { + printHelp(); + return; + } + String subcommand = args[0].toLowerCase(); + + switch (subcommand) { + case "help": + printHelp(); + return; + case "on": + case "enable": + print(EnumChatFormatting.DARK_PURPLE+"Enabled fairy soul waypoints"); + enabled = true; + return; + case "off": + case "disable": + print(EnumChatFormatting.DARK_PURPLE+"Disabled fairy soul waypoints"); + enabled = false; + return; + case "clear": { + String location = SBInfo.getInstance().getLocation(); + if(currentSoulList == null || location == null) { + print(EnumChatFormatting.RED+"No fairy souls found in your current world"); + } else { + Set<Integer> found = foundSouls.computeIfAbsent(location, k -> new HashSet<>()); + for(int i=0; i<currentSoulList.size(); i++) { + found.add(i); + } + print(EnumChatFormatting.DARK_PURPLE+"Marked all fairy souls as found"); } - String subcommand = args[0].toLowerCase(); - - switch (subcommand) { - case "help": - printHelp(); - return; - case "on": - case "enable": - print(EnumChatFormatting.DARK_PURPLE+"Enabled fairy soul waypoints"); - enabled = true; - return; - case "off": - case "disable": - print(EnumChatFormatting.DARK_PURPLE+"Disabled fairy soul waypoints"); - enabled = false; - return; - case "clear": { - String location = SBInfo.getInstance().getLocation(); - if(currentSoulList == null || location == null) { - print(EnumChatFormatting.RED+"No fairy souls found in your current world"); - } else { - Set<Integer> found = foundSouls.computeIfAbsent(location, k -> new HashSet<>()); - for(int i=0; i<currentSoulList.size(); i++) { - found.add(i); - } - print(EnumChatFormatting.DARK_PURPLE+"Marked all fairy souls as found"); - } - } - return; - case "unclear": - String location = SBInfo.getInstance().getLocation(); - if(location == null) { - print(EnumChatFormatting.RED+"No fairy souls found in your current world"); - } else { - print(EnumChatFormatting.DARK_PURPLE+"Marked all fairy souls as not found"); - foundSouls.remove(location); - } - return; + } + return; + case "unclear": + String location = SBInfo.getInstance().getLocation(); + if(location == null) { + print(EnumChatFormatting.RED+"No fairy souls found in your current world"); + } else { + print(EnumChatFormatting.DARK_PURPLE+"Marked all fairy souls as not found"); + foundSouls.remove(location); } + return; + } - print(EnumChatFormatting.RED+"Unknown subcommand: " + subcommand); - } - }); + print(EnumChatFormatting.RED+"Unknown subcommand: " + subcommand); } + }; - private static void print(String s) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(s)); - } + private static void print(String s) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(s)); + } - private static void printHelp() { - print(""); - print(EnumChatFormatting.DARK_PURPLE.toString()+EnumChatFormatting.BOLD+" NEU Fairy Soul Waypoint Guide"); - print(EnumChatFormatting.LIGHT_PURPLE+"Shows waypoints for every fairy soul in your world"); - print(EnumChatFormatting.LIGHT_PURPLE+"Clicking a fairy soul automatically removes it from the list"); - print(EnumChatFormatting.GOLD.toString()+EnumChatFormatting.BOLD+" Commands:"); - print(EnumChatFormatting.YELLOW+"/neusouls help - Display this message"); - print(EnumChatFormatting.YELLOW+"/neusouls on/off - Enable/disable the waypoint markers"); - print(EnumChatFormatting.YELLOW+"/neusouls clear/unclear - Marks every waypoint in your current world as completed/uncompleted"); - print(""); + private static void printHelp() { + print(""); + print(EnumChatFormatting.DARK_PURPLE.toString()+EnumChatFormatting.BOLD+" NEU Fairy Soul Waypoint Guide"); + print(EnumChatFormatting.LIGHT_PURPLE+"Shows waypoints for every fairy soul in your world"); + print(EnumChatFormatting.LIGHT_PURPLE+"Clicking a fairy soul automatically removes it from the list"); + if(!NotEnoughUpdates.INSTANCE.config.hidden.dev) { + print(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.OBFUSCATED + "Ab" + EnumChatFormatting.RESET + EnumChatFormatting.DARK_RED + "!" + EnumChatFormatting.RESET + EnumChatFormatting.RED + " This feature cannot and will not work in Dungeons. " + EnumChatFormatting.DARK_RED + "!" + EnumChatFormatting.OBFUSCATED + "Ab"); } - + print(EnumChatFormatting.GOLD.toString()+EnumChatFormatting.BOLD+" Commands:"); + print(EnumChatFormatting.YELLOW+"/neusouls help - Display this message"); + print(EnumChatFormatting.YELLOW+"/neusouls on/off - Enable/disable the waypoint markers"); + print(EnumChatFormatting.YELLOW+"/neusouls clear/unclear - Marks every waypoint in your current world as completed/uncompleted"); + print(""); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java index 59b3d802..053910bc 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java @@ -124,7 +124,7 @@ public class ItemCooldowns { } private static void updatePickaxeCooldown() { - if(pickaxeCooldown == -1) { + if(pickaxeCooldown == -1 && NotEnoughUpdates.INSTANCE.config.itemOverlays.pickaxeAbility) { for(ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) { if(stack != null && stack.hasTagCompound()) { String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack); @@ -148,7 +148,7 @@ public class ItemCooldowns { @SubscribeEvent public void onChatMessage(ClientChatReceivedEvent event) { - if(pickaxeCooldown != 0 && PICKAXE_ABILITY_REGEX.matcher(event.message.getFormattedText()).matches()) { + if(pickaxeCooldown != 0 && PICKAXE_ABILITY_REGEX.matcher(event.message.getFormattedText()).matches() && NotEnoughUpdates.INSTANCE.config.itemOverlays.pickaxeAbility) { updatePickaxeCooldown(); pickaxeUseCooldownMillisRemaining = pickaxeCooldown*1000; } 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 7769c274..29926628 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -554,7 +554,7 @@ public class PetInfoOverlay extends TextOverlay { public static Pet getPetFromStack(String name, String[] lore) { if(Constants.PETS == null || Constants.PETS.get("pet_levels") == null || Constants.PETS.get("pet_levels") instanceof JsonNull) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a7cInvalid PET constants. Please run /neuresetrepo and restart game in order to fix. If that doesn't fix it, please join discord.gg/moulberry and post in #neu-support-1")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a7cInvalid PET constants. Please run "+EnumChatFormatting.BOLD+"/neuresetrepo"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" and "+EnumChatFormatting.BOLD+"restart your game"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" in order to fix. "+EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD+"If that doesn't fix it"+EnumChatFormatting.RESET+EnumChatFormatting.RED+", please join discord.gg/moulberry and post in #neu-support")); return null; } @@ -1018,7 +1018,7 @@ public class PetInfoOverlay extends TextOverlay { JsonObject petsJson = Constants.PETS; if(currentPet != null && petsJson != null) { - currentPet.petLevel = GuiProfileViewer.getPetLevel(petsJson.get("pet_levels").getAsJsonArray(), currentPet.rarity.petOffset, currentPet.petLevel.totalXp); + currentPet.petLevel = GuiProfileViewer.getPetLevel(currentPet.petItem, currentPet.rarity.name(), currentPet.petLevel.totalXp); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java index 1925811d..7459c4a4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java @@ -26,6 +26,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; import org.apache.commons.lang3.tuple.Triple; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -78,6 +79,14 @@ public class SlotLocking { private boolean lockKeyHeld = false; private Slot pairingSlot = null; + private Slot realSlot = null; + + public void setRealSlot(Slot slot){ + realSlot = slot; + } + + public Slot getRealSlot(){ return realSlot;} + public void loadConfig(File file) { try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) { config = GSON.fromJson(reader, SlotLockingConfig.class); @@ -87,6 +96,35 @@ public class SlotLocking { } } + public void changedSlot(int slotNumber){ + int pingModifier = NotEnoughUpdates.INSTANCE.config.slotLocking.slotLockSwapDelay; + if(pingModifier == 0){ return; }; + if(!isSlotIndexLocked(slotNumber)){ return;} + long currentTimeMilis = System.currentTimeMillis(); + + for (int i = 0; i < slotChanges.length; i++) { + if(i != slotNumber && slotChanges[i] != 0 && (slotChanges[i] + (long) pingModifier) > currentTimeMilis){ + slotChanges[i] = 0; + } + } + slotChanges[slotNumber] = currentTimeMilis; + } + + public boolean isSwapedSlotLocked(){ + int pingModifier = NotEnoughUpdates.INSTANCE.config.slotLocking.slotLockSwapDelay; + if(pingModifier == 0){ return false; }; + long currentTimeMilis = System.currentTimeMillis(); + + for (int i = 0; i < slotChanges.length; i++) { + if (slotChanges[i] != 0 && isSlotIndexLocked(i) && (slotChanges[i] + (long) pingModifier) > currentTimeMilis) { + return true; + } + } + return false; + } + + private long[] slotChanges = new long[9]; + public void saveConfig(File file) { try { file.createNewFile(); @@ -271,6 +309,7 @@ public class SlotLocking { } public void toggleLock(int lockIndex) { + if(lockIndex == 8) return; LockedSlot[] lockedSlots = getDataForProfile(); if(lockedSlots != null) { @@ -381,7 +420,7 @@ public class SlotLocking { return; } else if(locked.locked || (clickType == 2 && SlotLocking.getInstance().isSlotIndexLocked(clickedButton))) { consumer.accept(null); - } else if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotBinding && clickType == 1) { + } else if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotBinding && clickType == 1 && locked.boundTo != -1) { GuiContainer container = (GuiContainer) Minecraft.getMinecraft().currentScreen; Slot boundSlot = container.inventorySlots.getSlotFromInventory(Minecraft.getMinecraft().thePlayer.inventory, locked.boundTo); @@ -576,5 +615,6 @@ public class SlotLocking { return locked != null && (locked.locked || (NotEnoughUpdates.INSTANCE.config.slotLocking.bindingAlsoLocks && locked.boundTo != -1)); } + } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java index 3253f08a..3a3aec6d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java @@ -166,6 +166,7 @@ public class StorageManager { public static class StorageConfig { public HashMap<String, StoragePage[]> pages = new HashMap<>(); public final HashMap<Integer, Integer> displayToStorageIdMap = new HashMap<>(); + public final HashMap<Integer, Integer> displayToStorageIdMapRender = new HashMap<>(); } public StorageConfig storageConfig = new StorageConfig(); @@ -387,6 +388,16 @@ public class StorageManager { return -1; } + public int getDisplayIdForStorageIdRender(int storageId) { + if(storageId < 0) return -1; + for(Map.Entry<Integer, Integer> entry : storageConfig.displayToStorageIdMapRender.entrySet()) { + if(entry.getValue() == storageId) { + return entry.getKey(); + } + } + return -1; + } + public boolean onAnyClick() { if(onStorageMenu && desiredStoragePage >= 0) { if(desiredStoragePage < 9) { @@ -444,7 +455,10 @@ public class StorageManager { } } else { StorageOverlay.getInstance().clearSearch(); + return; } + StorageOverlay.getInstance().fastRenderCheck(); + } public void closeWindowPacket(S2EPacketCloseWindow packet) { @@ -488,21 +502,22 @@ public class StorageManager { if(changed) { synchronized(storageConfig.displayToStorageIdMap) { storageConfig.displayToStorageIdMap.clear(); + storageConfig.displayToStorageIdMapRender.clear(); int displayIndex = 0; for(int i=0; i<storagePresent.length; i++) { if(storagePresent[i]) { - if(lastSearch == null || lastSearch.isEmpty()) { - storageConfig.displayToStorageIdMap.put(displayIndex++, i); - } else { + storageConfig.displayToStorageIdMap.put(displayIndex, i); + if(lastSearch != null && !lastSearch.isEmpty()){ StoragePage page = getPage(i, false); if(page != null) { updateSearchForPage(lastSearch, page); if(page.matchesSearch) { - storageConfig.displayToStorageIdMap.put(displayIndex++, i); + storageConfig.displayToStorageIdMapRender.put(displayIndex++, i); } } - } + } else + storageConfig.displayToStorageIdMapRender.put(displayIndex++, i); } } } @@ -527,21 +542,22 @@ public class StorageManager { if(changed) { synchronized(storageConfig.displayToStorageIdMap) { storageConfig.displayToStorageIdMap.clear(); + storageConfig.displayToStorageIdMapRender.clear(); int displayIndex = 0; for(int i=0; i<storagePresent.length; i++) { if(storagePresent[i]) { - if(lastSearch == null || lastSearch.isEmpty()) { - storageConfig.displayToStorageIdMap.put(displayIndex++, i); - } else { + storageConfig.displayToStorageIdMap.put(displayIndex, i); + if(lastSearch != null && !lastSearch.isEmpty()){ StoragePage page = getPage(i, false); if(page != null) { updateSearchForPage(lastSearch, page); if(page.matchesSearch) { - storageConfig.displayToStorageIdMap.put(displayIndex++, i); + storageConfig.displayToStorageIdMapRender.put(displayIndex++, i); } } - } + } else + storageConfig.displayToStorageIdMapRender.put(displayIndex++, i); } } } @@ -587,8 +603,8 @@ public class StorageManager { public void searchDisplay(String searchStr) { if(storagePresent == null) return; - synchronized(storageConfig.displayToStorageIdMap) { - storageConfig.displayToStorageIdMap.clear(); + synchronized(storageConfig.displayToStorageIdMapRender) { + storageConfig.displayToStorageIdMapRender.clear(); lastSearch = searchStr; int sid = searchId.incrementAndGet(); @@ -600,10 +616,10 @@ public class StorageManager { if(page.rows > 0) { updateSearchForPage(searchStr, page); if(page.matchesSearch) { - storageConfig.displayToStorageIdMap.put(displayIndex++, i); + storageConfig.displayToStorageIdMapRender.put(displayIndex++, i); } } else { - storageConfig.displayToStorageIdMap.put(displayIndex++, i); + storageConfig.displayToStorageIdMapRender.put(displayIndex++, i); page.matchesSearch = true; page.searchedId = sid; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java index b2d301a6..1b04ca88 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java @@ -582,13 +582,19 @@ public class AccessoryBagOverlay { return o1.compareTo(o2); }; } + private static boolean inAccessoryBag = false; + public static boolean isInAccessoryBag(){ + return inAccessoryBag; + } - public static void renderOverlay() { + public static void renderOverlay() { + inAccessoryBag = false; if(Minecraft.getMinecraft().currentScreen instanceof GuiChest && NEUEventListener.inventoryLoaded) { GuiChest eventGui = (GuiChest) Minecraft.getMinecraft().currentScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; String containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); if(containerName.trim().startsWith("Accessory Bag")) { + inAccessoryBag = true; try { int xSize = (int) Utils.getField(GuiContainer.class, eventGui, "xSize", "field_146999_f"); int ySize = (int) Utils.getField(GuiContainer.class, eventGui, "ySize", "field_147000_g"); @@ -873,9 +879,9 @@ public class AccessoryBagOverlay { return stats; } - private static String[] rarityArr = new String[] { - "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", - }; +// private static String[] rarityArr = new String[] { +// "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", "SUPREME" +// }; private static String[] rarityArrC = new String[] { EnumChatFormatting.WHITE+EnumChatFormatting.BOLD.toString()+"COMMON", EnumChatFormatting.GREEN+EnumChatFormatting.BOLD.toString()+"UNCOMMON", @@ -895,7 +901,7 @@ public class AccessoryBagOverlay { NBTTagList list = display.getTagList("Lore", 8); for (int i = list.tagCount()-1; i >= 0; i--) { String line = list.getStringTagAt(i); - for(String rarity : rarityArr) { + for(String rarity : Utils.rarityArr) { for(int j=0; j<typeMatches.length; j++) { if(contains) { if(line.trim().contains(rarity + " " + typeMatches[j])) { @@ -921,7 +927,7 @@ public class AccessoryBagOverlay { for(int i=lore.size()-1; i>=0; i--) { String line = lore.get(i).getAsString(); - for(String rarity : rarityArr) { + for(String rarity : Utils.rarityArr) { for(int j=0; j<typeMatches.length; j++) { if(line.trim().endsWith(rarity + " " + typeMatches[j])) { return j; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java index 381c8944..1b07ebdc 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java @@ -199,7 +199,8 @@ public class GuiCustomEnchant extends Gui { } public boolean shouldOverride(String containerName) { - if(true) { + + if(!NotEnoughUpdates.INSTANCE.config.hidden.dev) { shouldOverrideFast = false; return false; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java index df13b42a..c518afaa 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java @@ -2,11 +2,12 @@ package io.github.moulberry.notenoughupdates.miscgui; import com.google.common.base.Splitter; import com.google.common.collect.Lists; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; +import com.google.gson.*; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger; +import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField; +import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; @@ -19,19 +20,32 @@ import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; +import java.awt.*; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; +import java.util.Base64; import java.util.HashMap; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static io.github.moulberry.notenoughupdates.util.GuiTextures.button_tex; public class GuiEnchantColour extends GuiScreen { public static final ResourceLocation custom_ench_colour = new ResourceLocation("notenoughupdates:custom_ench_colour.png"); + private int guiLeft; private int guiTop; private final int xSize = 217; private int ySize = 0; + private int ySizeSidebar = 0; + private int guiTopSidebar; public static final Splitter splitter = Splitter.on(":").limit(5); @@ -40,14 +54,18 @@ public class GuiEnchantColour extends GuiScreen { private List<GuiElementTextField[]> guiElementTextFields = new ArrayList<>(); private List<String> enchantNamesPretty = null; + private JsonArray enchantPresets = null; private LerpingInteger scroll = new LerpingInteger(0, 100); + private LerpingInteger scrollSideBar = new LerpingInteger(0, 100); public static int BOLD_MODIFIER = 0b1; public static int ITALIC_MODIFIER = 0b10; public static int OBFUSCATED_MODIFIER = 0b100; public static int UNDERLINE_MODIFIER = 0b1000; public static int STRIKETHROUGH_MODIFIER = 0b10000; + private Gson gson = new Gson(); + private static final Pattern settingPattern = Pattern.compile(".*:[>=<]:[0-9]:[a-zA-Z0-9]:[0-9][0-9]?"); private List<String> getEnchantNamesPretty() { if(enchantNamesPretty == null) { @@ -79,14 +97,17 @@ public class GuiEnchantColour extends GuiScreen { ySize = 53+25*enchantColours.size(); guiLeft = (width-xSize)/2; + if(ySize > height) { - if(scroll.getTarget() > 0) { + + if (scroll.getTarget() > 0) { scroll.setTarget(0); - } else if(scroll.getTarget() < height-ySize) { - scroll.setTarget(height-ySize); + } else if (scroll.getTarget() < height - ySize) { + scroll.setTarget(height - ySize); } scroll.tick(); guiTop = scroll.getValue(); + } else { guiTop = (height-ySize)/2; scroll.setValue(0); @@ -105,6 +126,12 @@ public class GuiEnchantColour extends GuiScreen { Utils.drawStringCentered("Add Ench Colour", fontRendererObj, guiLeft+xSize/2+1, guiTop+ySize-20, false, 4210752); + //Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour); + +// Utils.drawTexturedRect(guiLeft+2, guiTop+ySize+2, 48, 16); +// Utils.drawTexturedRect(guiLeft+xSize-50, guiTop+ySize+2, 48, 16); + + int yIndex = 0; for(String str : enchantColours) { Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour); @@ -165,6 +192,85 @@ public class GuiEnchantColour extends GuiScreen { yIndex++; } + renderSideBar(mouseX, mouseY, partialTicks); + } + + private void renderSideBar(int mouseX, int mouseY, float partialTicks){ + //ySizeSidebar = 25*(enchantPresets.size()+2); +// enchantPresets = getEnchantPresetKeys(); + + + ySizeSidebar = 24*(2); + + + if(ySizeSidebar > height) { + + if (scrollSideBar.getTarget() > 0) { + scrollSideBar.setTarget(0); + } else if (scrollSideBar.getTarget() < height - ySizeSidebar) { + scrollSideBar.setTarget(height - ySizeSidebar); + } + + scrollSideBar.tick(); + guiTopSidebar = scrollSideBar.getValue(); + + } else { + guiTopSidebar = (height-ySizeSidebar)/2; + scrollSideBar.setValue(0); + scrollSideBar.resetTimer(); + } + + Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour); + GlStateManager.color(1, 1, 1, 1); + Utils.drawTexturedRect(guiLeft+xSize+3, guiTopSidebar+2, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); + Utils.drawTexturedRect(guiLeft+xSize+3, guiTopSidebar+2+24, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); + Utils.drawTexturedRect(guiLeft+xSize+3, guiTopSidebar+2+24*2, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); + Utils.drawStringCenteredScaledMaxWidth("Load preset from clipboard", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+12, false, 86, 4210752); + Utils.drawStringCenteredScaledMaxWidth("Save preset to clipboard", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+12+24, false, 86, 4210752); + Utils.drawStringCenteredScaledMaxWidth("Reset Config", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+12+24*2, false, 86, 4210752); + +// for (int i = 0; i < enchantPresets.size(); i++) { +// +// Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour); +// GlStateManager.color(1, 1, 1, 1); +// Utils.drawTexturedRect(guiLeft+xSize+3, guiTopSidebar+2+24*(i+2), 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); +// String text; +// +// text = "Test"; +// +//// { +//// JsonElement element = enchantPresets.get(i - 2); +//// if(element.isJsonObject()){ +//// JsonObject object = enchantPresets.get(i - 2).getAsJsonObject(); +//// if(object.has("NAME")){ +//// JsonElement nameobject = object.get("NAME"); +//// if(nameobject.isJsonPrimitive()){ +//// text = nameobject.getAsJsonPrimitive().getAsString(); +//// break; +//// } +//// } +//// } +//// text = "ERROR"; +//// } +//// break; +// +// Utils.drawStringCenteredScaledMaxWidth(text, fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+12+24*i, false, 86, 4210752); +// } + + + } + + private JsonArray getEnchantPresetKeys(){ + return new JsonArray(); +// if(enchantPresets == null) { +// JsonObject enchantsJson = Constants.ENCHANTS; +// if(!enchantsJson.has("enchants_pretty")) { +// return new JsonArray(); +// } else { +// JsonArray pretty = enchantsJson.getAsJsonArray("enchants_pretty"); +// } +// } +// return enchantPresets; } @Override @@ -218,14 +324,25 @@ public class GuiEnchantColour extends GuiScreen { super.handleMouseInput(); int dWheel = Mouse.getEventDWheel(); - - if(dWheel < 0) { - scroll.setTarget(scroll.getTarget()-50); - scroll.resetTimer(); - } else if(dWheel > 0) { - scroll.setTarget(scroll.getTarget()+50); - scroll.resetTimer(); + int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth; + if(mouseX > guiLeft && mouseX < guiLeft + xSize) { + if (dWheel < 0) { + scroll.setTarget(scroll.getTarget() - 50); + scroll.resetTimer(); + } else if (dWheel > 0) { + scroll.setTarget(scroll.getTarget() + 50); + scroll.resetTimer(); + } + } else if(mouseX > guiLeft+xSize && mouseX < guiLeft + xSize+ 100) { + if (dWheel < 0) { + scrollSideBar.setTarget(scrollSideBar.getTarget() - 50); + scrollSideBar.resetTimer(); + } else if (dWheel > 0) { + scrollSideBar.setTarget(scrollSideBar.getTarget() + 50); + scrollSideBar.resetTimer(); + } } + } public static int getIntModifier(String modifier) { @@ -320,6 +437,93 @@ public class GuiEnchantColour extends GuiScreen { NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.add("[a-zA-Z\\- ]+:>:5:9:0"); } } +// System.out.println("Hit Mouse X: "+mouseX+ " Mouse Y: "+mouseY); +// System.out.println("guileft: "+ (guiLeft+xSize+3)+ " Gui Right: "+ (guiLeft+xSize+3+88)); + if(mouseX > guiLeft+xSize+3 && mouseX< guiLeft+xSize+3+88){ + if(mouseY > guiTopSidebar+2 && mouseY < guiTopSidebar+20+2){ + +// String result = NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.toString(); +// String base64String = Base64.getEncoder().encodeToString(result.getBytes(StandardCharsets.UTF_8)); + + String base64; + + try { + base64 = (String)Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor); + } catch (HeadlessException | IOException | UnsupportedFlavorException e) { + return; + } + String jsonString; + try { + jsonString = new String(Base64.getDecoder().decode(base64)); + } catch (IllegalArgumentException e){ + return; + + } + JsonArray presetArray; + try{ + presetArray = new JsonParser().parse(jsonString).getAsJsonArray(); + } catch (IllegalStateException | JsonParseException e){ + return; + } + ArrayList<String> presetList = new ArrayList<>(); + + + for (int i = 0; i < presetArray.size(); i++) { + if (presetArray.get(i).isJsonPrimitive()) { + String test = presetArray.get(i).getAsString(); + Matcher matcher = settingPattern.matcher(test); + if(matcher.matches()) { + presetList.add(presetArray.get(i).getAsString()); + } + } + } + if(presetList.size() != 0) { + NotEnoughUpdates.INSTANCE.config.hidden.enchantColours = presetList; + } + + + } else if(mouseY > guiTopSidebar+2+24 && mouseY < guiTopSidebar+20+24+2){ + + ArrayList<String> result = NotEnoughUpdates.INSTANCE.config.hidden.enchantColours; + JsonArray jsonArray = new JsonArray(); + + for (int i = 0; i < result.size(); i++) { + jsonArray.add(new JsonPrimitive(result.get(i))); + } + String base64String = Base64.getEncoder().encodeToString(jsonArray.toString().getBytes(StandardCharsets.UTF_8)); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(base64String), null); + } else if(mouseY > guiTopSidebar+2+(24*2) && mouseY < guiTopSidebar+20+2+24*2){ + NotEnoughUpdates.INSTANCE.config.hidden.enchantColours = NEUConfig.createDefaultEnchantColours(); + } + +// for(int sidebarYIndex=0; sidebarYIndex<enchantPresets.size(); sidebarYIndex++) { +// +// ; +// +// if(mouseY > guiTopSidebar+50+25*sidebarYIndex && mouseY < guiTopSidebar+50+25+25*sidebarYIndex) { +// +// if(mouseButton == 0) { +// +// JsonElement element = enchantPresets.get(sidebarYIndex - 2); +// if (element.isJsonObject()) { +// JsonObject object = enchantPresets.get(sidebarYIndex - 2).getAsJsonObject(); +// if (object.has("SETTINGS")) { +// JsonElement settingsElement = object.get("SETTINGS"); +// if (settingsElement.isJsonArray()) { +// JsonArray newEnchantColours = settingsElement.getAsJsonArray(); +// +// ArrayList<String> tempEnchantColours = new ArrayList<>(); +// for (int i = 0; i < newEnchantColours.size(); i++) { +// tempEnchantColours.add(newEnchantColours.get(i).getAsString()); +// } +// NotEnoughUpdates.INSTANCE.config.hidden.enchantColours = tempEnchantColours; +// } +// } +// } +// } +// } +// } + } } public static String getColourOpIndex(List<String> colourOps, int index) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java index 1260dbd2..02f64f82 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java @@ -1,8 +1,6 @@ package io.github.moulberry.notenoughupdates.miscgui; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; +import com.google.gson.*; import com.google.gson.annotations.Expose; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.GlScissorStack; @@ -25,15 +23,22 @@ import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; +import java.awt.*; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.UnsupportedFlavorException; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.*; +import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicInteger; +import static io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour.custom_ench_colour; + public class GuiInvButtonEditor extends GuiScreen { private static final ResourceLocation INVENTORY = new ResourceLocation("minecraft:textures/gui/container/inventory.png"); @@ -284,6 +289,13 @@ public class GuiInvButtonEditor extends GuiScreen { fontRendererObj.drawString("+", x+6, y+5, 0xffcccccc); } } + Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour); + GlStateManager.color(1, 1, 1, 1); + Utils.drawTexturedRect(guiLeft-88-2-22, guiTop+2, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); + Utils.drawTexturedRect(guiLeft-88-2-22, guiTop+2+24, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); + Utils.drawStringCenteredScaledMaxWidth("Load preset from clipboard", fontRendererObj, guiLeft-44-2-22, guiTop+12, false, 86, 4210752); + Utils.drawStringCenteredScaledMaxWidth("Save preset to clipboard", fontRendererObj, guiLeft-44-2-22, guiTop+12+24, false, 86, 4210752); + GlStateManager.color(1, 1, 1, 1); if(presets != null) { Minecraft.getMinecraft().getTextureManager().bindTexture(EDITOR); @@ -557,6 +569,72 @@ public class GuiInvButtonEditor extends GuiScreen { } } + if(mouseX > guiLeft-2-88-22 && mouseX< guiLeft-2-22) { + if (mouseY > guiTop + 2 && mouseY < guiTop + 22) { + +// String result = NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.toString(); +// String base64String = Base64.getEncoder().encodeToString(result.getBytes(StandardCharsets.UTF_8)); + + String base64; + + try { + base64 = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor); + } catch (HeadlessException | IOException | UnsupportedFlavorException e) { + return; + } + String jsonString; + try { + jsonString = new String(Base64.getDecoder().decode(base64)); + } catch (IllegalArgumentException e) { + return; + + } + JsonArray presetArray; + try { + presetArray = new JsonParser().parse(jsonString).getAsJsonArray(); + } catch (IllegalStateException | JsonParseException e) { + return; + } + + + List<NEUConfig.InventoryButton> buttons = new ArrayList<>(); + System.out.println(presetArray.size()); + try { + for (int i = 0; i < presetArray.size(); i++) { + + + JsonElement shittyO = presetArray.get(i); + JsonElement lessShittyO = new JsonParser().parse(shittyO.getAsString()); + if (lessShittyO.isJsonObject()) { + JsonObject o = lessShittyO.getAsJsonObject(); + NEUConfig.InventoryButton button = NotEnoughUpdates.INSTANCE.manager.gson.fromJson(o, NEUConfig.InventoryButton.class); + buttons.add(button); + } + + } + + NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons = buttons; + return; + } catch(JsonParseException | ClassCastException | IllegalStateException e){ + return; + } + + + } else if (mouseY > guiTop + 26 && mouseY < guiTop + 26 + 20) { + + List<NEUConfig.InventoryButton> result = NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons; + JsonArray jsonArray = new JsonArray(); + + for (int i = 0; i < result.size(); i++) { + + jsonArray.add(new JsonPrimitive(NotEnoughUpdates.INSTANCE.manager.gson.toJson(result.get(i), NEUConfig.InventoryButton.class))); + } + String base64String = Base64.getEncoder().encodeToString(jsonArray.toString().getBytes(StandardCharsets.UTF_8)); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(base64String), null); + return; + } + } + if(editingButton == null) { int index = 0; for(List<NEUConfig.InventoryButton> buttons : presets.values()) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java index 21d1018d..fb0deaaf 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java @@ -68,7 +68,7 @@ public class GuiItemCustomize extends GuiScreen { this.enchantGlint = stackHasEffect; } - supportCustomLeatherColour = stack.getItem() instanceof ItemArmor && ((ItemArmor)stack.getItem()).hasColor(stack); + supportCustomLeatherColour = stack.getItem() instanceof ItemArmor && ((ItemArmor) stack.getItem()).getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER; enchantGlintCustomColourAnimation.setValue(enchantGlint ? 17 : 0); this.enchantGlintButton = new GuiElementBoolean(0, 0, enchantGlint, (bool) -> { @@ -215,6 +215,7 @@ public class GuiItemCustomize extends GuiScreen { EnumChatFormatting.LIGHT_PURPLE+"\u00B6d = Purple", EnumChatFormatting.YELLOW+"\u00B6e = Yellow", EnumChatFormatting.WHITE+"\u00B6f = White", + "\u00A7Z\u00B6Z = SBA Chroma"+EnumChatFormatting.RESET+EnumChatFormatting.GRAY+" (Requires SBA)", "", EnumChatFormatting.GREEN+"Available formatting codes:", EnumChatFormatting.GRAY+"\u00B6k = "+EnumChatFormatting.OBFUSCATED+"Obfuscated", diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/HelpGUI.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/HelpGUI.java deleted file mode 100644 index cc41a76f..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/HelpGUI.java +++ /dev/null @@ -1,189 +0,0 @@ -package io.github.moulberry.notenoughupdates.miscgui; - -import io.github.moulberry.notenoughupdates.util.TexLoc; -import io.github.moulberry.notenoughupdates.util.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.input.Keyboard; -import org.lwjgl.util.vector.Vector2f; - -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class HelpGUI extends GuiScreen { - - private int guiLeft = 0; - private int guiTop = 0; - private int sizeX = 0; - private int sizeY = 0; - - private int page = 0; - private ResourceLocation screenshotBorder = new ResourceLocation("notenoughupdates:ss_border.jpg"); - private ResourceLocation[] screenshots = null; - - int scaleFactor = 0; - - @Override - public void setWorldAndResolution(Minecraft mc, int width, int height) { - super.setWorldAndResolution(mc, width, height); - - screenshots = new ResourceLocation[18]; - for(int i=0; i<=17; i++) { - screenshots[i] = new ResourceLocation("notenoughupdates:ss_small/ss"+(i+1)+"-0.jpg"); - } - } - - @Override - protected void keyTyped(char typedChar, int keyCode) throws IOException { - Keyboard.enableRepeatEvents(true); - super.keyTyped(typedChar, keyCode); - if(keyCode == Keyboard.KEY_LEFT) { - page--; - } else if(keyCode == Keyboard.KEY_RIGHT) { - page++; - } - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawScreen(mouseX, mouseY, partialTicks); - - drawDefaultBackground(); - - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - scaleFactor = scaledResolution.getScaleFactor(); - - sizeX = width/2+40/scaleFactor; - sizeY = height/2+40/scaleFactor; - guiLeft = width/4-20/scaleFactor; - guiTop = height/4-20/scaleFactor; - - Minecraft.getMinecraft().getTextureManager().bindTexture(screenshotBorder); - Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY); - - page = Math.max(0, Math.min(17, page)); - - Minecraft.getMinecraft().getTextureManager().bindTexture(screenshots[page]); - Utils.drawTexturedRect(guiLeft+20f/scaleFactor, guiTop+20f/scaleFactor, sizeX-40f/scaleFactor, sizeY-40f/scaleFactor); - - Utils.drawStringCentered(EnumChatFormatting.GOLD+"NEU Tutorial - Page "+(page+1)+"/18 - Use arrow keys", Minecraft.getMinecraft().fontRendererObj, - width/2, guiTop+8, true, 0); - if(scaleFactor != 2) Utils.drawStringCentered(EnumChatFormatting.GOLD+"Use GUI Scale normal for better reading experience", Minecraft.getMinecraft().fontRendererObj, - width/2, guiTop+18, true, 0); - - for(Map.Entry<Vector2f, List<String>> entry : texts[page].entrySet()) { - Vector2f location = entry.getKey(); - List<String> text = entry.getValue(); - - float x = guiLeft+20f/scaleFactor+(sizeX-40f/scaleFactor)*location.x; - float y = guiTop+20f/scaleFactor+(sizeY-40f/scaleFactor)*location.y; - - Utils.drawHoveringText(text, (int)x, (int)y+12, 100000, 100000, 200, Minecraft.getMinecraft().fontRendererObj); - } - } - - - private static HashMap<Vector2f, List<String>>[] texts = new HashMap[18]; - static { - for(int i=0; i<18; i++) { - texts[i] = new HashMap<>(); - } - texts[0].put(new Vector2f(0.73f, 0.60f), Utils.createList( - EnumChatFormatting.GOLD+"Itemlist", - EnumChatFormatting.GRAY+"Here you will find a list of (most) skyblock items", - EnumChatFormatting.GRAY+"The itemlist can be accessed by opening your inventory or most menus while on skyblock")); - texts[1].put(new Vector2f(0.73f, 0.16f), Utils.createList( - EnumChatFormatting.GOLD+"Itemlist", - EnumChatFormatting.GRAY+"These are the page controls for the itemlist", - EnumChatFormatting.GRAY+"Clicking these controls will bring you to other pages of the itemlist")); - texts[2].put(new Vector2f(0.73f, 1.05f), Utils.createList( - EnumChatFormatting.GOLD+"Itemlist", - EnumChatFormatting.GRAY+"These are the sorting controls for the itemlist", - EnumChatFormatting.GRAY+"The buttons on the left control the ordering of the items", - EnumChatFormatting.GRAY+"The buttons on the right can be used to filter a certain type of item")); - texts[3].put(new Vector2f(0.39f, 1.04f), Utils.createList( - EnumChatFormatting.GOLD+"Itemlist", - EnumChatFormatting.GRAY+"This is the search bar for the itemlist", - EnumChatFormatting.GRAY+"Double-click the bar to enable inventory search mode", - EnumChatFormatting.GRAY+"The button on the left opens up the mod settings", - EnumChatFormatting.GRAY+"The button on the right displays this tutorial")); - texts[4].put(new Vector2f(0.39f, 0.99f), Utils.createList( - EnumChatFormatting.GOLD+"QuickCommands", - EnumChatFormatting.GRAY+"These are the QuickCommands", - EnumChatFormatting.GRAY+"They let you warp around or access certain menus more easily")); - texts[5].put(new Vector2f(0.7f, 0.71f), Utils.createList( - EnumChatFormatting.GOLD+"Itemlist", - EnumChatFormatting.GRAY+"Hover over an item in the list to display it's lore", - EnumChatFormatting.GRAY+"Left clicking some items will display the recipe for that item", - EnumChatFormatting.GRAY+"Right clicking some items will display a wiki page for that item", - EnumChatFormatting.GRAY+"'F' will favourite an item, putting it to the top of the itemlist")); - texts[6].put(new Vector2f(0.17f, 0.21f), Utils.createList( - EnumChatFormatting.GOLD+"Collection Log", - EnumChatFormatting.GRAY+"This is the collection log. It can be accessed using the /neucl command, or via the QuickCommand", - EnumChatFormatting.GRAY+"The collection log keeps track of all items that enter your inventory while you are playing skyblock", - EnumChatFormatting.GRAY+"If you are a completionist, this feature is for you")); - texts[7].put(new Vector2f(0.05f, 0.13f), Utils.createList( - EnumChatFormatting.GOLD+"Collection Log", - EnumChatFormatting.GRAY+"Clicking on 'Filter' will change the items that", - EnumChatFormatting.GRAY+"appear in the list")); - texts[8].put(new Vector2f(0.35f, 0.74f), Utils.createList( - EnumChatFormatting.GOLD+"NeuAH", - EnumChatFormatting.GRAY+"This is the NEU Auction House (NeuAH)", - EnumChatFormatting.GRAY+"This AH can be accessed from anywhere using the /neuah command, or via the QuickCommand", - EnumChatFormatting.GRAY+"The items here refresh automatically, so there is no need to close the GUI to see the latest auctions", - EnumChatFormatting.GRAY+"Sometimes, you might have to wait until the list is populated with items from the API")); - texts[9].put(new Vector2f(0.41f, 0.40f), Utils.createList( - EnumChatFormatting.GOLD+"NeuAH", - EnumChatFormatting.GRAY+"These tabs control the items that appear in NeuAH", - EnumChatFormatting.GRAY+"You can find the main categories on the top of the GUI and subcategories appear on the side of the GUI once a main category is selected")); - texts[10].put(new Vector2f(0.57f, 0.38f), Utils.createList( - EnumChatFormatting.GOLD+"NeuAH", - EnumChatFormatting.GRAY+"Search for items using the search bar at the top", - EnumChatFormatting.GRAY+"Boolean operators such as &, | or ! work here.")); - texts[10].put(new Vector2f(0.40f, 0.72f), Utils.createList( - EnumChatFormatting.GOLD+"NeuAH", - EnumChatFormatting.GRAY+"This toolbar contains many useful features", - EnumChatFormatting.GRAY+"which control the sorting and ordering of", - EnumChatFormatting.GRAY+"the auction house, similar to the normal AH")); - texts[11].put(new Vector2f(0.55f, 0.72f), Utils.createList( - EnumChatFormatting.GOLD+"NeuAH", - EnumChatFormatting.GRAY+"Clicking on an item will bring up the auction view", - EnumChatFormatting.GRAY+"Here you can viewer the buyer/seller and place bids or make purchases", - EnumChatFormatting.GRAY+"Trying to purchase an item will result in a confirmation GUI similar to the normal AH")); - texts[12].put(new Vector2f(0.28f, 0.82f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"Access the profile viewer using /neuprofile (ign) or /pv (ign)", - EnumChatFormatting.GRAY+"This is the main page of the profile viewer", - EnumChatFormatting.GRAY+"This page contains basic information like stats and skill levels")); - texts[12].put(new Vector2f(0.72f, 0.55f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"Click the button on the left to switch profiles and use the bar on the right to switch players")); - texts[13].put(new Vector2f(0.28f, 0.82f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"This is the extra info page of the profile viewer", - EnumChatFormatting.GRAY+"This page contains all the small bits of information about a player that don't fit anywhere else")); - texts[14].put(new Vector2f(0.28f, 0.82f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"This is the inventories page of the profile viewer", - EnumChatFormatting.GRAY+"Click on the inventory icons in the top-left or use your keyboard to switch the inventory type", - EnumChatFormatting.GRAY+"The bar on the bottom-left searches the current inventory for matching items")); - texts[15].put(new Vector2f(0.28f, 0.82f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"This is the collections page of the profile viewer", - EnumChatFormatting.GRAY+"Click on the icons on the left or use the keyboard shortcut to switch collection type")); - texts[16].put(new Vector2f(0.28f, 0.82f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"This is the pets page of the profile viewer", - EnumChatFormatting.GRAY+"Click to select the pet on the left", - EnumChatFormatting.GRAY+"The selected pet's stats will display on the right")); - texts[17].put(new Vector2f(0.27f, 0.40f), Utils.createList( - EnumChatFormatting.GOLD+"Overlay", - EnumChatFormatting.GRAY+"Rearrange certain GUI elements of the main overlay using /neuoverlay", - EnumChatFormatting.GRAY+"If you accidentally move them off screen, use the button in the top left to reset the GUI")); - } -} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java index 5d841885..d80a5daf 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -1,6 +1,7 @@ package io.github.moulberry.notenoughupdates.miscgui; import com.google.common.collect.Lists; +import io.github.moulberry.notenoughupdates.NEUEventListener; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.*; import io.github.moulberry.notenoughupdates.core.config.KeybindHelper; @@ -28,6 +29,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; + import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; @@ -36,6 +38,7 @@ import org.lwjgl.util.vector.Vector2f; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.awt.*; + import java.util.*; import java.util.List; @@ -92,6 +95,8 @@ public class StorageOverlay extends GuiElement { private int guiLeft; private int guiTop; + private boolean fastRender = false; + private int loadCircleIndex = 0; private int rollIndex = 0; private int loadCircleRotation = 0; @@ -120,12 +125,12 @@ public class StorageOverlay extends GuiElement { private LerpingInteger scroll = new LerpingInteger(0, 200); private int getMaximumScroll() { - synchronized(StorageManager.getInstance().storageConfig.displayToStorageIdMap) { + synchronized(StorageManager.getInstance().storageConfig.displayToStorageIdMapRender) { int maxH = 0; for(int i=0; i<3; i++) { - int lastDisplayId = StorageManager.getInstance().storageConfig.displayToStorageIdMap.size()-1; + int lastDisplayId = StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.size()-1; int coords = (int)Math.ceil(lastDisplayId/3f)*3+1+i; int h = getPageCoords(coords).y+scroll.getValue()-getStorageViewSize()-14; @@ -300,8 +305,8 @@ public class StorageOverlay extends GuiElement { int startY = getPageCoords(0).y; if(OpenGlHelper.isFramebufferEnabled()) { int h; - synchronized(StorageManager.getInstance().storageConfig.displayToStorageIdMap) { - int lastDisplayId = StorageManager.getInstance().storageConfig.displayToStorageIdMap.size()-1; + synchronized(StorageManager.getInstance().storageConfig.displayToStorageIdMapRender) { + int lastDisplayId = StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.size()-1; int coords = (int)Math.ceil(lastDisplayId/3f)*3+3; h = getPageCoords(coords).y+scroll.getValue(); @@ -358,7 +363,7 @@ public class StorageOverlay extends GuiElement { if(doItemRender) { enchantGlintRenderLocations.clear(); - for(Map.Entry<Integer, Integer> entry : StorageManager.getInstance().storageConfig.displayToStorageIdMap.entrySet()) { + for(Map.Entry<Integer, Integer> entry : StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.entrySet()) { int displayId = entry.getKey(); int storageId = entry.getValue(); @@ -578,7 +583,7 @@ public class StorageOverlay extends GuiElement { } GlScissorStack.push(0, guiTop+3, width, guiTop+3+storageViewSize, scaledResolution); - for(Map.Entry<Integer, Integer> entry : StorageManager.getInstance().storageConfig.displayToStorageIdMap.entrySet()) { + for(Map.Entry<Integer, Integer> entry : StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.entrySet()) { int displayId = entry.getKey(); int storageId = entry.getValue(); @@ -589,14 +594,14 @@ public class StorageOverlay extends GuiElement { if(coords.y-11 > 3+storageViewSize || coords.y+90 < 3) continue; StorageManager.StoragePage page = StorageManager.getInstance().getPage(storageId, false); - + if(editingNameId == storageId) { int len = fontRendererObj.getStringWidth(renameStorageField.getTextDisplay())+10; renameStorageField.setSize(len, 12); renameStorageField.render(storageX, storageY-13); } else { String pageTitle; - if(page.customTitle != null && !page.customTitle.isEmpty()) { + if(page != null && page.customTitle != null && !page.customTitle.isEmpty()) { pageTitle = Utils.chromaStringByColourCode(page.customTitle); } else if(entry.getValue() < 9) { pageTitle = "Ender Chest Page " + (entry.getValue() + 1); @@ -948,6 +953,10 @@ public class StorageOverlay extends GuiElement { } GlScissorStack.pop(scaledResolution); + if(fastRender){ + fontRendererObj.drawString("Fast render does not work with Storage overlay.", sizeX/2-fontRendererObj.getStringWidth("Fast render does not work with Storage overlay.")/2, -10, 0xFFFF0000); + } + //Inventory Text fontRendererObj.drawString("Inventory", 180, storageViewSize+6, textColour); searchBar.setCustomTextColour(searchTextColour); @@ -1418,10 +1427,10 @@ public class StorageOverlay extends GuiElement { for(int j=i; j<i+3; j++) { if(NotEnoughUpdates.INSTANCE.config.storageGUI.masonryMode && displayId%3 != j%3) continue; - if(!StorageManager.getInstance().storageConfig.displayToStorageIdMap.containsKey(j)) { + if(!StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.containsKey(j)) { continue; } - int storageId = StorageManager.getInstance().storageConfig.displayToStorageIdMap.get(j); + int storageId = StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.get(j); StorageManager.StoragePage page = StorageManager.getInstance().getPage(storageId, false); if(page == null || page.rows <= 0) { maxRows = Math.max(maxRows, 3); @@ -1534,13 +1543,14 @@ public class StorageOverlay extends GuiElement { if(mouseX > guiLeft+181 && mouseX < guiLeft+181+162 && mouseY > guiTop+storageViewSize+18 && mouseY < guiTop+storageViewSize+94) { + if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + dirty = true; return false; } if(mouseY > guiTop+3 && mouseY < guiTop+storageViewSize+3) { int currentPage = StorageManager.getInstance().getCurrentPageId(); - - for(Map.Entry<Integer, Integer> entry : StorageManager.getInstance().storageConfig.displayToStorageIdMap.entrySet()) { + for(Map.Entry<Integer, Integer> entry : StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.entrySet()) { IntPair pageCoords = getPageCoords(entry.getKey()); if(pageCoords.y > storageViewSize+3 || pageCoords.y+90 < 3) continue; @@ -1695,7 +1705,7 @@ public class StorageOverlay extends GuiElement { } else if(Mouse.getEventButtonState() && Mouse.getEventButton() == 0) { for(int i=0; i<9; i++) { int storageId = i; - int displayId = StorageManager.getInstance().getDisplayIdForStorageId(i); + int displayId = StorageManager.getInstance().getDisplayIdForStorageIdRender(i); StorageManager.StoragePage page = StorageManager.getInstance().getPage(storageId, false); if(page != null) { @@ -1712,7 +1722,7 @@ public class StorageOverlay extends GuiElement { } for(int i=0; i<18; i++) { int storageId = i+StorageManager.MAX_ENDER_CHEST_PAGES; - int displayId = StorageManager.getInstance().getDisplayIdForStorageId(i); + int displayId = StorageManager.getInstance().getDisplayIdForStorageIdRender(i); StorageManager.StoragePage page = StorageManager.getInstance().getPage(storageId, false); if(page != null) { @@ -1795,7 +1805,7 @@ public class StorageOverlay extends GuiElement { } } else { int currentPage = StorageManager.getInstance().getCurrentPageId(); - int displayId = StorageManager.getInstance().getDisplayIdForStorageId(currentPage); + int displayId = StorageManager.getInstance().getDisplayIdForStorageIdRender(currentPage); if(displayId >= 0) { IntPair pageCoords = getPageCoords(displayId); @@ -1845,7 +1855,7 @@ public class StorageOverlay extends GuiElement { if(Keyboard.getEventKeyState()) { if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotLocking && - KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.slotLocking.slotLockKey)) { + KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.slotLocking.slotLockKey) && !searchBar.getFocus()) { if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) return true; GuiContainer container = (GuiContainer) Minecraft.getMinecraft().currentScreen; @@ -1957,4 +1967,21 @@ public class StorageOverlay extends GuiElement { GlStateManager.bindTexture(0); } + public void fastRenderCheck(){ + if(!OpenGlHelper.isFramebufferEnabled()) { + this.fastRender = true; + NEUEventListener.displayNotification(Lists.newArrayList( + "\u00a74Fast Render Warning", + "\u00a77Due to the way fast render works, it's not compatible with NEU.", + "\u00a77Please disable fast render in your options under", + "\u00a77ESC > Options > Video Settings > Performance > Fast Render", + "\u00a77This can't be fixed.", + "\u00a77", + "\u00a77Press X on your keyboard to close this notifcation"), true, true); + return; + } + + this.fastRender = false; + } + } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuConfigTutorial.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuConfigTutorial.java new file mode 100644 index 00000000..c4d0115f --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuConfigTutorial.java @@ -0,0 +1,9 @@ +package io.github.moulberry.notenoughupdates.miscgui.tutorials; + +public class NeuConfigTutorial extends TutorialBase { + + static { + title = "NEU Config Tutorial"; + } + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuTutorial.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuTutorial.java new file mode 100644 index 00000000..454c8788 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuTutorial.java @@ -0,0 +1,127 @@ +package io.github.moulberry.notenoughupdates.miscgui.tutorials; + +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.util.vector.Vector2f; + +import java.util.ArrayList; +import java.util.HashMap; + +public class NeuTutorial extends TutorialBase { + + static { + title = "NEU Tutorial"; + } + + @Override + public void setWorldAndResolution(Minecraft mc, int width, int height) { + super.setWorldAndResolution(mc, width, height); + screenshots = new ResourceLocation[18]; + for (int i = 0; i <= 17; i++) { + screenshots[i] = new ResourceLocation("notenoughupdates:ss_small/ss" + (i + 1) + "-0.jpg"); + } + } + +// static { +// +// texts[0].put(new Vector2f(0.73f, 0.60f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"Here you will find a list of (most) skyblock items", +// EnumChatFormatting.GRAY+"The itemlist can be accessed by opening your inventory or most menus while on skyblock")); +// texts[1].put(new Vector2f(0.73f, 0.16f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"These are the page controls for the itemlist", +// EnumChatFormatting.GRAY+"Clicking these controls will bring you to other pages of the itemlist")); +// texts[2].put(new Vector2f(0.73f, 1.05f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"These are the sorting controls for the itemlist", +// EnumChatFormatting.GRAY+"The buttons on the left control the ordering of the items", +// EnumChatFormatting.GRAY+"The buttons on the right can be used to filter a certain type of item")); +// texts[3].put(new Vector2f(0.39f, 1.04f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"This is the search bar for the itemlist", +// EnumChatFormatting.GRAY+"Double-click the bar to enable inventory search mode", +// EnumChatFormatting.GRAY+"The button on the left opens up the mod settings", +// EnumChatFormatting.GRAY+"The button on the right displays this tutorial")); +// texts[4].put(new Vector2f(0.39f, 0.99f), Utils.createList( +// EnumChatFormatting.GOLD+"QuickCommands", +// EnumChatFormatting.GRAY+"These are the QuickCommands", +// EnumChatFormatting.GRAY+"They let you warp around or access certain menus more easily")); +// texts[5].put(new Vector2f(0.7f, 0.71f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"Hover over an item in the list to display it's lore", +// EnumChatFormatting.GRAY+"Left clicking some items will display the recipe for that item", +// EnumChatFormatting.GRAY+"Right clicking some items will display a wiki page for that item", +// EnumChatFormatting.GRAY+"'F' will favourite an item, putting it to the top of the itemlist")); +// texts[6].put(new Vector2f(0.17f, 0.21f), Utils.createList( +// EnumChatFormatting.GOLD+"Collection Log", +// EnumChatFormatting.GRAY+"This is the collection log. It can be accessed using the /neucl command, or via the QuickCommand", +// EnumChatFormatting.GRAY+"The collection log keeps track of all items that enter your inventory while you are playing skyblock", +// EnumChatFormatting.GRAY+"If you are a completionist, this feature is for you")); +// texts[7].put(new Vector2f(0.05f, 0.13f), Utils.createList( +// EnumChatFormatting.GOLD+"Collection Log", +// EnumChatFormatting.GRAY+"Clicking on 'Filter' will change the items that", +// EnumChatFormatting.GRAY+"appear in the list")); +// texts[8].put(new Vector2f(0.35f, 0.74f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"This is the NEU Auction House (NeuAH)", +// EnumChatFormatting.GRAY+"This AH can be accessed from anywhere using the /neuah command, or via the QuickCommand", +// EnumChatFormatting.GRAY+"The items here refresh automatically, so there is no need to close the GUI to see the latest auctions", +// EnumChatFormatting.GRAY+"Sometimes, you might have to wait until the list is populated with items from the API")); +// texts[9].put(new Vector2f(0.41f, 0.40f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"These tabs control the items that appear in NeuAH", +// EnumChatFormatting.GRAY+"You can find the main categories on the top of the GUI and subcategories appear on the side of the GUI once a main category is selected")); +// texts[10].put(new Vector2f(0.57f, 0.38f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"Search for items using the search bar at the top", +// EnumChatFormatting.GRAY+"Boolean operators such as &, | or ! work here.")); +// texts[10].put(new Vector2f(0.40f, 0.72f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"This toolbar contains many useful features", +// EnumChatFormatting.GRAY+"which control the sorting and ordering of", +// EnumChatFormatting.GRAY+"the auction house, similar to the normal AH")); +// texts[11].put(new Vector2f(0.55f, 0.72f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"Clicking on an item will bring up the auction view", +// EnumChatFormatting.GRAY+"Here you can viewer the buyer/seller and place bids or make purchases", +// EnumChatFormatting.GRAY+"Trying to purchase an item will result in a confirmation GUI similar to the normal AH")); +// texts[12].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"Access the profile viewer using /neuprofile (ign) or /pv (ign)", +// EnumChatFormatting.GRAY+"This is the main page of the profile viewer", +// EnumChatFormatting.GRAY+"This page contains basic information like stats and skill levels")); +// texts[12].put(new Vector2f(0.72f, 0.55f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"Click the button on the left to switch profiles and use the bar on the right to switch players")); +// texts[13].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the extra info page of the profile viewer", +// EnumChatFormatting.GRAY+"This page contains all the small bits of information about a player that don't fit anywhere else")); +// texts[14].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the inventories page of the profile viewer", +// EnumChatFormatting.GRAY+"Click on the inventory icons in the top-left or use your keyboard to switch the inventory type", +// EnumChatFormatting.GRAY+"The bar on the bottom-left searches the current inventory for matching items")); +// texts[15].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the collections page of the profile viewer", +// EnumChatFormatting.GRAY+"Click on the icons on the left or use the keyboard shortcut to switch collection type")); +// texts[16].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the pets page of the profile viewer", +// EnumChatFormatting.GRAY+"Click to select the pet on the left", +// EnumChatFormatting.GRAY+"The selected pet's stats will display on the right")); +// texts[17].put(new Vector2f(0.27f, 0.40f), Utils.createList( +// EnumChatFormatting.GOLD+"Overlay", +// EnumChatFormatting.GRAY+"Rearrange certain GUI elements of the main overlay using /neuoverlay", +// EnumChatFormatting.GRAY+"If you accidentally move them off screen, use the button in the top left to reset the GUI")); +// } +// +// static { +// buttons = new ArrayList<>(); +// buttons.add(createNewButton(0.27f, 0.40f, new int[]{1, 2},"TESTSHIT", "neu")); +// } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/TutorialBase.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/TutorialBase.java new file mode 100644 index 00000000..215f210c --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/TutorialBase.java @@ -0,0 +1,319 @@ +package io.github.moulberry.notenoughupdates.miscgui.tutorials; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.ClientCommandHandler; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import static io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour.custom_ench_colour; + +public class TutorialBase extends GuiScreen { + + private int guiLeft = 0; + private int guiTop = 0; + private int sizeX = 0; + private int sizeY = 0; + + protected static String title; + + private int page = 0; + private ResourceLocation screenshotBorder = new ResourceLocation("notenoughupdates:ss_border.jpg"); + + protected ResourceLocation[] screenshots = null; + + int scaleFactor = 0; + + + + @Override + public void setWorldAndResolution(Minecraft mc, int width, int height) { + super.setWorldAndResolution(mc, width, height); + } + + @Override + protected void keyTyped(char typedChar, int keyCode) throws IOException { + Keyboard.enableRepeatEvents(true); + super.keyTyped(typedChar, keyCode); + if(keyCode == Keyboard.KEY_LEFT) { + page--; + } else if(keyCode == Keyboard.KEY_RIGHT) { + page++; + } + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + super.drawScreen(mouseX, mouseY, partialTicks); + + drawDefaultBackground(); + + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + scaleFactor = scaledResolution.getScaleFactor(); + + sizeX = width/2+40/scaleFactor; + sizeY = height/2+40/scaleFactor; + guiLeft = width/4-20/scaleFactor; + guiTop = height/4-20/scaleFactor; + + Minecraft.getMinecraft().getTextureManager().bindTexture(screenshotBorder); + Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY); + + page = Math.max(0, Math.min(17, page)); + + Minecraft.getMinecraft().getTextureManager().bindTexture(screenshots[page]); + Utils.drawTexturedRect(guiLeft+20f/scaleFactor, guiTop+20f/scaleFactor, sizeX-40f/scaleFactor, sizeY-40f/scaleFactor); + + Utils.drawStringCentered(EnumChatFormatting.GOLD+title+" - Page "+(page+1)+"/"+(texts.size())+" - Use arrow keys", Minecraft.getMinecraft().fontRendererObj, + width/2, guiTop+8, true, 0); + if(scaleFactor != 2) Utils.drawStringCentered(EnumChatFormatting.GOLD+"Use GUI Scale normal for better reading experience", Minecraft.getMinecraft().fontRendererObj, + width/2, guiTop+18, true, 0); + JsonArray pageTexts = texts.get(page); + for (int i = 0; i < pageTexts.size(); i++) { + JsonObject textElement = pageTexts.get(i).getAsJsonObject(); + float oldX = textElement.get("x").getAsFloat(); + float oldY = textElement.get("y").getAsFloat(); + +// List<String> text = entry.getValue(); + JsonArray textArray = textElement.getAsJsonArray("lines"); + List<String> text = new ArrayList<>(); + for (int j = 0; j < textArray.size(); j++) { + text.add(textArray.get(j).getAsString()); + } + + + float x = guiLeft+20f/scaleFactor+(sizeX-40f/scaleFactor)*oldX; + float y = guiTop+20f/scaleFactor+(sizeY-40f/scaleFactor)*oldY; + + Utils.drawHoveringText(text, (int)x, (int)y+12, 100000, 100000, 200, Minecraft.getMinecraft().fontRendererObj); + } + + drawButtons(); + } + + protected void drawButtons(){ + + for (int i = 0; i < buttons.size(); i++) { + JsonObject button = buttons.get(i); + JsonArray pages = button.get("pages").getAsJsonArray(); + boolean drawButton = false; + for (int i1 = 0; i1 < pages.size(); i1++) { + if(pages.get(i1).getAsInt() == page){ + drawButton = true; + break; + } + } + if(!drawButton){ + continue; + } + float x = button.get("x").getAsFloat(); + float y = button.get("y").getAsFloat(); + String text = button.get("text").getAsString(); +// String command = button.get("command").getAsString(); + Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour); + GlStateManager.color(1, 1, 1, 1); + Utils.drawTexturedRect(guiLeft+20f/scaleFactor+(sizeX-40f/scaleFactor)*x, guiTop+20f/scaleFactor+(sizeY-40f/scaleFactor)*y, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); + Utils.drawStringCenteredScaledMaxWidth(text, fontRendererObj, (guiLeft+20f/scaleFactor+(sizeX-40f/scaleFactor)*x)+44, (guiTop+20f/scaleFactor+(sizeY-40f/scaleFactor)*y)+10, false, 86, 4210752); + + + } + } + + @Override + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + super.mouseClicked(mouseX, mouseY, mouseButton); + int width= 88; + int height = 20; + + for (int i = 0; i < buttons.size(); i++) { + JsonObject button = buttons.get(i); + JsonArray pages = button.get("pages").getAsJsonArray(); + boolean drawButton = false; + for (int i1 = 0; i1 < pages.size(); i1++) { + if(pages.get(i1).getAsInt() == page){ + drawButton = true; + break; + } + } + if(!drawButton){ + continue; + } + float x = button.get("x").getAsFloat(); + float y = button.get("y").getAsFloat(); + //String text = button.get("text").getAsString(); + float realX = guiLeft+20f/scaleFactor+(sizeX-40f/scaleFactor)*x; + float realY = guiTop+20f/scaleFactor+(sizeY-40f/scaleFactor)*y; + if(mouseX > realX && mouseX < realX+width && mouseY > realY && mouseY < realY+height){ + String command = button.get("command").getAsString(); + NotEnoughUpdates.INSTANCE.openGui = null; + ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/"+command); + return; + } + } + } + + + + + + protected static List<JsonArray> texts = new ArrayList<JsonArray>(); + + protected static List<JsonObject> buttons = new ArrayList<>(); + + protected static JsonObject createNewButton(float x, float y, int[] pages, String text, String command){ + JsonObject button = new JsonObject(); + JsonArray pagesArray = new JsonArray(); + for (int i = 0; i < pages.length; i++) { + pagesArray.add(new JsonPrimitive(pages[i])); + } + button.add("pages",pagesArray); + button.add("x", new JsonPrimitive(x)); + button.add("y", new JsonPrimitive(y)); + button.add("text", new JsonPrimitive(text)); + button.add("command", new JsonPrimitive(command)); + return button; + } + + protected static JsonArray createNewTexts(JsonObject... texts){ + JsonArray textArray = new JsonArray(); + for (int i = 0; i < texts.length; i++) { + textArray.add(texts[i]); + } + return textArray; + } + + protected static JsonObject createNewText(float x, float y, String... texts){ + JsonObject tooltip = new JsonObject(); + tooltip.add("x", new JsonPrimitive(x)); + tooltip.add("y", new JsonPrimitive(y)); + JsonArray lines = new JsonArray(); + for (int i = 0; i < texts.length; i++) { + lines.add(new JsonPrimitive(texts[i])); + } + tooltip.add("lines", lines); + return tooltip; + } + + protected static JsonObject createNewText(float x, float y, List<String> texts){ + JsonObject tooltip = new JsonObject(); + tooltip.add("x", new JsonPrimitive(x)); + tooltip.add("y", new JsonPrimitive(y)); + JsonArray lines = new JsonArray(); + for (int i = 0; i < texts.size(); i++) { + lines.add(new JsonPrimitive(texts.get(i))); + } + tooltip.add("lines", lines); + return tooltip; + } + +// static { +// for(int i=0; i<18; i++) { +// texts[i] = new HashMap<>(); +// } +// texts[0].put(new Vector2f(0.73f, 0.60f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"Here you will find a list of (most) skyblock items", +// EnumChatFormatting.GRAY+"The itemlist can be accessed by opening your inventory or most menus while on skyblock")); +// texts[1].put(new Vector2f(0.73f, 0.16f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"These are the page controls for the itemlist", +// EnumChatFormatting.GRAY+"Clicking these controls will bring you to other pages of the itemlist")); +// texts[2].put(new Vector2f(0.73f, 1.05f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"These are the sorting controls for the itemlist", +// EnumChatFormatting.GRAY+"The buttons on the left control the ordering of the items", +// EnumChatFormatting.GRAY+"The buttons on the right can be used to filter a certain type of item")); +// texts[3].put(new Vector2f(0.39f, 1.04f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"This is the search bar for the itemlist", +// EnumChatFormatting.GRAY+"Double-click the bar to enable inventory search mode", +// EnumChatFormatting.GRAY+"The button on the left opens up the mod settings", +// EnumChatFormatting.GRAY+"The button on the right displays this tutorial")); +// texts[4].put(new Vector2f(0.39f, 0.99f), Utils.createList( +// EnumChatFormatting.GOLD+"QuickCommands", +// EnumChatFormatting.GRAY+"These are the QuickCommands", +// EnumChatFormatting.GRAY+"They let you warp around or access certain menus more easily")); +// texts[5].put(new Vector2f(0.7f, 0.71f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"Hover over an item in the list to display it's lore", +// EnumChatFormatting.GRAY+"Left clicking some items will display the recipe for that item", +// EnumChatFormatting.GRAY+"Right clicking some items will display a wiki page for that item", +// EnumChatFormatting.GRAY+"'F' will favourite an item, putting it to the top of the itemlist")); +// texts[6].put(new Vector2f(0.17f, 0.21f), Utils.createList( +// EnumChatFormatting.GOLD+"Collection Log", +// EnumChatFormatting.GRAY+"This is the collection log. It can be accessed using the /neucl command, or via the QuickCommand", +// EnumChatFormatting.GRAY+"The collection log keeps track of all items that enter your inventory while you are playing skyblock", +// EnumChatFormatting.GRAY+"If you are a completionist, this feature is for you")); +// texts[7].put(new Vector2f(0.05f, 0.13f), Utils.createList( +// EnumChatFormatting.GOLD+"Collection Log", +// EnumChatFormatting.GRAY+"Clicking on 'Filter' will change the items that", +// EnumChatFormatting.GRAY+"appear in the list")); +// texts[8].put(new Vector2f(0.35f, 0.74f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"This is the NEU Auction House (NeuAH)", +// EnumChatFormatting.GRAY+"This AH can be accessed from anywhere using the /neuah command, or via the QuickCommand", +// EnumChatFormatting.GRAY+"The items here refresh automatically, so there is no need to close the GUI to see the latest auctions", +// EnumChatFormatting.GRAY+"Sometimes, you might have to wait until the list is populated with items from the API")); +// texts[9].put(new Vector2f(0.41f, 0.40f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"These tabs control the items that appear in NeuAH", +// EnumChatFormatting.GRAY+"You can find the main categories on the top of the GUI and subcategories appear on the side of the GUI once a main category is selected")); +// texts[10].put(new Vector2f(0.57f, 0.38f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"Search for items using the search bar at the top", +// EnumChatFormatting.GRAY+"Boolean operators such as &, | or ! work here.")); +// texts[10].put(new Vector2f(0.40f, 0.72f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"This toolbar contains many useful features", +// EnumChatFormatting.GRAY+"which control the sorting and ordering of", +// EnumChatFormatting.GRAY+"the auction house, similar to the normal AH")); +// texts[11].put(new Vector2f(0.55f, 0.72f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"Clicking on an item will bring up the auction view", +// EnumChatFormatting.GRAY+"Here you can viewer the buyer/seller and place bids or make purchases", +// EnumChatFormatting.GRAY+"Trying to purchase an item will result in a confirmation GUI similar to the normal AH")); +// texts[12].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"Access the profile viewer using /neuprofile (ign) or /pv (ign)", +// EnumChatFormatting.GRAY+"This is the main page of the profile viewer", +// EnumChatFormatting.GRAY+"This page contains basic information like stats and skill levels")); +// texts[12].put(new Vector2f(0.72f, 0.55f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"Click the button on the left to switch profiles and use the bar on the right to switch players")); +// texts[13].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the extra info page of the profile viewer", +// EnumChatFormatting.GRAY+"This page contains all the small bits of information about a player that don't fit anywhere else")); +// texts[14].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the inventories page of the profile viewer", +// EnumChatFormatting.GRAY+"Click on the inventory icons in the top-left or use your keyboard to switch the inventory type", +// EnumChatFormatting.GRAY+"The bar on the bottom-left searches the current inventory for matching items")); +// texts[15].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the collections page of the profile viewer", +// EnumChatFormatting.GRAY+"Click on the icons on the left or use the keyboard shortcut to switch collection type")); +// texts[16].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the pets page of the profile viewer", +// EnumChatFormatting.GRAY+"Click to select the pet on the left", +// EnumChatFormatting.GRAY+"The selected pet's stats will display on the right")); +// texts[17].put(new Vector2f(0.27f, 0.40f), Utils.createList( +// EnumChatFormatting.GOLD+"Overlay", +// EnumChatFormatting.GRAY+"Rearrange certain GUI elements of the main overlay using /neuoverlay", +// EnumChatFormatting.GRAY+"If you accidentally move them off screen, use the button in the top left to reset the GUI")); +// } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayerSP.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayerSP.java index f82cc88f..35ee3a63 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayerSP.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayerSP.java @@ -22,7 +22,7 @@ public class MixinEntityPlayerSP { } int slot = Minecraft.getMinecraft().thePlayer.inventory.currentItem; - if(SlotLocking.getInstance().isSlotIndexLocked(slot)) { + if(SlotLocking.getInstance().isSlotIndexLocked(slot) || SlotLocking.getInstance().isSwapedSlotLocked()) { ci.cancel(); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+ "NotEnoughUpdates has prevented you from dropping that locked item!")); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java index e527e18e..82634c87 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java @@ -30,6 +30,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; @@ -101,7 +102,10 @@ public abstract class MixinGuiContainer extends GuiScreen { @Inject(method="drawScreen", at=@At("RETURN")) public void drawScreen(CallbackInfo ci) { if(theSlot != null && SlotLocking.getInstance().isSlotLocked(theSlot)) { + SlotLocking.getInstance().setRealSlot(theSlot); theSlot = null; + } else if( theSlot == null){ + SlotLocking.getInstance().setRealSlot(null); } } @@ -163,6 +167,12 @@ public abstract class MixinGuiContainer extends GuiScreen { } return slot.canBeHovered(); } + @Inject(method="checkHotbarKeys", at=@At(value = "INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiContainer;handleMouseClick(Lnet/minecraft/inventory/Slot;III)V"), locals = LocalCapture.CAPTURE_FAILSOFT ,cancellable = true) + public void checkHotbarKeys_Slotlock(int keyCode, CallbackInfoReturnable<Boolean> cir, int i){ + if(SlotLocking.getInstance().isSlotIndexLocked(i)){ + cir.setReturnValue(false); + } + } @Inject(method="handleMouseClick", at=@At(value="HEAD"), cancellable = true) public void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType, CallbackInfo ci) { @@ -206,5 +216,4 @@ public abstract class MixinGuiContainer extends GuiScreen { } } } - } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryPlayer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryPlayer.java index d31ab00a..f60a4839 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryPlayer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryPlayer.java @@ -1,5 +1,6 @@ package io.github.moulberry.notenoughupdates.mixins; +import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; import io.github.moulberry.notenoughupdates.miscgui.InventoryStorageSelector; import net.minecraft.entity.player.InventoryPlayer; import org.spongepowered.asm.mixin.Mixin; @@ -11,10 +12,19 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; public class MixinInventoryPlayer { @Inject(method="changeCurrentItem", at=@At("RETURN")) - public void changeCurrentItem(int direction, CallbackInfo ci) { + public void changeCurrentItemReturn(int direction, CallbackInfo ci) { InventoryPlayer $this = (InventoryPlayer)(Object)this; $this.currentItem = InventoryStorageSelector.getInstance().onScroll(direction, $this.currentItem); + + + } + + @Inject(method="changeCurrentItem", at=@At("HEAD")) + public void changeCurrentItemHead(int direction, CallbackInfo ci) { + InventoryPlayer $this = (InventoryPlayer)(Object)this; + + SlotLocking.getInstance().changedSlot($this.currentItem); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java index 81ab8ec0..e2b4a156 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java @@ -1,9 +1,12 @@ package io.github.moulberry.notenoughupdates.mixins; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; + import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.EntityRenderer; +import org.spongepowered.asm.lib.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -14,7 +17,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(Minecraft.class) public class MixinMinecraft { - @Shadow public WorldClient theWorld; + //Commented as they were'nt being loaded before +/* @Shadow public WorldClient theWorld; @Shadow public EntityRenderer entityRenderer; @@ -33,6 +37,11 @@ public class MixinMinecraft { @Redirect(method="loadWorld(Lnet/minecraft/client/multiplayer/WorldClient;Ljava/lang/String;)V", at=@At(value = "INVOKE", target = "Ljava/lang/System;gc()V")) public void loadWorld_gc() { + }*/ + + @Inject(method = "runTick", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/player/InventoryPlayer;currentItem:I", opcode = Opcodes.PUTFIELD)) + public void currentItemMixin(CallbackInfo ci){ + SlotLocking.getInstance().changedSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java index a71fd6f8..7a1be4de 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java @@ -1,7 +1,9 @@ package io.github.moulberry.notenoughupdates.mixins; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects; import io.github.moulberry.notenoughupdates.miscfeatures.DamageCommas; +import io.github.moulberry.notenoughupdates.overlays.BonemerangOverlay; import net.minecraft.client.renderer.entity.RendererLivingEntity; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -30,7 +32,7 @@ public abstract class MixinRendererLivingEntity<T extends EntityLivingBase> { @Inject(method="getColorMultiplier", at=@At("HEAD"), cancellable = true) public void getColorMultiplier(T entitylivingbaseIn, float lightBrightness, float partialTickTime, CallbackInfoReturnable<Integer> cir) { - if(CustomItemEffects.INSTANCE.bonemeragedEntities.contains(entitylivingbaseIn)) { + if(BonemerangOverlay.INSTANCE.bonemeragedEntities.contains(entitylivingbaseIn) && NotEnoughUpdates.INSTANCE.config.itemOverlays.highlightTargeted) { cir.setReturnValue(0x80ff9500); } } 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 22d5e32f..98816714 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -6,13 +6,15 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper; import io.github.moulberry.notenoughupdates.core.config.Config; import io.github.moulberry.notenoughupdates.core.config.Position; -import io.github.moulberry.notenoughupdates.core.config.annotations.*; +import io.github.moulberry.notenoughupdates.core.config.annotations.Category; import io.github.moulberry.notenoughupdates.core.config.gui.GuiPositionEditor; 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.*; +import io.github.moulberry.notenoughupdates.overlays.MiningOverlay; +import io.github.moulberry.notenoughupdates.overlays.OverlayManager; +import io.github.moulberry.notenoughupdates.overlays.TextOverlay; import io.github.moulberry.notenoughupdates.util.SBInfo; import net.minecraft.client.Minecraft; import net.minecraftforge.client.ClientCommandHandler; @@ -21,6 +23,7 @@ import org.lwjgl.util.vector.Vector2f; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; public class NEUConfig extends Config { @@ -82,7 +85,11 @@ public class NEUConfig extends Config { case 8: NotEnoughUpdates.INSTANCE.openGui = new GuiEnchantColour(); return; - + case 9: + editOverlay(activeConfigCategory, OverlayManager.bonemerangOverlay, itemOverlays.bonemerangPosition); + return; + case 10: + editOverlay(activeConfigCategory, OverlayManager.crystalHollowOverlay, mining.crystalHollowOverlayPosition); } } @@ -276,7 +283,20 @@ public class NEUConfig extends Config { @Expose public ArrayList<String> previousAuctionSearches = new ArrayList<>(); @Expose public ArrayList<String> eventFavourites = new ArrayList<>(); @Expose public ArrayList<String> quickCommands = createDefaultQuickCommands(); - @Expose public ArrayList<String> enchantColours = Lists.newArrayList( + @Expose public ArrayList<String> enchantColours = createDefaultEnchantColours(); + @Expose public String repoURL = "https://github.com/Moulberry/NotEnoughUpdates-REPO/archive/master.zip"; + @Expose public String repoCommitsURL = "https://api.github.com/repos/Moulberry/NotEnoughUpdates-REPO/commits/master"; + @Expose public Map<String, Integer> commissionMaxes = new HashMap<>(); + + @Expose public boolean firstTimeSearchFocus = true; + + //These config options were added due to a graphical bug that caused the player to be unable to see the screen + @Expose public boolean disableBrokenCapes = false; + + } + + public static ArrayList<String> createDefaultEnchantColours(){ + return Lists.newArrayList( "[a-zA-Z\\- ]+:\u003e:9:6:0", "[a-zA-Z\\- ]+:\u003e:6:c:0", "[a-zA-Z\\- ]+:\u003e:5:5:0", @@ -284,8 +304,6 @@ public class NEUConfig extends Config { "Life Steal:\u003e:3:5:0", "Scavenger:\u003e:3:5:0", "Looting:\u003e:3:5:0"); - @Expose public String repoURL = "https://github.com/Moulberry/NotEnoughUpdates-REPO/archive/master.zip"; - @Expose public String repoCommitsURL = "https://api.github.com/repos/Moulberry/NotEnoughUpdates-REPO/commits/master"; } private static ArrayList<String> createDefaultQuickCommands() { @@ -311,15 +329,40 @@ public class NEUConfig extends Config { public static class HiddenProfileSpecific { - @Expose public long godPotionDuration = 0l; + @Expose public long godPotionDuration = 0L; @Expose public long puzzlerCompleted = 0L; @Expose public long firstCakeAte = 0L; @Expose public long fetchurCompleted = 0L; @Expose public long commissionsCompleted = 0L; @Expose public long experimentsCompleted = 0L; @Expose public long cookieBuffRemaining = 0L; + @Expose public List<MiningOverlay.ForgeItem> forgeItems = new ArrayList<MiningOverlay.ForgeItem>(); @Expose public int commissionMilestone = 0; + + @Expose public HashMap<String, Boolean> automatonParts = new HashMap<String, Boolean>(){{ + put("Electron Transmitter", false); + put("FTX 3070", false); + put("Robotron Reflector", false); + put("Superlite Motor", false); + put("Control Switch", false); + put("Synthetic Heart", false); + }}; + + @Expose public HashMap<String, Boolean> divanMinesParts = new HashMap<String, Boolean>(){{ + put("Scavenged Lapis Sword", false); + put("Scavenged Golden Hammer", false); + put("Scavenged Diamond Axe", false); + put("Scavenged Emerald Hammer", false); + }}; + + @Expose public HashMap<String, Integer> crystals = new HashMap<String, Integer>(){{ + put("Jade", 0); + put("Amber", 0); + put("Amethyst", 0); + put("Sapphire", 0); + put("Topaz", 0); + }}; } public static List<InventoryButton> createDefaultInventoryButtons() { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java index f6cc91ec..86256650 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java @@ -1,8 +1,13 @@ package io.github.moulberry.notenoughupdates.options.seperateSections;
import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
public class ItemOverlays {
@ConfigOption(
name = "Treecapitator Overlay",
@@ -175,6 +180,15 @@ public class ItemOverlays { @Expose
@ConfigOption(
+ name = "Enable etherwarp helper overlay",
+ desc = "Display an overlay which tells you if the etherwarp will fail."
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 7)
+ public boolean enableEtherwarpHelperOverlay = true;
+
+ @Expose
+ @ConfigOption(
name = "Highlight Colour",
desc = "Change the colour of the etherwarp target block outline"
)
@@ -191,6 +205,15 @@ public class ItemOverlays { @Expose
@ConfigOption(
+ name = "Enable Bonemerang Overlay",
+ desc = "Shows info about the bonemerang while holding it."
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
+ public boolean enableBonemerangOverlay = true;
+
+ @Expose
+ @ConfigOption(
name = "Highlight Targeted Entities",
desc = "Highlight entities that will be hit by your bonemerang"
)
@@ -200,12 +223,51 @@ public class ItemOverlays { @Expose
@ConfigOption(
- name = "Break Warning",
- desc = "Show a warning below your crosshair if the bonemerang will break on a block"
+ name = "Bonemerang Overlay Position",
+ desc = "The position of the Bonemerang overlay."
+ )
+ @ConfigEditorButton(
+ runnableId = 9,
+ buttonText = "Edit"
+ )
+ @ConfigAccordionId(id = 3)
+ public Position bonemerangPosition = new Position(-1, -1);
+
+ @Expose
+ @ConfigOption(
+ name = "Bonemerang Overlay Text",
+ desc = "\u00a7eDrag text to change the appearance of the overlay\n" +
+ "\u00a7rHold a Bonemerang to display the overlay"
+ )
+ @ConfigEditorDraggableList(
+ exampleText = {"\u00a74Gonna break",
+ "\u00a77Targets: \u00a76\u00a7l10"
+ }
+ )
+ @ConfigAccordionId(id = 3)
+ public List<Integer> bonemerangOverlayText = new ArrayList<>(Arrays.asList(0, 1));
+
+ @Expose
+ @ConfigOption(
+ name = "Bonemerang Overlay Style",
+ desc = "Change the style of the Bonemerang overlay"
+ )
+ @ConfigEditorDropdown(
+ values = {"Background", "No Shadow", "Shadow Only", "Full Shadow"}
+ )
+ @ConfigAccordionId(id = 3)
+ public int bonemerangOverlayStyle = 0;
+ @Expose
+ @ConfigOption(
+ name = "Fast update",
+ desc = "Updates the bonemerang overlay faster.\n"+
+ "Might cause some lag."
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 3)
- public boolean showBreak = true;
+ public boolean bonemerangFastUpdate = false;
+
+
@ConfigOption(
name = "Minion Crystal Radius Overlay",
@@ -217,7 +279,7 @@ public class ItemOverlays { @Expose
@ConfigOption(
name = "Enable Crystal Overlay",
- desc = "Show a block overlay for the effective radius of minion crystals (farming, mining, etc)"
+ desc = "Show a block overlay for the effective radius of minion crystals (farming, mining, etc)."
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 5)
@@ -226,9 +288,28 @@ public class ItemOverlays { @Expose
@ConfigOption(
name = "Always Show Crystal Overlay",
- desc = "Show the crystal overlay, even when a minion crystal is not being held"
+ desc = "Show the crystal overlay, even when a minion crystal is not being held."
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 5)
public boolean alwaysShowCrystal = false;
+
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Prismapump Overlay",
+ desc = "Show a block overlay for the effected blocks of prismapump's ability."
+ )
+ @ConfigEditorBoolean
+ public boolean enablePrismapumpOverlay = true;
+
+
+ @Expose
+ @ConfigOption(
+ name = "Pickaxe Ability Cooldown",
+ desc = "Show the cooldown duration off the pickaxe ability as the durability."
+ )
+ @ConfigEditorBoolean
+ public boolean pickaxeAbility = true;
+
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index 157da202..90c4dc8a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -93,7 +93,7 @@ public class Mining { @Expose
@ConfigOption(
name = "Dwarven Overlay",
- desc = "Show an overlay with useful information on the screen while in Dwarven Mines"
+ desc = "Show an Overlay with useful information on the screen while in Dwarven Mines"
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 2)
@@ -102,24 +102,23 @@ public class Mining { @Expose
@ConfigOption(
name = "Dwarven Text",
- desc = "\u00a7eDrag text to change the appearance of the overlay\n" +
- "\u00a7rGo to the Dwarven Mines to show this overlay with useful information"
+ desc = "\u00a7eDrag text to change the appearance of the Overlay\n" +
+ "\u00a7rGo to the Dwarven Mines to show this Overlay with useful information"
)
@ConfigEditorDraggableList(
exampleText = {"\u00a73Goblin Slayer: \u00a7626.5%\n\u00a73Lucky Raffle: \u00a7c0.0%",
"\u00a73Mithril Powder: \u00a726,243",
"\u00a73Gemstone Powder: \u00a7d6,243",
"\u00a73Forge 1) \u00a79Diamonite\u00a77: \u00a7aReady!",
- "\u00a73Forge 2) \u00a77EMPTY\n\u00a73Forge 3) \u00a77EMPTY\n\u00a73Forge 4) \u00a77EMPTY",
"\u00a73Pickaxe CD: \u00a7a78s"}
)
@ConfigAccordionId(id = 2)
- public List<Integer> dwarvenText = new ArrayList<>(Arrays.asList(0, 1, 4, 2, 3, 5));
+ public List<Integer> dwarvenText2 = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4));
@Expose
@ConfigOption(
name = "Overlay Position",
- desc = "Change the position of the Dwarven Mines information overlay (commisions, powder & forge statuses)"
+ desc = "Change the position of the Dwarven Mines information Overlay (commisions, powder & forge statuses)"
)
@ConfigEditorButton(
runnableId = 1,
@@ -131,7 +130,7 @@ public class Mining { @Expose
@ConfigOption(
name = "Overlay Style",
- desc = "Change the style of the Dwarven Mines information overlay"
+ desc = "Change the style of the Dwarven Mines information Overlay"
)
@ConfigEditorDropdown(
values = {"Background", "No Shadow", "Shadow", "Full Shadow"}
@@ -141,6 +140,329 @@ public class Mining { @Expose
@ConfigOption(
+ name = "Show Icons",
+ desc = "Show Icons representing the part of the overlay."
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean dwarvenOverlayIcons = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Forge Display",
+ desc = "Change what gets shown in the Forge Display"
+ )
+ @ConfigEditorDropdown(
+ values = {"Only Done", "Only Working", "Everything Except Locked", "Everything"}
+ )
+ @ConfigAccordionId(id = 2)
+ public int forgeDisplay = 1;
+
+ @Expose
+ @ConfigOption(
+ name = "Forge Location",
+ desc = "Change when the forge display gets shown"
+ )
+ @ConfigEditorDropdown(
+ values = {"Dwarven Mines+Crystal Hollows", "Everywhere except dungeons", "Everywhere"}
+ )
+ @ConfigAccordionId(id = 2)
+ public int forgeDisplayEnabledLocations = 0;
+
+
+ @ConfigOption(
+ name = "Metal Detector Solver",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 3)
+ public boolean metalDetectorSolverAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Waypoints",
+ desc = "Enabled the metal detector solver for Mines of Divan, to use this stand still to calculate possible blocks and then if required stand" +
+ " still on another block."
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
+ public boolean metalDetectorEnabled = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Show Possible Blocks",
+ desc = "Show waypoints on possible locations when NEU isn't sure about what block the treasure is."
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
+ public boolean metalDetectorShowPossible = false;
+
+ @ConfigOption(
+ name = "Crystal Hollows Overlay",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 4)
+ public boolean crystalHollowOverlayAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Overlay",
+ desc = "Enables the Crystal Hollows Overlay."
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 4)
+ public boolean crystalHollowOverlay = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Overlay Position",
+ desc = "Change the position of the Crystal Hollows Overlay."
+ )
+ @ConfigEditorButton(
+ runnableId = 10,
+ buttonText = "Edit"
+ )
+ @ConfigAccordionId(id = 4)
+ public Position crystalHollowOverlayPosition = new Position(200, 0);
+
+ @Expose
+ @ConfigOption(
+ name = "Options",
+ desc = "Drag text to change the appearance of the overlay!\n" +
+ "Click add to add extra things!"
+ )
+ @ConfigEditorDraggableList(
+ exampleText = {
+ "\u00a73Amber Crystal: \u00a7aPlaced\n" +
+ "\u00a73Sapphire Crystal: \u00a7eCollected\n" +
+ "\u00a73Jade Crystal: \u00a7eMissing\n" +
+ "\u00a73Amethyst Crystal: \u00a7cMissing\n" +
+ "\u00a73Topaz Crystal: \u00a7cMissing\n",
+ "\u00a73Crystals: \u00a7a4/5",
+ "\u00a73Crystals: \u00a7a80%",
+ "\u00a73Electron Transmitter: \u00a7aDone\n" +
+ "\u00a73Robotron Reflector: \u00a7eIn Storage\n" +
+ "\u00a73Superlite Motor: \u00a7eIn Inventory\n" +
+ "\u00a73Synthetic Hearth: \u00a7cMissing\n" +
+ "\u00a73Control Switch: \u00a7cMissing\n" +
+ "\u00a73FTX 3070: \u00a7cMissing",
+ "\u00a73Electron Transmitter: \u00a7a3\n" +
+ "\u00a73Robotron Reflector: \u00a7e2\n" +
+ "\u00a73Superlite Motor: \u00a7e1\n" +
+ "\u00a73Synthetic Hearth: \u00a7c0\n" +
+ "\u00a73Control Switch: \u00a7c0\n" +
+ "\u00a73FTX 3070: \u00a7c0",
+ "\u00a73Automaton parts: \u00a7a5/6",
+ "\u00a73Automaton parts: \u00a7a83%",
+ "\u00a73Scavenged Lapis Sword: \u00a7aDone\n" +
+ "\u00a73Scavenged Golden Hammer: \u00a7eIn Storage\n" +
+ "\u00a73Scavenged Diamond Axe: \u00a7eIn Inventory\n" +
+ "\u00a73Scavenged Emerald Hammer: \u00a7cMissing\n",
+ "\u00a73Scavenged Lapis Sword: \u00a7a3\n" +
+ "\u00a73Scavenged Golden Hammer: \u00a7e2\n" +
+ "\u00a73Scavenged Diamond Axe: \u00a7e1\n" +
+ "\u00a73Scavenged Emerald Hammer: \u00a7c0\n",
+ "\u00a73Mines of Divan parts: \u00a7a3/4",
+ "\u00a73Mines of Divan parts: \u00a7a75%"
+ }
+ )
+ @ConfigAccordionId(id = 4)
+ public List<Integer> crystalHollowText = new ArrayList<>(Arrays.asList(0, 3, 7));
+
+ @Expose
+ @ConfigOption(
+ name = "Style",
+ desc = "Change the style of the Crystal Hollows Overlay."
+ )
+ @ConfigEditorDropdown(
+ values = {"Background", "No Shadow", "Shadow", "Full Shadow"}
+ )
+ @ConfigAccordionId(id = 4)
+ public int crystalHollowOverlayStyle = 0;
+
+
+ @Expose
+ @ConfigOption(
+ name = "Show Icons",
+ desc = "Show icons in the Overlay that represent the part."
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 4)
+ public boolean crystalHollowIcons = true;
+
+
+ @Expose
+ @ConfigOption(
+ name = "Hide Done",
+ desc = "Don't show parts you've given to the NPC."
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 4)
+ public boolean crystalHollowHideDone = false;
+
+ @ConfigOption(
+ name = "Locations",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 5)
+ @ConfigAccordionId(id = 4)
+ public boolean crystalHollowLocationAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Show Automaton",
+ desc = "Change where to show Automaton parts."
+ )
+ @ConfigEditorDropdown(
+ values = {"Crystal Hollows", "Precursor Remnants", "Lost Precursor City"}
+ )
+ @ConfigAccordionId(id = 5)
+ public int crystalHollowAutomatonLocation = 2;
+
+ @Expose
+ @ConfigOption(
+ name = "Show Divan",
+ desc = "Change where to show Mines of Divan parts."
+ )
+ @ConfigEditorDropdown(
+ values = {"Crystal Hollows", "Mithril Deposits", "Mines of Divan"}
+ )
+ @ConfigAccordionId(id = 5)
+ public int crystalHollowDivanLocation = 2;
+
+ @Expose
+ @ConfigOption(
+ name = "Show Crystal",
+ desc = "Change where to show Collected Crystals."
+ )
+ @ConfigEditorDropdown(
+ values = {"Crystal Hollows", "When No Other Overlays"}
+ )
+ @ConfigAccordionId(id = 5)
+ public int crystalHollowCrystalLocation = 1;
+
+ @ConfigOption(
+ name = "Colours",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 6)
+ @ConfigAccordionId(id = 4)
+ public boolean crystalHollowColourAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Main Color",
+ desc = "Change the main color of the overlay."
+
+ )
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ )
+ @ConfigAccordionId(id = 6)
+ public int crystalHollowPartColor = 3;
+
+ @Expose
+ @ConfigOption(
+ name = "Done Color",
+ desc = "Change the colour when the part is given to the NPC."
+
+ )
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ )
+
+ @ConfigAccordionId(id = 6)
+ public int crystalHollowDoneColor = 10;
+
+ @Expose
+ @ConfigOption(
+ name = "In Inventory Color",
+ desc = "Change the colour when the part is in the inventory."
+ )
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ )
+ @ConfigAccordionId(id = 6)
+ public int crystalHollowInventoryColor = 14;
+
+ @Expose
+ @ConfigOption(
+ name = "In Storage Color",
+ desc = "Change the colour when the part is in the storage."
+ )
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ )
+ @ConfigAccordionId(id = 6)
+ public int crystalHollowStorageColor = 14;
+
+ @Expose
+ @ConfigOption(
+ name = "Missing Color",
+ desc = "Change the colour when the part is missing."
+ )
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ )
+ @ConfigAccordionId(id = 6)
+ public int crystalHollowMissingColor = 12;
+
+ @Expose
+ @ConfigOption(
+ name = "Placed Color",
+ desc = "Change the colour when the crystal is placed."
+ )
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ )
+ @ConfigAccordionId(id = 6)
+ public int crystalHollowPlacedColor = 10;
+
+ @Expose
+ @ConfigOption(
+ name = "Collected Color",
+ desc = "Change the colour when the crystal is collected"
+ )
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ )
+ @ConfigAccordionId(id = 6)
+ public int crystalHollowCollectedColor = 14;
+
+ @Expose
+ @ConfigOption(
+ name = "All Color",
+ desc = "Change the colour when you have 2/3-all of the parts collected in the count overlay."
+ )
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ )
+ @ConfigAccordionId(id = 6)
+ public int crystalHollowAllColor = 10;
+
+ @Expose
+ @ConfigOption(
+ name = "1/3 Color",
+ desc = "Change the colour when you have 1/3-2/3 of the parts collected in the count overlay."
+ )
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ )
+ @ConfigAccordionId(id = 6)
+ public int crystalHollowMiddleColor = 14;
+
+ @Expose
+ @ConfigOption(
+ name = "0 Color",
+ desc = "Change the colour when you have 0-1/3 of the parts collected in the count overlay."
+ )
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ )
+ @ConfigAccordionId(id = 6)
+ public int crystalHollowNoneColor = 12;
+
+ @Expose
+ @ConfigOption(
name = "Puzzler Solver",
desc = "Show the correct block to mine for the puzzler puzzle in Dwarven Mines"
)
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java index 37c75d28..b38e7fd5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java @@ -38,6 +38,17 @@ public class Misc { @ConfigEditorBoolean
public boolean guiButtonClicks = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Replace Chat Social Options",
+ desc = "Replace Hypixel's chat social options with NEU's profile viewer."
+ )
+ @ConfigEditorBoolean
+ public boolean replaceSocialOptions = true;
+
+
+
@Expose
@ConfigOption(
name = "Damage Indicator Style",
@@ -67,4 +78,15 @@ public class Misc { minStep = 10
)
public int chromaSpeed = 100;
+
+ @Expose
+ @ConfigOption(
+ name = "Disable Skull retexturing",
+ desc = "Disables the skull retexturing."
+ )
+ @ConfigEditorBoolean
+ public boolean disableSkullRetexturing = false;
+
+
+
}
\ No newline at end of file diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SlotLocking.java index 3da885a0..98358d83 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SlotLocking.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SlotLocking.java @@ -51,6 +51,19 @@ public class SlotLocking { @Expose
@ConfigOption(
+ name = "Item Swap drop delay",
+ desc = "Set the delay between swapping to another item and being able to drop it.\n"+
+ "This is to fix a bug that allowed you to drop slot locked items."
+ )
+ @ConfigEditorSlider(
+ minValue = 0,
+ maxValue = 500,
+ minStep = 5
+ )
+ public int slotLockSwapDelay = 100;
+
+ @Expose
+ @ConfigOption(
name = "Slot Lock Sound",
desc = "Play a ding when locking/unlocking slots"
)
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java index 3719e120..d45f6406 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java @@ -12,13 +12,14 @@ public class Toolbar { @ConfigEditorButton(runnableId = 6, buttonText = "Edit")
public boolean positionButton = true;
- @Expose
+
+
@ConfigOption(
- name = "Show Quick Commands",
- desc = "Show QuickCommands\u2122 in the NEU toolbar"
+ name = "Search Bar",
+ desc = ""
)
- @ConfigEditorBoolean
- public boolean quickCommands = false;
+ @ConfigEditorAccordion(id = 0)
+ public boolean searchBarAccordion = false;
@Expose
@ConfigOption(
@@ -26,10 +27,29 @@ public class Toolbar { desc = "Show Itemlist search bar in the NEU toolbar"
)
@ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
public boolean searchBar = true;
@Expose
@ConfigOption(
+ name = "Show a quick settings button",
+ desc = "Show quick settings button in the NEU toolbar"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean enableSettingsButton = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Show a help settings button",
+ desc = "Show quick settings button in the NEU toolbar"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean enableHelpButton = false;
+
+ @Expose
+ @ConfigOption(
name = "Search Bar Width",
desc = "Change the width of the search bar"
)
@@ -38,6 +58,7 @@ public class Toolbar { maxValue = 300f,
minStep = 10f
)
+ @ConfigAccordionId(id = 0)
public int searchBarWidth = 200;
@Expose
@@ -50,10 +71,19 @@ public class Toolbar { maxValue = 50f,
minStep = 1f
)
+ @ConfigAccordionId(id = 0)
public int searchBarHeight = 40;
@Expose
@ConfigOption(
+ name = "Show Quick Commands",
+ desc = "Show QuickCommands\u2122 in the NEU toolbar"
+ )
+ @ConfigEditorBoolean
+ public boolean quickCommands = false;
+
+ @Expose
+ @ConfigOption(
name = "Quick Commands Click Type",
desc = "Change the click type needed to trigger quick commands"
)
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java index e1b9780a..1bdbc84a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java @@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.options.seperateSections; import com.google.gson.annotations.Expose;
import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
import java.util.Arrays;
@@ -62,6 +63,32 @@ public class TooltipTweaks { @Expose
@ConfigOption(
+ name = "Price info keybind",
+ desc = "Only show price info if holding a key."
+ )
+ @ConfigEditorBoolean
+ public boolean disablePriceKey = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Show Price info Keybind",
+ desc = "Hold this key to show a price info tooltip"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE)
+ public int disablePriceKeyKeybind = Keyboard.KEY_NONE;
+
+
+
+ @Expose
+ @ConfigOption(
+ name = "Show reforge stats",
+ desc = "Show statistics a reforge stone will apply."
+ )
+ @ConfigEditorBoolean
+ public boolean showReforgeStats = true;
+
+ @Expose
+ @ConfigOption(
name = "Missing Enchant List",
desc = "Show which enchants are missing on an item when pressing LSHIFT"
)
@@ -70,6 +97,16 @@ public class TooltipTweaks { @Expose
@ConfigOption(
+ name = "Expand Pet Exp Requirement",
+ desc = "Show which the full amount of pet xp required"
+ )
+ @ConfigEditorBoolean
+ public boolean petExtendExp = true;
+
+
+
+ @Expose
+ @ConfigOption(
name = "Tooltip Border Colours",
desc = "Make the borders of tooltips match the rarity of the item (NEU Tooltips Only)"
)
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java new file mode 100644 index 00000000..7d54cf47 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java @@ -0,0 +1,118 @@ +package io.github.moulberry.notenoughupdates.overlays; + +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.core.config.Position; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.Vec3; +import org.lwjgl.util.vector.Vector3f; + +import java.util.*; +import java.util.function.Supplier; + +import static net.minecraft.util.EnumChatFormatting.DARK_AQUA; + +public class BonemerangOverlay extends TextOverlay{ + public BonemerangOverlay(Position position, Supplier<List<String>> dummyStrings, Supplier<TextOverlayStyle> styleSupplier) { + super(position, dummyStrings, styleSupplier); + INSTANCE = this; + } + public static BonemerangOverlay INSTANCE; + + + public final Set<EntityLivingBase> bonemeragedEntities = new HashSet<>(); + + + + @Override + public void updateFrequent() { + if(NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangFastUpdate){ + updateOverlay(); + } + + } + + @Override + public void update() { + if(!NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangFastUpdate){ + updateOverlay(); + } + + } + + private void updateOverlay(){ + if(!NotEnoughUpdates.INSTANCE.config.itemOverlays.enableBonemerangOverlay && NotEnoughUpdates.INSTANCE.config.itemOverlays.highlightTargeted){ + overlayStrings = null; + return; + } + overlayStrings = new ArrayList<>(); + + + bonemeragedEntities.clear(); + if(Minecraft.getMinecraft().thePlayer == null) return; + if(Minecraft.getMinecraft().theWorld == null) return; + + ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); + + String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); + + if(internal != null && internal.equals("BONE_BOOMERANG")) { + HashMap<Integer, String> map = new HashMap<>(); + + + EntityPlayerSP p = Minecraft.getMinecraft().thePlayer; + float stepSize = 0.15f; + float bonemerangDistance = 15; + + Vector3f position = new Vector3f((float)p.posX, (float)p.posY + p.getEyeHeight(), (float)p.posZ); + Vec3 look = p.getLook(0); + + Vector3f step = new Vector3f((float)look.xCoord, (float)look.yCoord, (float)look.zCoord); + step.scale(stepSize / step.length()); + + for(int i=0; i<Math.floor(bonemerangDistance/stepSize)-2; i++) { + AxisAlignedBB bb = new AxisAlignedBB(position.x - 0.75f, position.y - 0.1, position.z - 0.75f, + position.x + 0.75f, position.y + 0.25, position.z + 0.75); + + BlockPos blockPos = new BlockPos(position.x, position.y, position.z); + + if(!Minecraft.getMinecraft().theWorld.isAirBlock(blockPos) && + Minecraft.getMinecraft().theWorld.getBlockState(blockPos).getBlock().isFullCube()) { + map.put(0, EnumChatFormatting.RED + "Bonemerang will break!"); + break; + } + + + List<Entity> entities = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABBExcludingEntity(Minecraft.getMinecraft().thePlayer, bb); + for (Entity entity : entities) { + if (entity instanceof EntityLivingBase && !(entity instanceof EntityArmorStand) && !entity.isInvisible()) { + if (!bonemeragedEntities.contains(entity)) { + bonemeragedEntities.add((EntityLivingBase) entity); + } + } + } + + position.translate(step.x, step.y, step.z); + } + if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableBonemerangOverlay) { + + map.put(1, EnumChatFormatting.GRAY + "Targets: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + bonemeragedEntities.size()); + for (int index : NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangOverlayText) { + if (map.containsKey(index)) { + overlayStrings.add(map.get(index)); + } + } + } + + } + + if(overlayStrings.isEmpty()) overlayStrings = null; + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java new file mode 100644 index 00000000..eb4749db --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java @@ -0,0 +1,118 @@ +package io.github.moulberry.notenoughupdates.overlays; + +import com.google.gson.JsonObject; +import io.github.moulberry.notenoughupdates.NEUManager; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +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.inventory.GuiChest; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; + +import java.util.List; + +public class CraftingOverlay { + private static ItemStack[] items = new ItemStack[9]; + private static final NEUManager manager = NotEnoughUpdates.INSTANCE.manager; + public static boolean shouldRender = false; + private static String text = null; + + + public static void render() { + if (shouldRender) { + ContainerChest container = (ContainerChest) Minecraft.getMinecraft().thePlayer.openContainer; + GuiChest gc = (GuiChest) Minecraft.getMinecraft().currentScreen; + FontRenderer ft = Minecraft.getMinecraft().fontRendererObj; + int width = Utils.peekGuiScale().getScaledWidth(); + int height = Utils.peekGuiScale().getScaledHeight(); + int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth; + int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; + List<String> tooltip = null; + for (int i = 0; i < 9; i++) { + if (items[i] != null) { + int slotIndex = (int) (10 + 9 * Math.floor(i / 3f) + (i % 3)); + Slot slot = container.inventorySlots.get(slotIndex); + int x = slot.xDisplayPosition + gc.guiLeft; + int y = slot.yDisplayPosition + gc.guiTop; + if (!slot.getHasStack() || !manager.getInternalNameForItem(items[i]).equals(manager.getInternalNameForItem(slot.getStack())) || + slot.getStack().stackSize < items[i].stackSize) + Gui.drawRect(x, y, x + 16, y + 16, 0x64ff0000); + if (!slot.getHasStack()) + Utils.drawItemStack(items[i], x, y); + if (!slot.getHasStack() && mouseX >= x && mouseX < x + 16 && mouseY >= y && mouseY < y + 16) + tooltip = items[i].getTooltip(Minecraft.getMinecraft().thePlayer, false); + } + } + if (text != null) + ft.drawStringWithShadow(text, + Utils.peekGuiScale().getScaledWidth() / 2f - ft.getStringWidth(text) / 2f, + gc.guiTop - 15f, 0x808080); + if (tooltip != null) + Utils.drawHoveringText(tooltip, mouseX, mouseY, width, height, -1, ft); + } + } + + public static void updateItem(JsonObject item) { + items = new ItemStack[9]; + text = null; + String[] x = {"1", "2", "3"}; + String[] y = {"A", "B", "C"}; + for (int i = 0; i < 9; i++) { + String name = y[i / 3] + x[i % 3]; + String itemS = item.getAsJsonObject("recipe").get(name).getAsString(); + if (itemS != null && !itemS.equals("")) { + int count = 1; + if (itemS.split(":").length == 2) { + count = Integer.parseInt(itemS.split(":")[1]); + itemS = itemS.split(":")[0]; + } + JsonObject craft = manager.getItemInformation().get(itemS); + if (craft != null) { + ItemStack stack = manager.jsonToStack(craft); + stack.stackSize = count; + items[i] = stack; + } + } + } + if (item.has("crafttext")) { + text = item.get("crafttext").getAsString(); + } + shouldRender = true; + } + + public static void keyInput() { + if (!Keyboard.getEventKeyState() || Keyboard.getEventKey() != Keyboard.KEY_U && Keyboard.getEventKey() != Keyboard.KEY_R) + return; + int width = Utils.peekGuiScale().getScaledWidth(); + int height = Utils.peekGuiScale().getScaledHeight(); + int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth; + int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; + ContainerChest container = (ContainerChest) Minecraft.getMinecraft().thePlayer.openContainer; + GuiChest gc = (GuiChest) Minecraft.getMinecraft().currentScreen; + for (int i = 0; i < 9; i++) { + if (items[i] != null) { + int slotIndex = (int) (10 + 9 * Math.floor(i / 3f) + (i % 3)); + Slot slot = container.inventorySlots.get(slotIndex); + int x = slot.xDisplayPosition + gc.guiLeft; + int y = slot.yDisplayPosition + gc.guiTop; + if (mouseX >= x && mouseX < x + 16 && mouseY >= y && mouseY < y + 16) { + if (!slot.getHasStack()) { + String internalName = manager.getInternalNameForItem(items[i]); + if (Keyboard.getEventKey() == Keyboard.KEY_U && internalName != null) { + manager.displayGuiItemUsages(internalName); + } else if (Keyboard.getEventKey() == Keyboard.KEY_R && internalName != null && manager.getItemInformation().containsKey(internalName)) { + JsonObject item = manager.getItemInformation().get(internalName); + manager.showRecipe(item); + } + } + break; + } + } + } + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java new file mode 100644 index 00000000..f3dfa242 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java @@ -0,0 +1,403 @@ +package io.github.moulberry.notenoughupdates.overlays; + +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.core.config.Position; +import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; +import io.github.moulberry.notenoughupdates.options.NEUConfig; +import io.github.moulberry.notenoughupdates.util.SBInfo; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.util.vector.Vector2f; + +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class CrystalHollowOverlay extends TextOverlay { + private static final Minecraft mc = Minecraft.getMinecraft(); + private final StorageManager storageManager = StorageManager.getInstance(); + private final Pattern notFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Talk to me when you have found a (?<item>[a-z-A-Z ]+)!"); + private final Pattern foundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Excellent! You have returned the (?<item>[a-z-A-Z ]+) to its rightful place!"); + private final Pattern resetPattern = Pattern.compile("\\[NPC] Keeper of \\w+: (You found all of the items! Behold\\.\\.\\. the Jade Crystal!)"); + private final Pattern alreadyFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: You have already restored this Dwarf's (?<item>[a-z-A-Z ]+)!"); + private final Pattern givePattern = Pattern.compile("\\[NPC] Professor Robot: Thanks for bringing me the (?<part>[a-zA-Z0-9 ]+)! Bring me (\\d+|one) more components? to fix the giant!"); + private final Pattern notFinalPattern = Pattern.compile("\\[NPC] Professor Robot: That's not the final component! Bring me a (?<part>[a-zA-Z0-9 ]+) to gain access to Automaton Prime's storage container!"); + private final Pattern obtainCrystalPattern = Pattern.compile(" +(?<crystal>[a-zA-Z]+) Crystal"); + private final Pattern crystalNotPlacedPattern = Pattern.compile(".*: You haven't placed the (?<crystal>[a-zA-Z]+) Crystal yet!"); + private final Pattern crystalPlacedPattern = Pattern.compile(".*: You have already placed the (?<crystal>[a-zA-Z]+) Crystal!"); + private final Pattern crystalPlacePattern = Pattern.compile("✦ You placed the (?<crystal>[a-zA-Z]+) Crystal!"); + private final Pattern crystalReclaimPattern = Pattern.compile("✦ You reclaimed the (?<crystal>[a-zA-Z]+) Crystal!"); + + public CrystalHollowOverlay(Position position, Supplier<List<String>> dummyStrings, Supplier<TextOverlayStyle> styleSupplier) { + super(position, dummyStrings, styleSupplier); + } + + @Override + public void update() { + overlayStrings = null; + if (!NotEnoughUpdates.INSTANCE.config.mining.crystalHollowOverlay || SBInfo.getInstance().getLocation() == null || + !SBInfo.getInstance().getLocation().equals("crystal_hollows")) + return; + + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); + if (hidden == null) return; + overlayStrings = new ArrayList<>(); + HashMap<String, Integer> inventoryData = new HashMap<>(); + for (String key : hidden.automatonParts.keySet()) + inventoryData.put(key, 0); + for (String key : hidden.divanMinesParts.keySet()) + inventoryData.put(key, 0); + HashMap<String, Integer> storageData = new HashMap<>(inventoryData); + for (ItemStack item : mc.thePlayer.inventory.mainInventory) + if (item != null) { + String name = Utils.cleanColour(item.getDisplayName()); + if (inventoryData.containsKey(name)) + inventoryData.put(name, inventoryData.get(name) + item.stackSize); + } + for (Map.Entry<Integer, Integer> entry : storageManager.storageConfig.displayToStorageIdMap.entrySet()) { + int storageId = entry.getValue(); + StorageManager.StoragePage page = storageManager.getPage(storageId, false); + if (page != null && page.rows > 0) + for (ItemStack item : page.items) + if (item != null) { + String name = Utils.cleanColour(item.getDisplayName()); + if (storageData.containsKey(name)) + storageData.put(name, storageData.get(name) + item.stackSize); + } + } + + for (int i : NotEnoughUpdates.INSTANCE.config.mining.crystalHollowText) { + switch (i) { + case 0: + if (crystalCheck()) { + for (String part : hidden.crystals.keySet()) { + switch (hidden.crystals.get(part)) { + case 2: + if (!NotEnoughUpdates.INSTANCE.config.mining.crystalHollowHideDone) + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPlacedColor] + "Placed"); + break; + case 1: + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowCollectedColor] + "Collected"); + break; + case 0: + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowMissingColor] + "Missing"); + break; + } + } + } + break; + case 1: + if (crystalCheck()) { + int count = getCountCrystal(hidden.crystals); + float percent = (float) count / hidden.crystals.size() * 100; + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + "Crystals: " + getColor(percent) + + count + "/" + hidden.crystals.size()); + } + break; + case 2: + if (crystalCheck()) { + int count = getCountCrystal(hidden.crystals); + float percent = (float) count / hidden.crystals.size() * 100; + DecimalFormat df = new DecimalFormat("#.#"); + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + "Crystals: " + getColor(percent) + + df.format(percent) + "%"); + } + break; + case 3: + if (automatonCheck()) + renderParts(hidden.automatonParts, inventoryData, storageData); + break; + case 4: + if (automatonCheck()) + renderPartsNumbers(hidden.automatonParts, inventoryData, storageData); + break; + case 5: + if (automatonCheck()) + renderCount("Automaton parts", hidden.automatonParts, inventoryData, storageData); + break; + case 6: + if (automatonCheck()) + renderPercent("Automaton parts", hidden.automatonParts, inventoryData, storageData); + break; + case 7: + if (divanCheck()) + renderParts(hidden.divanMinesParts, inventoryData, storageData); + break; + case 8: + if (divanCheck()) + renderPartsNumbers(hidden.divanMinesParts, inventoryData, storageData); + break; + case 9: + if (divanCheck()) + renderCount("Mines of Divan parts", hidden.divanMinesParts, inventoryData, storageData); + break; + case 10: + if (divanCheck()) + renderPercent("Mines of Divan parts", hidden.divanMinesParts, inventoryData, storageData); + break; + } + } + } + + private void renderParts(HashMap<String, Boolean> parts, HashMap<String, Integer> inventoryData, HashMap<String, Integer> storageData) { + for (String part : parts.keySet()) { + if (parts.get(part) && !NotEnoughUpdates.INSTANCE.config.mining.crystalHollowHideDone) + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDoneColor] + "Done"); + else if (inventoryData.get(part) >= 1) + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowInventoryColor] + "In Inventory"); + else if (storageData.get(part) >= 1) + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowStorageColor] + "In Storage"); + else + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowMissingColor] + "Missing"); + } + } + + private void renderPartsNumbers(HashMap<String, Boolean> parts, HashMap<String, Integer> inventoryData, HashMap<String, Integer> storageData) { + for (String part : parts.keySet()) { + if (parts.get(part)) + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDoneColor] + (inventoryData.get(part) + storageData.get(part))); + else if (inventoryData.get(part) >= 1) + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowInventoryColor] + (inventoryData.get(part) + storageData.get(part))); + else if (storageData.get(part) >= 1) + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowStorageColor] + (inventoryData.get(part) + storageData.get(part))); + else + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowMissingColor] + (inventoryData.get(part) + storageData.get(part))); + } + } + + private void renderCount(String text, HashMap<String, Boolean> parts, HashMap<String, Integer> inventoryData, HashMap<String, Integer> storageData) { + int count = getCount(parts, inventoryData, storageData); + float percent = (float) count / parts.size() * 100; + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + text + ": " + getColor(percent) + count + + "/" + parts.size()); + } + + private void renderPercent(String text, HashMap<String, Boolean> parts, HashMap<String, Integer> inventoryData, HashMap<String, Integer> storageData) { + int count = getCount(parts, inventoryData, storageData); + float percent = (float) count / parts.size() * 100; + DecimalFormat df = new DecimalFormat("#.#"); + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + text + ": " + getColor(percent) + + df.format(percent) + "%"); + } + + private EnumChatFormatting getColor(float percent) { + if (percent >= 66) + return EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowAllColor]; + else if (percent >= 33) + return EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowMiddleColor]; + else + return EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowNoneColor]; + } + + private int getCount(HashMap<String, Boolean> parts, HashMap<String, Integer> inventoryData, HashMap<String, Integer> storageData) { + int count = 0; + for (String part : parts.keySet()) + if (parts.get(part) || inventoryData.get(part) > 0 || storageData.get(part) > 0) + count++; + return count; + } + + private int getCountCrystal(HashMap<String, Integer> parts) { + int count = 0; + for (String part : parts.keySet()) + if (parts.get(part) > 0) + count++; + return count; + } + + private boolean automatonCheck() { + return NotEnoughUpdates.INSTANCE.config.mining.crystalHollowAutomatonLocation == 0 || + NotEnoughUpdates.INSTANCE.config.mining.crystalHollowAutomatonLocation == 1 && + SBInfo.getInstance().location.equals("Precursor Remnants") || + NotEnoughUpdates.INSTANCE.config.mining.crystalHollowAutomatonLocation >= 1 && + SBInfo.getInstance().location.equals("Lost Precursor City"); + } + + private boolean divanCheck() { + return NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDivanLocation == 0 || + NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDivanLocation == 1 && + SBInfo.getInstance().location.equals("Mithril Deposits") || + NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDivanLocation >= 1 && + SBInfo.getInstance().location.equals("Mines of Divan"); + } + + private boolean crystalCheck() { + return NotEnoughUpdates.INSTANCE.config.mining.crystalHollowCrystalLocation == 0 || !divanCheck() && !automatonCheck(); + } + + public void message(String message) { + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); + if (hidden == null) return; + + Matcher crystalNotPlacedMatcher = crystalNotPlacedPattern.matcher(message); + Matcher crystalPlacedMatcher = crystalPlacedPattern.matcher(message); + Matcher crystalPlaceMatcher = crystalPlacePattern.matcher(message); + Matcher crystalReclaimMatcher = crystalReclaimPattern.matcher(message); + if (message.equals(" You've earned a Crystal Loot Bundle!")) + hidden.crystals.replaceAll((k, v) -> 0); + if (crystalNotPlacedMatcher.matches() && hidden.crystals.containsKey(crystalNotPlacedMatcher.group("crystal"))) { + hidden.crystals.put(crystalNotPlacedMatcher.group("crystal"), 1); + resetCrystal(hidden, crystalNotPlacedMatcher.group("crystal")); + } else if (crystalPlacedMatcher.matches() && hidden.crystals.containsKey(crystalPlacedMatcher.group("crystal"))) { + hidden.crystals.put(crystalPlacedMatcher.group("crystal"), 2); + resetCrystal(hidden, crystalPlacedMatcher.group("crystal")); + } else if (crystalPlaceMatcher.matches() && hidden.crystals.containsKey(crystalPlaceMatcher.group("crystal"))) + hidden.crystals.put(crystalPlaceMatcher.group("crystal"), 2); + else if (crystalReclaimMatcher.matches() && hidden.crystals.containsKey(crystalReclaimMatcher.group("crystal"))) + hidden.crystals.put(crystalReclaimMatcher.group("crystal"), 1); + else if (message.startsWith("[NPC] Keeper of ")) { + Matcher foundMatcher = foundPattern.matcher(message); + Matcher alreadyFoundMatcher = alreadyFoundPattern.matcher(message); + Matcher notFoundMatcher = notFoundPattern.matcher(message); + Matcher resetMatcher = resetPattern.matcher(message); + if (foundMatcher.matches() && hidden.divanMinesParts.containsKey(foundMatcher.group("item"))) + hidden.divanMinesParts.put(foundMatcher.group("item"), true); + else if (notFoundMatcher.matches() && hidden.divanMinesParts.containsKey(notFoundMatcher.group("item"))) + hidden.divanMinesParts.put(notFoundMatcher.group("item"), false); + else if (resetMatcher.matches()) + hidden.divanMinesParts.replaceAll((k, v) -> false); + else if (alreadyFoundMatcher.matches() && hidden.divanMinesParts.containsKey(alreadyFoundMatcher.group("item"))) + hidden.divanMinesParts.put(alreadyFoundMatcher.group("item"), true); + } else if (message.startsWith(" ")) { + Matcher crystalMatcher = obtainCrystalPattern.matcher(message); + if (crystalMatcher.matches() && hidden.crystals.containsKey(crystalMatcher.group("crystal"))) + hidden.crystals.put(crystalMatcher.group("crystal"), 1); + else { + String item = message.replace(" ", ""); + if (hidden.automatonParts.containsKey(item)) + hidden.automatonParts.put(item, false); + } + } else if (message.startsWith("[NPC] Professor Robot: ")) { + switch (message) { + case "[NPC] Professor Robot: That's not one of the components I need! Bring me one of the missing components:": + hidden.automatonParts.replaceAll((k, v) -> true); + break; + case "[NPC] Professor Robot: You've brought me all of the components!": + hidden.automatonParts.replaceAll((k, v) -> false); + break; + default: + Matcher giveMatcher = givePattern.matcher(message); + Matcher notFinalMatcher = notFinalPattern.matcher(message); + if (giveMatcher.matches()) { + String item = giveMatcher.group("part"); + if (hidden.automatonParts.containsKey(item)) { + hidden.automatonParts.put(item, true); + } + } else if (notFinalMatcher.matches()) { + String item = notFinalMatcher.group("part"); + if (hidden.automatonParts.containsKey(item)) { + hidden.automatonParts.replaceAll((k, v) -> true); + hidden.automatonParts.put(item, false); + } + } + break; + } + } + } + + private void resetCrystal(NEUConfig.HiddenProfileSpecific hidden, String crystal) { + switch (crystal) { + case "Sapphire": + hidden.automatonParts.replaceAll((k, v) -> false); + break; + case "Jade": + hidden.divanMinesParts.replaceAll((k, v) -> false); + break; + } + } + + @Override + protected void renderLine(String line, Vector2f position, boolean dummy) { + if (!NotEnoughUpdates.INSTANCE.config.mining.crystalHollowIcons) return; + GlStateManager.enableDepth(); + + ItemStack icon = null; + String cleaned = Utils.cleanColour(line); + String beforeColon = cleaned.split(":")[0]; + switch (beforeColon) { + case "Scavenged Lapis Sword": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_LAPIS_SWORD")); + break; + case "Scavenged Golden Hammer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_GOLD_HAMMER")); + break; + case "Scavenged Diamond Axe": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_DIAMOND_AXE")); + break; + case "Scavenged Emerald Hammer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_EMERALD_HAMMER")); + break; + case "Electron Transmitter": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ELECTRON_TRANSMITTER")); + break; + case "FTX 3070": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("FTX_3070")); + break; + case "Robotron Reflector": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ROBOTRON_REFLECTOR")); + break; + case "Superlite Motor": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SUPERLITE_MOTOR")); + break; + case "Control Switch": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("CONTROL_SWITCH")); + break; + case "Synthetic Heart": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SYNTHETIC_HEART")); + break; + case "Amber": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_AMBER_GEM")); + break; + case "Sapphire": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_SAPPHIRE_GEM")); + break; + case "Jade": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_JADE_GEM")); + break; + case "Amethyst": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_AMETHYST_GEM")); + break; + case "Topaz": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_TOPAZ_GEM")); + break; + } + + if (icon != null) { + GlStateManager.pushMatrix(); + GlStateManager.translate(position.x, position.y, 0); + GlStateManager.scale(0.5f, 0.5f, 1f); + Utils.drawItemStack(icon, 0, 0); + GlStateManager.popMatrix(); + + position.x += 12; + } + + super.renderLine(line, position, dummy); + } + + @Override + protected Vector2f getSize(List<String> strings) { + if (NotEnoughUpdates.INSTANCE.config.mining.crystalHollowIcons) + return super.getSize(strings).translate(12, 0); + return super.getSize(strings); + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index bafd04b6..8a4c697e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -2,18 +2,19 @@ package io.github.moulberry.notenoughupdates.overlays; import com.google.common.collect.ComparisonChain; import com.google.common.collect.Ordering; -import com.google.gson.JsonObject; +import com.google.gson.annotations.Expose; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.notenoughupdates.core.util.StringUtils; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils; -import io.github.moulberry.notenoughupdates.cosmetics.CapeManager; import io.github.moulberry.notenoughupdates.miscfeatures.ItemCooldowns; +import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -22,6 +23,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.WorldSettings; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.lwjgl.util.vector.Vector2f; import java.util.*; import java.util.function.Supplier; @@ -36,12 +38,12 @@ public class MiningOverlay extends TextOverlay { super(position, dummyStrings, styleSupplier); } - private static final Pattern NUMBER_PATTERN = Pattern.compile("\\d+(?: |$)"); - private static Map<String, Integer> commissionMaxes = new HashMap<>(); + private static final Pattern NUMBER_PATTERN = Pattern.compile("(?<number>\\d*,?\\d+)(?: |$)"); public static Map<String, Float> commissionProgress = new LinkedHashMap<>(); @Override public void updateFrequent() { + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) { GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; ContainerChest container = (ContainerChest) chest.inventorySlots; @@ -64,7 +66,7 @@ public class MiningOverlay extends TextOverlay { Matcher matcher = NUMBER_PATTERN.matcher(clean); if(matcher.find()) { try { - numberValue = Integer.parseInt(matcher.group()); + numberValue = Integer.parseInt(matcher.group("number").replace(",", "")); } catch(NumberFormatException ignored) {} } } @@ -77,17 +79,78 @@ public class MiningOverlay extends TextOverlay { } } if(name != null && numberValue > 0) { - commissionMaxes.put(name, numberValue); + NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.put(name, numberValue); } } } + } else if(containerName.equals("Forge") && lower.getSizeInventory() >= 36 && hidden != null) { + + itemLoop: + for (int i = 0; i < 5; i++) { + ItemStack stack = lower.getStackInSlot(i + 11); + if (stack != null) { + + String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound()); + + + for (int i1 = 0; i1 < lore.length; i1++) { + String line = lore[i1]; + Matcher matcher = timeRemainingForge.matcher(line); + if (stack.getDisplayName().matches("\\xA7cSlot #([1-5])")) { + ForgeItem newForgeItem = new ForgeItem(i, 1, false); + replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + //empty Slot + } else if (stack.getDisplayName().matches("\\xA7aSlot #([1-5])")) { + ForgeItem newForgeItem = new ForgeItem(i, 0, false); + replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + } else if (matcher.matches()) { + String timeremainingString = matcher.group(1); + + long duration = 0; + + if (matcher.group("Completed") != null && !matcher.group("Completed").equals("")) { + ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), 0, i, false); + replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + } else { + + try { + if (matcher.group("days") != null && !matcher.group("days").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("days")) * 24 * 60 * 60 * 1000; + } + if (matcher.group("hours") != null && !matcher.group("hours").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("hours")) * 60 * 60 * 1000; + } + if (matcher.group("minutes") != null && !matcher.group("minutes").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("minutes")) * 60 * 1000; + } + if (matcher.group("seconds") != null && !matcher.group("seconds").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("seconds")) * 1000; + } + } catch (Exception ignored) { + } + if (duration > 0) { + ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), System.currentTimeMillis() + duration, i, false); + replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + } + } + + continue itemLoop; + } + } + //Locked Slot + + } + } } } } + private static final Pattern timeRemainingForge = Pattern.compile("\\xA77Time Remaining: \\xA7a((?<Completed>Completed!)|(((?<days>[0-9]+)d)? ?((?<hours>[0-9]+)h)? ?((?<minutes>[0-9]+)m)? ?((?<seconds>[0-9]+)s)?))"); + private static final Pattern timeRemainingTab = Pattern.compile(".*[1-5]\\) (?<ItemName>.*): ((?<Ready>Ready!)|(((?<days>[0-9]+)d)? ?((?<hours>[0-9]+)h)? ?((?<minutes>[0-9]+)m)? ?((?<seconds>[0-9]+)s)?))"); @Override public void update() { overlayStrings = null; + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); /*if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) { GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; @@ -155,92 +218,140 @@ public class MiningOverlay extends TextOverlay { } }*/ - if(!NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlay) return; + if(!NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlay && NotEnoughUpdates.INSTANCE.config.mining.emissaryWaypoints == 0) return; if(SBInfo.getInstance().getLocation() == null) return; - if(!SBInfo.getInstance().getLocation().equals("mining_3") && !SBInfo.getInstance().getLocation().equals("crystal_hollows")) return; - - overlayStrings = new ArrayList<>(); - commissionProgress.clear(); - List<String> forgeStrings = new ArrayList<>(); - List<String> forgeStringsEmpty = new ArrayList<>(); - String mithrilPowder = null; - String gemstonePowder = null; - - boolean commissions = false; - boolean forges = false; - List<NetworkPlayerInfo> players = playerOrdering.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); - for(NetworkPlayerInfo info : players) { - String name = Minecraft.getMinecraft().ingameGUI.getTabList().getPlayerName(info); - if(name.contains("Mithril Powder:")) { - mithrilPowder = DARK_AQUA+Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""); - } - if(name.contains("Gemstone Powder:")) { - gemstonePowder = DARK_AQUA+Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""); - } - if(name.equals(RESET.toString()+BLUE+BOLD+"Forges "+RESET)) { - commissions = false; - forges = true; - continue; - } else if(name.equals(RESET.toString()+BLUE+BOLD+"Commissions"+RESET)) { - commissions = true; - forges = false; - continue; - } - String clean = StringUtils.cleanColour(name); - if(forges && clean.startsWith(" ")) { - char firstChar = clean.trim().charAt(0); - if(firstChar < '0' || firstChar > '9') { + if(SBInfo.getInstance().getLocation().equals("mining_3") || SBInfo.getInstance().getLocation().equals("crystal_hollows")) { + + overlayStrings = new ArrayList<>(); + commissionProgress.clear(); + + String mithrilPowder = null; + String gemstonePowder = null; + int forgeInt = 0; + boolean commissions = false; + boolean forges = false; + List<NetworkPlayerInfo> players = playerOrdering.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); + + for (NetworkPlayerInfo info : players) { + String name = Minecraft.getMinecraft().ingameGUI.getTabList().getPlayerName(info); + if (name.contains("Mithril Powder:")) { + mithrilPowder = DARK_AQUA + Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""); + } + if (name.contains("Gemstone Powder:")) { + gemstonePowder = DARK_AQUA + Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""); + } + + + if (name.matches("\\xa7r\\xa79\\xa7lForges \\xa7r(?:\\xa7f\\(\\+1 more\\)\\xa7r)?")) { + commissions = false; + forges = true; + continue; + } else if (name.equals(RESET.toString() + BLUE + BOLD + "Commissions" + RESET)) { + commissions = true; forges = false; - } else { - if(name.contains("LOCKED")) continue; - if(name.contains("EMPTY")) { - forgeStringsEmpty.add(DARK_AQUA+"Forge "+ Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", "")); - } else { - forgeStrings.add(DARK_AQUA+"Forge "+ Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", "")); - } + continue; } - } else if(commissions && clean.startsWith(" ")) { - String[] split = clean.trim().split(": "); - if(split.length == 2) { - if(split[1].endsWith("%")) { - try { - float progress = Float.parseFloat(split[1].replace("%", ""))/100; - progress = LerpUtils.clampZeroOne(progress); - commissionProgress.put(split[0], progress); - } catch(Exception ignored) {} + String clean = StringUtils.cleanColour(name); + if (forges && clean.startsWith(" ")) { + + char firstChar = clean.trim().charAt(0); + if (firstChar < '0' || firstChar > '9') { + forges = false; } else { - commissionProgress.put(split[0], 1.0f); + + if (name.contains("LOCKED")) { + ForgeItem item = new ForgeItem(forgeInt, 1,true); + replaceForgeOrAdd(item, hidden.forgeItems, true); + } else if (name.contains("EMPTY")) { + ForgeItem item = new ForgeItem(forgeInt, 0,true); + replaceForgeOrAdd(item, hidden.forgeItems, true); + //forgeStringsEmpty.add(DARK_AQUA+"Forge "+ Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", "")); + } else { + String cleanName = Utils.cleanColour(name); + + Matcher matcher = timeRemainingTab.matcher(cleanName); + + if (matcher.matches()) { + + String itemName = matcher.group(1); + + if (matcher.group("Ready") != null && !matcher.group("Ready").equals("")) { + ForgeItem item = new ForgeItem(Utils.cleanColour(itemName), 0, forgeInt, true); + replaceForgeOrAdd(item, hidden.forgeItems, true); + } else { + long duration = 0; + try { + if (matcher.group("days") != null && !matcher.group("days").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("days")) * 24 * 60 * 60 * 1000; + } + if (matcher.group("hours") != null && !matcher.group("hours").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("hours")) * 60 * 60 * 1000; + } + if (matcher.group("minutes") != null && !matcher.group("minutes").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("minutes")) * 60 * 1000; + } + if (matcher.group("seconds") != null && !matcher.group("seconds").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("seconds")) * 1000; + } + } catch (Exception ignored) { + } + if (duration > 0) { + duration = duration + 4000; + ForgeItem item = new ForgeItem(Utils.cleanColour(itemName), System.currentTimeMillis() + duration, forgeInt, true); + replaceForgeOrAdd(item, hidden.forgeItems, false); + } + } + } + } + forgeInt++; + } + } else if (commissions && clean.startsWith(" ")) { + String[] split = clean.trim().split(": "); + if (split.length == 2) { + if (split[1].endsWith("%")) { + try { + float progress = Float.parseFloat(split[1].replace("%", "")) / 100; + progress = LerpUtils.clampZeroOne(progress); + commissionProgress.put(split[0], progress); + } catch (Exception ignored) { + } + } else { + commissionProgress.put(split[0], 1.0f); + } } + } else { + commissions = false; + forges = false; } - } else { - commissions = false; - forges = false; } - } + if (!NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlay) { + overlayStrings = null; + return; + } - List<String> commissionsStrings = new ArrayList<>(); - for(Map.Entry<String, Float> entry : commissionProgress.entrySet()) { - if(entry.getValue() >= 1) { - commissionsStrings.add(DARK_AQUA+entry.getKey() + ": " + GREEN + "DONE"); - } else { - EnumChatFormatting col = RED; - if(entry.getValue() >= 0.75) { - col = GREEN; - } else if(entry.getValue() >= 0.5) { - col = YELLOW; - } else if(entry.getValue() >= 0.25) { - col = GOLD; - } - if(true && commissionMaxes.containsKey(entry.getKey())) { - int max = commissionMaxes.get(entry.getKey()); - commissionsStrings.add(DARK_AQUA+entry.getKey() + ": " + col+Math.round(entry.getValue()*max)+"/"+max); + List<String> commissionsStrings = new ArrayList<>(); + for (Map.Entry<String, Float> entry : commissionProgress.entrySet()) { + if (entry.getValue() >= 1) { + commissionsStrings.add(DARK_AQUA + entry.getKey() + ": " + GREEN + "DONE"); } else { - String valS = Utils.floatToString(entry.getValue()*100, 1); + EnumChatFormatting col = RED; + if (entry.getValue() >= 0.75) { + col = GREEN; + } else if (entry.getValue() >= 0.5) { + col = YELLOW; + } else if (entry.getValue() >= 0.25) { + col = GOLD; + } + if (NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.containsKey(entry.getKey())) { + int max = NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.get(entry.getKey()); + commissionsStrings.add(DARK_AQUA + entry.getKey() + ": " + col + Math.round(entry.getValue() * max) + "/" + max); + } else { + String valS = Utils.floatToString(entry.getValue() * 100, 1); - commissionsStrings.add(DARK_AQUA+entry.getKey() + ": " + col+valS+"%"); + commissionsStrings.add(DARK_AQUA + entry.getKey() + ": " + col + valS + "%"); + } } } - } /*boolean hasAny = false; if(NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlay) { overlayStrings.addAll(commissionsStrings); @@ -258,31 +369,176 @@ public class MiningOverlay extends TextOverlay { overlayStrings.addAll(forgeStrings); }*/ - String pickaxeCooldown; - if(ItemCooldowns.pickaxeUseCooldownMillisRemaining <= 0) { - pickaxeCooldown = DARK_AQUA+"Pickaxe CD: \u00a7aReady"; + String pickaxeCooldown; + if (ItemCooldowns.pickaxeUseCooldownMillisRemaining <= 0) { + pickaxeCooldown = DARK_AQUA + "Pickaxe CD: \u00a7aReady"; + } else { + pickaxeCooldown = DARK_AQUA + "Pickaxe CD: \u00a7a" + (ItemCooldowns.pickaxeUseCooldownMillisRemaining / 1000) + "s"; + } + + + + for (int index : NotEnoughUpdates.INSTANCE.config.mining.dwarvenText2) { + switch (index) { + case 0: + overlayStrings.addAll(commissionsStrings); + break; + case 1: + overlayStrings.add(mithrilPowder); + break; + case 2: + overlayStrings.add(gemstonePowder); + break; + case 3: + overlayStrings.addAll(getForgeStrings(hidden.forgeItems)); + break; + case 4: + //overlayStrings.addAll(forgeStringsEmpty); break; + case 5: + overlayStrings.add(pickaxeCooldown); + break; + } + } } else { - pickaxeCooldown = DARK_AQUA+"Pickaxe CD: \u00a7a" + (ItemCooldowns.pickaxeUseCooldownMillisRemaining/1000) + "s"; + overlayStrings = new ArrayList<>(); + if(hidden == null){ + return; + } + boolean forgeDisplay = false; + for (int i = 0; i < NotEnoughUpdates.INSTANCE.config.mining.dwarvenText2.size(); i++) { + if(NotEnoughUpdates.INSTANCE.config.mining.dwarvenText2.get(i) == 3){ + forgeDisplay = true; + } + } + if(forgeDisplay){ + if(NotEnoughUpdates.INSTANCE.config.mining.forgeDisplayEnabledLocations == 1 && !SBInfo.getInstance().isInDungeon){ + overlayStrings.addAll(getForgeStrings(hidden.forgeItems)); + } else if(NotEnoughUpdates.INSTANCE.config.mining.forgeDisplayEnabledLocations == 2){ + overlayStrings.addAll(getForgeStrings(hidden.forgeItems)); + } + } } - for(int index : NotEnoughUpdates.INSTANCE.config.mining.dwarvenText) { - switch(index) { - case 0: - overlayStrings.addAll(commissionsStrings); break; - case 1: - overlayStrings.add(mithrilPowder); break; - case 2: - overlayStrings.add(gemstonePowder); break; - case 3: - overlayStrings.addAll(forgeStrings); break; - case 4: - overlayStrings.addAll(forgeStringsEmpty); break; - case 5: - overlayStrings.add(pickaxeCooldown); break; + if(overlayStrings.isEmpty()) overlayStrings = null; + } + + private static List<String> getForgeStrings(List<ForgeItem> forgeItems){ + List<String> forgeString = new ArrayList<>(); + long currentTimeMillis = System.currentTimeMillis(); + forgeIDLabel: + for (int i = 0; i < 5; i++) { + for (int y = 0; y < forgeItems.size(); y++) { + if (forgeItems.get(y).forgeID == i) { + ForgeItem item = forgeItems.get(y); + if (NotEnoughUpdates.INSTANCE.config.mining.forgeDisplay == 0) { + if (item.status == 2 && item.finishTime < currentTimeMillis) { + + forgeString.add(item.getFormattedString(currentTimeMillis)); + continue forgeIDLabel; + } + } else if (NotEnoughUpdates.INSTANCE.config.mining.forgeDisplay == 1) { + if (item.status == 2) { + + forgeString.add(item.getFormattedString(currentTimeMillis)); + continue forgeIDLabel; + } + } else if (NotEnoughUpdates.INSTANCE.config.mining.forgeDisplay == 2) { + if (item.status == 2 || item.status ==0) { + + forgeString.add(item.getFormattedString(currentTimeMillis)); + continue forgeIDLabel; + } + } else if (NotEnoughUpdates.INSTANCE.config.mining.forgeDisplay == 3) { + + forgeString.add(item.getFormattedString(currentTimeMillis)); + continue forgeIDLabel; + } + } } } + return forgeString; + } - if(overlayStrings.isEmpty()) overlayStrings = null; + private static void replaceForgeOrAdd(ForgeItem item, List<ForgeItem> forgeItems, boolean overwrite){ + for (int i = 0; i < forgeItems.size(); i++) { + if (forgeItems.get(i).forgeID == item.forgeID) { + if (overwrite) { + forgeItems.set(i, item); + return; + } else { + ForgeItem currentItem = forgeItems.get(i); + if (!(currentItem.status == 2 && item.status ==2)) { + forgeItems.set(i, item); + return; + } else if(currentItem.fromScoreBoard){ + forgeItems.set(i, item); + return; + } + } + return; + } + } + forgeItems.add(item); + return; + } + + public static class ForgeItem{ + public ForgeItem(String itemName, long finishTime, int forgeID, boolean fromScoreBoard){ + this.itemName = itemName; + this.finishTime = finishTime; + this.status = 2; + this.forgeID = forgeID; + this.fromScoreBoard = fromScoreBoard; + } + + public ForgeItem(int forgeID, int status, boolean fromScoreBoard){ + this.forgeID = forgeID; + this.status = status; + this.fromScoreBoard = fromScoreBoard; + } + + + @Expose public String itemName; + @Expose public long finishTime; + @Expose public final int status; + @Expose public final int forgeID; + @Expose public final boolean fromScoreBoard; + + + + public String getFormattedString(long currentTimeMillis){ + String returnText = EnumChatFormatting.DARK_AQUA+"Forge "+(this.forgeID+1)+": "; + if(status == 0){ + return returnText +EnumChatFormatting.GRAY +"Empty"; + } else if(status == 1){ + return returnText+ EnumChatFormatting.DARK_RED+"Locked"; + } + + long timeDuration = finishTime - currentTimeMillis; + returnText = returnText+ EnumChatFormatting.DARK_PURPLE +this.itemName+": "; + + int days = (int) (timeDuration / (1000*60*60*24)); + timeDuration = timeDuration-(days*(1000*60*60*24)); + int hours = (int) ((timeDuration / (1000*60*60)) % 24); + + if(days > 0){ + return returnText+EnumChatFormatting.AQUA+days+"d "+hours+"h"; + } + timeDuration = timeDuration-(hours*(1000*60*60)); + int minutes = (int) ((timeDuration / (1000*60)) % 60); + if(hours > 0){ + return returnText+EnumChatFormatting.AQUA+hours+"h "+minutes+"m"; + } + timeDuration = timeDuration-(minutes*(1000*60)); + int seconds = (int) (timeDuration / 1000) % 60 ; + if(minutes > 0){ + return returnText+EnumChatFormatting.AQUA+minutes+"m "+seconds+"s"; + } else if(seconds > 0){ + return returnText+EnumChatFormatting.AQUA+seconds+"s"; + } else { + return returnText+ EnumChatFormatting.DARK_GREEN+"Done"; + } + } } private static final Ordering<NetworkPlayerInfo> playerOrdering = Ordering.from(new PlayerComparator()); @@ -302,5 +558,102 @@ public class MiningOverlay extends TextOverlay { } } + @Override + protected Vector2f getSize(List<String> strings) { + if (NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlayIcons) + return super.getSize(strings).translate(12, 0); + return super.getSize(strings); + } + + @Override + protected void renderLine(String line, Vector2f position, boolean dummy) { + if (!NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlayIcons) return; + GlStateManager.enableDepth(); + + ItemStack icon = null; + String cleaned = Utils.cleanColour(line); + String beforeColon = cleaned.split(":")[0]; + switch (beforeColon) { + case "Mithril Powder": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("INK_SACK-10")); + break; + case "Gemstone Powder": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("INK_SACK-9")); + break; + case "Lucky Raffle": + case "Raffle": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("MINING_RAFFLE_TICKET")); + break; + case "Pickaxe CD": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DIAMOND_PICKAXE")); + break; + case "Thyst Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("THYST_MONSTER")); + break; + case "Hard Stone Miner": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("HARD_STONE")); + break; + case "Ice Walker Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ENCHANTED_ICE")); + break; + case "Goblin Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("GOBLIN_MONSTER")); + break; + case "Star Sentry Puncher": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("NETHER_STAR")); + break; + case "Goblin Raid": + case "Goblin Raid Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ENCHANTED_GOLD")); + break; + case "2x Mithril Powder Collector": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ENCHANTED_GLOWSTONE_DUST")); + break; + case "Automaton Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("AUTOMATON_MONSTER")); + break; + case "Sludge Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SLUDGE_MONSTER")); + break; + case "Team Treasurite Member Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("EXECUTIVE_WENDY_MONSTER")); + break; + case "Yog Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("YOG_MONSTER")); + break; + case "Boss Corleone Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("BOSS_CORLEONE_BOSS")); + break; + case "Chest Looter": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("CHEST")); + break; + } + if (icon == null) { + if(beforeColon.startsWith("Forge")){ + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ANVIL")); + } else if (beforeColon.contains("Mithril")) { + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("MITHRIL_ORE")); + } else if(beforeColon.endsWith(" Gemstone Collector")){ + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ROUGH_" + + beforeColon.replace(" Gemstone Collector", "").toUpperCase() + "_GEM")); + } else if (beforeColon.endsWith(" Crystal Hunter")){ + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_" + + beforeColon.replace(" Crystal Hunter", "").toUpperCase() + "_GEM")); + } else if (beforeColon.contains("Titanium")) { + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("TITANIUM_ORE")); + } + } + + if (icon != null) { + GlStateManager.pushMatrix(); + GlStateManager.translate(position.x, position.y, 0); + GlStateManager.scale(0.5f, 0.5f, 1f); + Utils.drawItemStack(icon, 0, 0); + GlStateManager.popMatrix(); + position.x += 12; + } + + super.renderLine(line, position, dummy); + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java index 357815b7..b1cf5b11 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java @@ -15,6 +15,8 @@ public class OverlayManager { public static FarmingOverlay farmingOverlay; public static PetInfoOverlay petInfoOverlay; public static TimersOverlay timersOverlay; + public static BonemerangOverlay bonemerangOverlay; + public static CrystalHollowOverlay crystalHollowOverlay; public static final List<TextOverlay> textOverlays = new ArrayList<>(); static { @@ -53,7 +55,7 @@ public class OverlayManager { "\u00a73Forge 2) \u00a77EMPTY\n\u00a73Forge 3) \u00a77EMPTY\n\u00a73Forge 4) \u00a77EMPTY"); miningOverlay = new MiningOverlay(NotEnoughUpdates.INSTANCE.config.mining.overlayPosition, () -> { List<String> strings = new ArrayList<>(); - for(int i : NotEnoughUpdates.INSTANCE.config.mining.dwarvenText) { + for(int i : NotEnoughUpdates.INSTANCE.config.mining.dwarvenText2) { if(i >= 0 && i < miningDummy.size()) strings.add(miningDummy.get(i)); } return strings; @@ -108,10 +110,69 @@ public class OverlayManager { return TextOverlayStyle.BACKGROUND; }); + List<String> bonemerangDummy = Lists.newArrayList( + "\u00a74Gonna break", + "\u00a77Targets: \u00a76\u00a7lLike alot" + ); + bonemerangOverlay = new BonemerangOverlay(NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangPosition, () -> bonemerangDummy, () -> { + int style = NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangOverlayStyle; + if(style >= 0 && style < TextOverlayStyle.values().length) { + return TextOverlayStyle.values()[style]; + } + return TextOverlayStyle.BACKGROUND; + }); + List<String> crystalHollowOverlayDummy = Lists.newArrayList( + "\u00a73Amber Crystal: \u00a7aPlaced\n" + + "\u00a73Sapphire Crystal: \u00a7eCollected\n" + + "\u00a73Jade Crystal: \u00a7eMissing\n" + + "\u00a73Amethyst Crystal: \u00a7cMissing\n" + + "\u00a73Topaz Crystal: \u00a7cMissing\n", + "\u00a73Crystals: \u00a7a4/5", + "\u00a73Crystals: \u00a7a80%", + "\u00a73Electron Transmitter: \u00a7aDone\n" + + "\u00a73Robotron Reflector: \u00a7eIn Storage\n" + + "\u00a73Superlite Motor: \u00a7eIn Inventory\n" + + "\u00a73Synthetic Hearth: \u00a7cMissing\n" + + "\u00a73Control Switch: \u00a7cMissing\n" + + "\u00a73FTX 3070: \u00a7cMissing", + "\u00a73Electron Transmitter: \u00a7a3\n" + + "\u00a73Robotron Reflector: \u00a7e2\n" + + "\u00a73Superlite Motor: \u00a7e1\n" + + "\u00a73Synthetic Hearth: \u00a7c0\n" + + "\u00a73Control Switch: \u00a7c0\n" + + "\u00a73FTX 3070: \u00a7c0", + "\u00a73Automaton parts: \u00a7a5/6", + "\u00a73Automaton parts: \u00a7a83%", + "\u00a73Scavenged Lapis Sword: \u00a7aDone\n" + + "\u00a73Scavenged Golden Hammer: \u00a7eIn Storage\n" + + "\u00a73Scavenged Diamond Axe: \u00a7eIn Inventory\n" + + "\u00a73Scavenged Emerald Hammer: \u00a7cMissing\n", + "\u00a73Scavenged Lapis Sword: \u00a7a3\n" + + "\u00a73Scavenged Golden Hammer: \u00a7e2\n" + + "\u00a73Scavenged Diamond Axe: \u00a7e1\n" + + "\u00a73Scavenged Emerald Hammer: \u00a7c0\n", + "\u00a73Mines of Divan parts: \u00a7a3/4", + "\u00a73Mines of Divan parts: \u00a7a75%" + ); + crystalHollowOverlay = new CrystalHollowOverlay(NotEnoughUpdates.INSTANCE.config.mining.crystalHollowOverlayPosition, () -> { + List<String> strings = new ArrayList<>(); + for (int i : NotEnoughUpdates.INSTANCE.config.mining.crystalHollowText) { + if (i >= 0 && i < crystalHollowOverlayDummy.size()) strings.add(crystalHollowOverlayDummy.get(i)); + } + return strings; + }, () -> { + int style = NotEnoughUpdates.INSTANCE.config.mining.crystalHollowOverlayStyle; + if (style >= 0 && style < TextOverlayStyle.values().length) { + return TextOverlayStyle.values()[style]; + } + return TextOverlayStyle.BACKGROUND; + }); + textOverlays.add(miningOverlay); textOverlays.add(farmingOverlay); textOverlays.add(petInfoOverlay); - + textOverlays.add(bonemerangOverlay); + textOverlays.add(crystalHollowOverlay); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java index e9338f94..8c5c119d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java @@ -1,5 +1,6 @@ package io.github.moulberry.notenoughupdates.overlays; +import io.github.moulberry.notenoughupdates.NEUManager; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.notenoughupdates.options.NEUConfig; @@ -13,6 +14,8 @@ import net.minecraft.init.Items; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; @@ -82,7 +85,9 @@ public class TimersOverlay extends TextOverlay { @Override protected Vector2f getSize(List<String> strings) { - return super.getSize(strings).translate(12, 0); + if(NotEnoughUpdates.INSTANCE.config.miscOverlays.todoIcons) + return super.getSize(strings).translate(12, 0); + return super.getSize(strings); } private static final ItemStack CAKES_ICON = new ItemStack(Items.cake); @@ -129,7 +134,10 @@ public class TimersOverlay extends TextOverlay { ZonedDateTime currentTimeEST = ZonedDateTime.now(ZoneId.of("America/Atikokan")); - long fetchurIndex = (currentTimeEST.getDayOfMonth() % 13)-1; + long fetchurIndex = ((currentTimeEST.getDayOfMonth()+1) % 13)-1; + //Added because disabled fetchur and enabled it again but it was showing the wrong item + //Lets see if this stays correct + if(fetchurIndex < 0) fetchurIndex += 13; icon = FETCHUR_ICONS[(int)fetchurIndex]; @@ -190,11 +198,27 @@ public class TimersOverlay extends TextOverlay { if (stack.getItem() == Items.blaze_powder) { if (hidden.experimentsCompleted == 0) { hidden.experimentsCompleted = currentTime; + return; } - } else { - hidden.experimentsCompleted = 0; } } + ItemStack stackSuperPairs = lower.getStackInSlot(22); + if(stackSuperPairs != null && stackSuperPairs.getItem() == Items.skull && stackSuperPairs.getTagCompound() != null){ + String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stackSuperPairs.getTagCompound()); + String text = lore[lore.length-1]; + String cleanText = Utils.cleanColour(text); + if(cleanText.equals("Experiments on cooldown!")){ + hidden.experimentsCompleted = currentTime; + return; + } + } + hidden.experimentsCompleted = 0; + return; + } else if(containerName.equals("Superpairs Rewards") && lower.getSizeInventory() >= 27){ + ItemStack stack = lower.getStackInSlot(13); + if(Utils.cleanColour(stack.getDisplayName()).equals("Superpairs")){ + hidden.experimentsCompleted = currentTime; + } } } @@ -224,7 +248,6 @@ public class TimersOverlay extends TextOverlay { } if (godpotRemaingTimeUnformatted.length >= 1) { godPotDuration = godPotDuration + (long) Integer.parseInt(godpotRemaingTimeUnformatted[i]) * 1000; - } } catch (Exception ignored) { } @@ -349,7 +372,7 @@ public class TimersOverlay extends TextOverlay { hidden.godPotionDuration < TimeEnums.DAY.time) { map.put(2, DARK_AQUA + "Godpot: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour] + Utils.prettyTime(hidden.godPotionDuration)); } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.godpotDisplay >= DISPLAYTYPE.ALWAYS.ordinal()) { - map.put(2, DARK_AQUA + "Godpotf: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour] + Utils.prettyTime(hidden.godPotionDuration)); + map.put(2, DARK_AQUA + "Godpot: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour] + Utils.prettyTime(hidden.godPotionDuration)); } } 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 449b642b..01f789de 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -11,15 +11,17 @@ import com.mojang.authlib.minecraft.MinecraftProfileTexture; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager; import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField; -import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Constants; +import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.*; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.resources.DefaultPlayerSkin; import net.minecraft.client.resources.SkinManager; @@ -32,7 +34,9 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.*; -import net.minecraft.util.*; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.Matrix4f; +import net.minecraft.util.ResourceLocation; import org.apache.commons.lang3.text.WordUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -42,9 +46,15 @@ import org.lwjgl.opengl.GL20; import java.awt.*; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.text.NumberFormat; -import java.util.*; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; import java.util.List; +import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadPoolExecutor; @@ -63,6 +73,7 @@ public class GuiProfileViewer extends GuiScreen { public static final ResourceLocation pv_dropdown = new ResourceLocation("notenoughupdates:pv_dropdown.png"); public static final ResourceLocation pv_bg = new ResourceLocation("notenoughupdates:pv_bg.png"); public static final ResourceLocation pv_elements = new ResourceLocation("notenoughupdates:pv_elements.png"); + public static final ResourceLocation pv_ironman = new ResourceLocation("notenoughupdates:pv_ironman.png"); public static final ResourceLocation resource_packs = new ResourceLocation("minecraft:textures/gui/resource_packs.png"); public static final ResourceLocation icons = new ResourceLocation("textures/gui/icons.png"); @@ -138,6 +149,12 @@ public class GuiProfileViewer extends GuiScreen { if(profileId == null && profile != null && profile.getLatestProfile() != null) { profileId = profile.getLatestProfile(); } + { + //this is just to cache the guild info + if(profile != null) { + JsonObject guildinfo = profile.getGuildInfo(null); + } + } this.sizeX = 431; this.sizeY = 202; @@ -175,12 +192,29 @@ public class GuiProfileViewer extends GuiScreen { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); if(profile != null) { + JsonObject currProfileInfo = profile.getProfileInformation(profileId); + //Render Profile chooser button renderBlurredBackground(width, height, guiLeft+2, guiTop+sizeY+3+2, 100-4, 20-4); Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown); Utils.drawTexturedRect(guiLeft, guiTop+sizeY+3, 100, 20, 0, 100/200f, 0, 20/185f, GL11.GL_NEAREST); Utils.drawStringCenteredScaledMaxWidth(profileId, Minecraft.getMinecraft().fontRendererObj, guiLeft+50, guiTop+sizeY+3+10, true, 90, new Color(63, 224, 208, 255).getRGB()); + if(currProfileInfo != null && currProfileInfo.has("game_mode") && currProfileInfo.get("game_mode").getAsString().equals("ironman")) { + GlStateManager.color(1, 1, 1, 1); + Minecraft.getMinecraft().getTextureManager().bindTexture(pv_ironman); + Utils.drawTexturedRect(guiLeft-16-5, guiTop+sizeY+5, 16, 16, GL11.GL_NEAREST); + } + //Render Open In Skycrypt button + renderBlurredBackground(width, height, guiLeft+100+6+2, guiTop+sizeY+3+2, 100-4, 20-4); + Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown); + Utils.drawTexturedRect(guiLeft+100+6, guiTop+sizeY+3, 100, 20, + 0, 100/200f, 0, 20/185f, GL11.GL_NEAREST); + Utils.drawStringCenteredScaledMaxWidth("Open in Skycrypt", Minecraft.getMinecraft().fontRendererObj, guiLeft+50+100+6, + guiTop+sizeY+3+10, true, 90, new Color(63, 224, 208, 255).getRGB()); + + + if(profileDropdownSelected && !profile.getProfileIds().isEmpty() && scaledResolution.getScaleFactor() != 4) { int dropdownOptionSize = scaledResolution.getScaleFactor()==3?10:20; @@ -200,6 +234,12 @@ public class GuiProfileViewer extends GuiScreen { String otherProfileId = profile.getProfileIds().get(yIndex); Utils.drawStringCenteredScaledMaxWidth(otherProfileId, Minecraft.getMinecraft().fontRendererObj, guiLeft+50, guiTop+sizeY+23+dropdownOptionSize/2f+dropdownOptionSize*yIndex, true, 90, new Color(33, 112, 104, 255).getRGB()); + currProfileInfo = profile.getProfileInformation(otherProfileId); + if(currProfileInfo != null && currProfileInfo.has("game_mode") && currProfileInfo.get("game_mode").getAsString().equals("ironman")) { + GlStateManager.color(1, 1, 1, 1); + Minecraft.getMinecraft().getTextureManager().bindTexture(pv_ironman); + Utils.drawTexturedRect(guiLeft-16-5, guiTop+sizeY+2+23+dropdownOptionSize*yIndex, 16, 16, GL11.GL_NEAREST); + } } } @@ -382,6 +422,21 @@ public class GuiProfileViewer extends GuiScreen { return; } } + if(mouseX > guiLeft+106 && mouseX < guiLeft+106+100 && profile != null && !profile.getProfileIds().isEmpty() && profileId != null) { + if(mouseY > guiTop+sizeY+3 && mouseY < guiTop+sizeY+23) { + try{ + Desktop desk = Desktop.getDesktop(); + desk.browse(new URI("https://sky.shiiyu.moe/stats/"+profile.getHypixelProfile().get("displayname").getAsString()+"/"+profileId)); + Utils.playPressSound(); + return; + } catch (IOException | URISyntaxException ignored) { + //no idea how this sounds, but ya know just in case + Utils.playSound(new ResourceLocation("game.player.hurt"), true); + return; + } + } + } + if(mouseX > guiLeft && mouseX < guiLeft+100 && profile != null && !profile.getProfileIds().isEmpty()) { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); if(mouseY > guiTop+sizeY+3 && mouseY < guiTop+sizeY+23) { @@ -502,6 +557,15 @@ public class GuiProfileViewer extends GuiScreen { } } } + if(mouseX >= guiLeft-29 && mouseX <= guiLeft){ + if(mouseY >= guiTop && mouseY<= guiTop+28){ + onMasterMode = false; + return; + } else if(mouseY+28 >= guiTop && mouseY<= guiTop+28*2){ + onMasterMode = true; + return; + } + } } protected void keyTypedDung(char typedChar, int keyCode) { @@ -703,6 +767,13 @@ public class GuiProfileViewer extends GuiScreen { } } + private static final LinkedHashMap<String, ItemStack> dungeonsModeIcons = new LinkedHashMap<>(); + static { + dungeonsModeIcons.put("catacombs", Utils.editItemStackInfo(NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DUNGEON_STONE")),EnumChatFormatting.GRAY+"Normal Mode", true)); + dungeonsModeIcons.put("master_catacombs", Utils.editItemStackInfo(NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("MASTER_SKULL_TIER_7")),EnumChatFormatting.GRAY+"Master Mode", true)); + + } + private void drawDungPage(int mouseX, int mouseY, float partialTicks) { Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dung); Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST); @@ -717,6 +788,13 @@ public class GuiProfileViewer extends GuiScreen { int sectionWidth = 110; + String dungeonString = onMasterMode?"master_catacombs":"catacombs"; + + //Utils.drawStringCentered((onMasterMode?"Master Mode":"Catacombs"),fontRendererObj,(guiLeft+sizeX/2), guiTop+10, true, 0xffff0000); + Utils.renderShadowedString(EnumChatFormatting.RED+(onMasterMode?"Master Mode":"Catacombs"), + (guiLeft+sizeX/2), guiTop+5, sectionWidth); + + ProfileViewer.Level levelObjCata = levelObjCatas.get(profileId); //Catacombs level thingy { @@ -814,35 +892,58 @@ public class GuiProfileViewer extends GuiScreen { float secrets = Utils.getElementAsFloat(Utils.getElement(hypixelInfo, "achievements.skyblock_treasure_hunter"), 0); - float totalRuns = 0; + float totalRunsF = 0; float totalRunsF5 = 0; for(int i=1; i<=7; i++) { float runs = Utils.getElementAsFloat(Utils.getElement(profileInfo, "dungeons.dungeon_types.catacombs.tier_completions."+i), 0); - totalRuns += runs; + totalRunsF += runs; if(i >= 5) { totalRunsF5 += runs; } } + float totalRunsM = 0; + float totalRunsM5 = 0; + for(int i=1; i<=7; i++) { + float runs = Utils.getElementAsFloat(Utils.getElement(profileInfo, + "dungeons.dungeon_types.master_catacombs.tier_completions."+i), 0); + totalRunsM += runs; + if(i >= 5) { + totalRunsM5 += runs; + } + } + totalRuns=totalRunsF+totalRunsM; float mobKills = 0; + float mobKillsF = 0; float mobKillsF5 = 0; for(int i=1; i<=7; i++) { float kills = Utils.getElementAsFloat(Utils.getElement(profileInfo, "dungeons.dungeon_types.catacombs.mobs_killed."+i), 0); - mobKills += kills; + mobKillsF += kills; if(i >= 5) { mobKillsF5 += kills; } } + float mobKillsM = 0; + float mobKillsM5 = 0; + for(int i=1; i<=7; i++) { + float kills = Utils.getElementAsFloat(Utils.getElement(profileInfo, + "dungeons.dungeon_types.master_catacombs.mobs_killed."+i), 0); + mobKillsM += kills; + if(i >= 5) { + mobKillsM5 += kills; + } + } + mobKills = mobKillsF+mobKillsM; int miscTopY = y+55; - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Total Runs ", - EnumChatFormatting.WHITE.toString()+((int)(totalRuns)), x, miscTopY, sectionWidth); - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Total Runs (F5-7) ", - EnumChatFormatting.WHITE.toString()+((int)(totalRunsF5)), x, miscTopY+10, sectionWidth); + Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Total Runs "+(onMasterMode?"M":"F"), + EnumChatFormatting.WHITE.toString()+((int)(onMasterMode?totalRunsM:totalRunsF)), x, miscTopY, sectionWidth); + Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Total Runs ("+(onMasterMode?"M":"F")+ "5-7) ", + EnumChatFormatting.WHITE.toString()+((int)(onMasterMode?totalRunsM5:totalRunsF5)), x, miscTopY+10, sectionWidth); Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Secrets (Total) ", EnumChatFormatting.WHITE.toString()+shortNumberFormat(secrets, 0), x, miscTopY+20, sectionWidth); Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Secrets (/Run) ", @@ -873,11 +974,11 @@ public class GuiProfileViewer extends GuiScreen { } float timeNorm = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.fastest_time."+floorTime), 0); + "dungeons.dungeon_types."+dungeonString+".fastest_time."+floorTime), 0); float timeS = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.fastest_time_s."+floorTime), 0); + "dungeons.dungeon_types."+dungeonString+".fastest_time_s."+floorTime), 0); float timeSPLUS = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.fastest_time_s_plus."+floorTime), 0); + "dungeons.dungeon_types."+dungeonString+".fastest_time_s_plus."+floorTime), 0); String timeNormStr = timeNorm <= 0 ? "N/A" : Utils.prettyTime((long)timeNorm); String timeSStr = timeS <= 0 ? "N/A" : Utils.prettyTime((long)timeS); String timeSPlusStr = timeSPLUS <= 0 ? "N/A" : Utils.prettyTime((long)timeSPLUS); @@ -898,7 +999,7 @@ public class GuiProfileViewer extends GuiScreen { x+sectionWidth/2, y, sectionWidth); for(int i=1; i<=7; i++) { float compl = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.tier_completions."+i), 0); + "dungeons.dungeon_types."+dungeonString+".tier_completions."+i), 0); if(BOSS_HEADS[i-1] == null) { String textureLink = bossFloorHeads[i-1]; @@ -934,7 +1035,7 @@ public class GuiProfileViewer extends GuiScreen { Utils.drawItemStack(BOSS_HEADS[i-1], 0, 0); GlStateManager.popMatrix(); - Utils.renderAlignedString(String.format(EnumChatFormatting.YELLOW+"%s (F%d) ", bossFloorArr[i-1], i), + Utils.renderAlignedString(String.format(EnumChatFormatting.YELLOW+"%s ("+(onMasterMode?"M":"F")+"%d) ", bossFloorArr[i-1], i), EnumChatFormatting.WHITE.toString()+(int)compl, x+16, y+18+20*(i-1), sectionWidth-15); @@ -980,6 +1081,89 @@ public class GuiProfileViewer extends GuiScreen { renderXpBar(colour+skillName, dungSkillsStack[i], x, y+20+29*i, sectionWidth, levelObj, mouseX, mouseY); } } + + drawSideButtons(); + + //drawSideButton(0, dungeonsModeIcons.get("catacombs"), true); + //drawSideButton(1, dungeonsModeIcons.get("master_catacombs"), true); + //drawSideButton(1, dungeonsModeIcons.get("catacombs"), true); + //drawSideButton(2, dungeonsModeIcons.get("catacombs"), false); + + + } + + private boolean onMasterMode = false; + + //TODO: improve this shit + private void drawSideButtons(){ + // GlStateManager.pushMatrix(); + GlStateManager.enableDepth(); + GlStateManager.translate(0, 0, 5); + if(onMasterMode){ + drawSideButton(1, dungeonsModeIcons.get("master_catacombs"), true); + } else { + drawSideButton(0, dungeonsModeIcons.get("catacombs"), true); + } + GlStateManager.translate(0, 0, -3); + + GlStateManager.translate(0, 0, -2); + if(!onMasterMode){ + drawSideButton(1, dungeonsModeIcons.get("master_catacombs"), false); + } else { + drawSideButton(0, dungeonsModeIcons.get("catacombs"), false); + } + GlStateManager.disableDepth(); + //GlStateManager.popMatrix(); + } + + + + + private void drawSideButton(int yIndex, ItemStack itemStack, boolean pressed){ + GlStateManager.disableLighting(); + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.1F); + + int x = guiLeft-28; + int y = guiTop+yIndex*28; + + float uMin = 193/256f; + float uMax = 223/256f; + float vMin = 200/256f; + float vMax = 228/256f; + if(pressed) { + uMin = 224/256f; + uMax = 1f; + + + if(yIndex != 0) { + vMin = 228/256f; + vMax = 1f; + } + + renderBlurredBackground(width, height, x+2, y+2, 30, 28-4); + } else { + renderBlurredBackground(width, height, x+2, y+2, 28-2, 28-4); + } + + GlStateManager.disableLighting(); + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.1F); + + Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements); + + Utils.drawTexturedRect(x, y, pressed?32:28, 28, uMin, uMax, vMin, vMax, GL11.GL_NEAREST); + + GlStateManager.enableDepth(); + Utils.drawItemStack(itemStack, x+8, y+7); + + + + } private void renderXpBar(String skillName, ItemStack stack, int x, int y, int xSize, ProfileViewer.Level levelObj, int mouseX, int mouseY) { @@ -1025,7 +1209,65 @@ public class GuiProfileViewer extends GuiScreen { public float totalXp; } - public static PetLevel getPetLevel(JsonArray levels, int offset, float exp) { + private static JsonObject getPetInfo(String pet_name, String rarity){ + JsonObject petInfo = new JsonObject(); + //System.out.println(pet_name); + //System.out.println(rarity); + + if(Constants.PETS.has("custom_pet_leveling") && Constants.PETS.getAsJsonObject("custom_pet_leveling").has(pet_name)){ + JsonObject pet = Constants.PETS.getAsJsonObject("custom_pet_leveling").getAsJsonObject(pet_name); + if(pet.has("type") && pet.has("pet_levels")){ + int type = pet.get("type").getAsInt(); + switch (type) { + case 1: + JsonArray defaultLevels = Constants.PETS.getAsJsonArray("pet_levels"); + defaultLevels.addAll(pet.getAsJsonArray("pet_levels")); + petInfo.add("pet_levels", Constants.PETS.getAsJsonArray("pet_levels")); + break; + case 2: + petInfo.add("pet_levels", pet.getAsJsonArray("pet_levels")); + break; + default: + petInfo.add("pet_levels", Constants.PETS.getAsJsonArray("pet_levels")); + break; + } + } else { + petInfo.add("pet_levels", Constants.PETS.getAsJsonArray("pet_levels")); + } + if(pet.has("max_level")){ + petInfo.add("max_level", pet.get("max_level")); + } else { + petInfo.add("max_level", new JsonPrimitive(100)); + } + + if(pet.has("pet_rarity_offset")){ + petInfo.add("offset", pet.get("pet_rarity_offset")); + } else { + petInfo.add("offset", Constants.PETS.getAsJsonObject("pet_rarity_offset").get(rarity)); + } + + } else { + //System.out.println("Default Path"); + petInfo.add("offset", Constants.PETS.getAsJsonObject("pet_rarity_offset").get(rarity)); + petInfo.add("max_level", new JsonPrimitive(100)); + petInfo.add("pet_levels", Constants.PETS.getAsJsonArray("pet_levels")); + } + + + return petInfo; + + } + + public static PetLevel getPetLevel(String pet_name, String rarity, float exp) { + + JsonObject petInfo = getPetInfo(pet_name, rarity); + int offset = petInfo.get("offset").getAsInt(); + int maxPetLevel = petInfo.get("max_level").getAsInt(); + JsonArray levels = petInfo.getAsJsonArray("pet_levels"); + System.out.println("Offset: "+offset); + System.out.println("MaxPetLevel: "+maxPetLevel); + + float xpTotal = 0; float level = 1; float currentLevelRequirement = 0; @@ -1033,7 +1275,7 @@ public class GuiProfileViewer extends GuiScreen { boolean addLevel = true; - for(int i=offset; i<offset+99; i++) { + for(int i=offset; i<offset+maxPetLevel-1; i++) { if(addLevel) { currentLevelRequirement = levels.get(i).getAsFloat(); xpTotal += currentLevelRequirement; @@ -1044,15 +1286,17 @@ public class GuiProfileViewer extends GuiScreen { level += 1; } } else { + xpTotal += levels.get(i).getAsFloat(); + } } level += currentLevelProgress/currentLevelRequirement; if(level <= 0) { level = 1; - } else if(level > 100) { - level = 100; + } else if(level > maxPetLevel) { + level = maxPetLevel; } PetLevel levelObj = new PetLevel(); levelObj.level = level; @@ -1160,6 +1404,8 @@ public class GuiProfileViewer extends GuiScreen { String petname = pet.get("type").getAsString(); String tier = pet.get("tier").getAsString(); String heldItem = Utils.getElementAsString(pet.get("heldItem"), null); + String skin = Utils.getElementAsString(pet.get("skin"), null); + int candy = pet.get("candyUsed").getAsInt(); JsonObject heldItemJson = heldItem==null?null:NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(heldItem); String tierNum = MINION_RARITY_TO_NUM.get(tier); float exp = pet.get("exp").getAsFloat(); @@ -1169,10 +1415,8 @@ public class GuiProfileViewer extends GuiScreen { tierNum = ""+(Integer.parseInt(tierNum)+1); } - int petRarityOffset = petsJson.get("pet_rarity_offset").getAsJsonObject().get(tier).getAsInt(); - JsonArray levelsArr = petsJson.get("pet_levels").getAsJsonArray(); + PetLevel levelObj = GuiProfileViewer.getPetLevel(petname, tier, exp); - PetLevel levelObj = getPetLevel(levelsArr, petRarityOffset, exp); float level = levelObj.level; float currentLevelRequirement = levelObj.currentLevelRequirement; float maxXP = levelObj.maxXP; @@ -1212,7 +1456,6 @@ public class GuiProfileViewer extends GuiScreen { if(tag.hasKey("display", 10)) { NBTTagCompound display = tag.getCompoundTag("display"); if(display.hasKey("Lore", 9)) { - NBTTagList newNewLore = new NBTTagList(); NBTTagList newLore = new NBTTagList(); NBTTagList lore = display.getTagList("Lore", 8); HashMap<Integer, Integer> blankLocations = new HashMap<>(); @@ -1227,33 +1470,60 @@ public class GuiProfileViewer extends GuiScreen { newLore.appendTag(new NBTTagString(line)); } Integer secondLastBlank = blankLocations.get(blankLocations.size()-2); - if(heldItemJson != null && secondLastBlank != null) { - for(int j=0; j<newLore.tagCount(); j++) { - String line = newLore.getStringTagAt(j); - - if(j == secondLastBlank.intValue()) { - newNewLore.appendTag(new NBTTagString("")); - newNewLore.appendTag(new NBTTagString(EnumChatFormatting.GOLD+"Held Item: "+heldItemJson.get("displayname").getAsString())); + if(skin != null){ + JsonObject petSkin = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PET_SKIN_" + skin); + if(petSkin != null){ + try { + NBTTagCompound nbt = JsonToNBT.getTagFromJson(petSkin.get("nbttag").getAsString()); + tag.setTag("SkullOwner", nbt.getTag("SkullOwner")); + String name = petSkin.get("displayname").getAsString(); + if(name != null){ + name = Utils.cleanColour(name); + newLore.set(0, new NBTTagString(newLore.get(0).toString().replace("\"" , "") + ", " + name)); + } + } catch (NBTException e) { + e.printStackTrace(); + } + } + } + for (int i = 0; i < newLore.tagCount() ; i++){ + String cleaned = Utils.cleanColour(newLore.get(i).toString()); + if (cleaned.equals("\"Right-click to add this pet to\"")){ + newLore.removeTag(i + 1); + newLore.removeTag(i); + secondLastBlank = i - 1; + break; + } + } + NBTTagList temp = new NBTTagList(); + for (int i = 0; i < newLore.tagCount(); i++) { + temp.appendTag(newLore.get(i)); + if(secondLastBlank != null && i == secondLastBlank) { + if (heldItem != null) { + temp.appendTag(new NBTTagString(EnumChatFormatting.GOLD + "Held Item: " + heldItemJson.get("displayname").getAsString())); int blanks = 0; JsonArray heldItemLore = heldItemJson.get("lore").getAsJsonArray(); - for(int k=0; k<heldItemLore.size(); k++) { + for (int k = 0; k < heldItemLore.size(); k++) { String heldItemLine = heldItemLore.get(k).getAsString(); - if(heldItemLine.trim().isEmpty()) { + if (heldItemLine.trim().isEmpty()) { blanks++; - } else if(blanks==2) { - newNewLore.appendTag(new NBTTagString(heldItemLine)); - } else if(blanks>2) { + } else if (blanks == 2) { + temp.appendTag(new NBTTagString(heldItemLine)); + } else if (blanks > 2) { break; } } + temp.appendTag(new NBTTagString()); } - - newNewLore.appendTag(new NBTTagString(line)); + if (candy != 0) { + temp.appendTag(new NBTTagString(EnumChatFormatting.GREEN + "(" + candy + "/10) Pet Candy Used")); + temp.appendTag(new NBTTagString()); + } + temp.removeTag(temp.tagCount() - 1); } - display.setTag("Lore", newNewLore); - } else { - display.setTag("Lore", newLore); } + newLore = temp; + display.setTag("Lore", newLore); } if(display.hasKey("Name", 8)) { String displayName = display.getString("Name"); @@ -1316,7 +1586,14 @@ public class GuiProfileViewer extends GuiScreen { for(int i=petsPage*20; i<Math.min(petsPage*20+20, Math.min(sortedPetsStack.size(), sortedPets.size())); i++) { JsonObject pet = sortedPets.get(i); ItemStack stack = sortedPetsStack.get(i); + + if(pet != null) { + { + NBTTagCompound tag = stack.getTagCompound(); + tag.setBoolean("DisablePetExp", true); + stack.setTagCompound(tag); + } int xIndex = (i%20) % COLLS_XCOUNT; int yIndex = (i%20) / COLLS_XCOUNT; @@ -1348,33 +1625,25 @@ public class GuiProfileViewer extends GuiScreen { ItemStack petStack = sortedPetsStack.get(selectedPet); String display = petStack.getDisplayName(); JsonObject pet = sortedPets.get(selectedPet); - String type = pet.get("type").getAsString(); - for(int i=0; i<4; i++) { - JsonObject item = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(type+";"+i); - if(item != null) { - int x = guiLeft+280; - float y = guiTop+67+15*(float)Math.sin(((currentTime-startTime)/800f)%(2*Math.PI)); + int x = guiLeft+280; + float y = guiTop+67+15*(float)Math.sin(((currentTime-startTime)/800f)%(2*Math.PI)); - int displayLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(display); - int halfDisplayLen = displayLen/2; + int displayLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(display); + int halfDisplayLen = displayLen/2; - GlStateManager.pushMatrix(); - GlStateManager.translate(x, y, 0); + GlStateManager.pushMatrix(); + GlStateManager.translate(x, y, 0); - drawRect(-halfDisplayLen-1-28, -1, halfDisplayLen+1-28, 8, new Color(0, 0, 0, 100).getRGB()); + drawRect(-halfDisplayLen-1-28, -1, halfDisplayLen+1-28, 8, new Color(0, 0, 0, 100).getRGB()); - Minecraft.getMinecraft().fontRendererObj.drawString(display, -halfDisplayLen-28, 0, 0, true); + Minecraft.getMinecraft().fontRendererObj.drawString(display, -halfDisplayLen-28, 0, 0, true); - ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(item); - GlStateManager.enableDepth(); - GlStateManager.translate(-55, 0, 0); - GlStateManager.scale(3.5f, 3.5f, 1); - Utils.drawItemStack(stack, 0, 0); - GlStateManager.popMatrix(); - break; - } - } + GlStateManager.enableDepth(); + GlStateManager.translate(-55, 0, 0); + GlStateManager.scale(3.5f, 3.5f, 1); + Utils.drawItemStack(petStack, 0, 0); + GlStateManager.popMatrix(); float level = pet.get("level").getAsFloat(); float currentLevelRequirement = pet.get("currentLevelRequirement").getAsFloat(); @@ -1524,7 +1793,7 @@ public class GuiProfileViewer extends GuiScreen { Utils.drawStringCentered(selectedCollectionCategory.getDisplayName() + " Minions", Minecraft.getMinecraft().fontRendererObj, guiLeft+326, guiTop+14, true, 4210752); - + List<String> minions = ProfileViewer.getCollectionCatToMinionMap().get(selectedCollectionCategory); if(minions != null) { for(int i=0; i<minions.size(); i++) { @@ -1602,14 +1871,15 @@ public class GuiProfileViewer extends GuiScreen { invNameToDisplayMap.put("inv_contents", Utils.createItemStack(Item.getItemFromBlock(Blocks.chest), EnumChatFormatting.GRAY+"Inventory")); invNameToDisplayMap.put("ender_chest_contents", Utils.createItemStack(Item.getItemFromBlock(Blocks.ender_chest), EnumChatFormatting.GRAY+"Ender Chest")); //invNameToDisplayMap.put("backpack_contents", Utils.createItemStack(Item.getItemFromBlock(Blocks.dropper), EnumChatFormatting.GRAY+"Backpacks")); - invNameToDisplayMap.put("backpack_contents", NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("JUMBO_BACKPACK")).setStackDisplayName(EnumChatFormatting.GRAY+"Backpacks")); - invNameToDisplayMap.put("personal_vault_contents", NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("IRON_CHEST")).setStackDisplayName(EnumChatFormatting.GRAY+"Personal vault")); + invNameToDisplayMap.put("backpack_contents", Utils.editItemStackInfo(NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("JUMBO_BACKPACK")),EnumChatFormatting.GRAY+"Backpacks", true)); + invNameToDisplayMap.put("personal_vault_contents", Utils.editItemStackInfo(NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("IRON_CHEST")),EnumChatFormatting.GRAY+"Personal vault", true)); invNameToDisplayMap.put("talisman_bag", Utils.createItemStack(Items.golden_apple, EnumChatFormatting.GRAY+"Accessory Bag")); invNameToDisplayMap.put("wardrobe_contents", Utils.createItemStack(Items.leather_chestplate, EnumChatFormatting.GRAY+"Wardrobe")); invNameToDisplayMap.put("fishing_bag", Utils.createItemStack(Items.fish, EnumChatFormatting.GRAY+"Fishing Bag")); invNameToDisplayMap.put("potion_bag", Utils.createItemStack(Items.potionitem, EnumChatFormatting.GRAY+"Potion Bag")); } + public int countItemsInInventory(String internalname, JsonObject inventoryInfo, String... invsToSearch) { int count = 0; for(String inv : invsToSearch) { @@ -1704,6 +1974,9 @@ public class GuiProfileViewer extends GuiScreen { return 0; } + //unused function + //Data has been removed from the repo + @Deprecated private int getAvailableSlotsForInventory(JsonObject inventoryInfo, JsonObject collectionInfo, String invName) { if(collectionInfo == null) return -1; JsonObject misc = Constants.MISC; @@ -2157,6 +2430,29 @@ public class GuiProfileViewer extends GuiScreen { Utils.renderAlignedString(EnumChatFormatting.GOLD+"Purse", EnumChatFormatting.WHITE.toString()+shortNumberFormat(purseBalance, 0), guiLeft+xStart, guiTop+yStartTop+yOffset, 76); + { + String lastSaveText = this.getTimeSinceString(profileInfo, "last_save"); + if(lastSaveText != null) { + Utils.renderAlignedString(EnumChatFormatting.AQUA + "Last Seen", EnumChatFormatting.WHITE.toString() + lastSaveText, + guiLeft + xStart, guiTop + yStartTop + yOffset * 2, 76); + } + + } + { + String first_join = this.getTimeSinceString(profileInfo, "first_join"); + if(first_join != null) { + Utils.renderAlignedString(EnumChatFormatting.AQUA + "Joined", EnumChatFormatting.WHITE.toString() + first_join, + guiLeft + xStart, guiTop + yStartTop + yOffset * 3, 76); + } + + } + { + JsonObject guildInfo = profile.getGuildInfo(null); + if(guildInfo != null && guildInfo.has("name")){ + Utils.renderAlignedString(EnumChatFormatting.AQUA + "Guild", EnumChatFormatting.WHITE.toString() + guildInfo.get("name").getAsString(), + guiLeft + xStart, guiTop + yStartTop + yOffset * 4, 76); + } + } float fairySouls = Utils.getElementAsFloat(Utils.getElement(profileInfo, "fairy_souls_collected"), 0); @@ -2204,10 +2500,7 @@ public class GuiProfileViewer extends GuiScreen { Utils.renderAlignedString(EnumChatFormatting.RED+"AVG Slayer Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgSlayerLVL*10)/10, guiLeft+xStart, guiTop+yStartBottom+yOffset*3, 76); - Utils.renderAlignedString(EnumChatFormatting.RED+"AVG Slayer Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgSlayerLVL*10)/10, - guiLeft+xStart, guiTop+yStartBottom+yOffset*2, 76); - - Utils.renderAlignedString(EnumChatFormatting.RED + "Total Slayer XP", EnumChatFormatting.WHITE.toString() + Math.floor(totalSlayerXP * 10) / 10, + Utils.renderAlignedString(EnumChatFormatting.RED + "Total Slayer XP", EnumChatFormatting.WHITE.toString() + shortNumberFormat(totalSlayerXP, 0), guiLeft + xStart, guiTop + yStartBottom + yOffset * 4, 76); } @@ -2341,6 +2634,33 @@ public class GuiProfileViewer extends GuiScreen { } } + private String getTimeSinceString(JsonObject profileInfo, String path){ + JsonElement lastSaveElement = Utils.getElement(profileInfo, path); + + if (lastSaveElement.isJsonPrimitive()) { + + Instant lastSave = Instant.ofEpochMilli(lastSaveElement.getAsLong()); + LocalDateTime lastSaveTime = LocalDateTime.ofInstant(lastSave,TimeZone.getDefault().toZoneId()); + long timeDiff = System.currentTimeMillis() - lastSave.toEpochMilli(); + LocalDateTime sinceOnline= LocalDateTime.ofInstant(Instant.ofEpochMilli(timeDiff), ZoneId.of("UTC")); + String renderText; + + if(timeDiff < 60000L){ + renderText = sinceOnline.getSecond()+" seconds ago."; + } else if(timeDiff < 3600000L){ + renderText = sinceOnline.getMinute()+" minutes ago."; + } else if(timeDiff < 86400000L){ + renderText = sinceOnline.getHour()+" hours ago."; + } else if(timeDiff < 31556952000L){ + renderText = sinceOnline.getDayOfYear()+" days ago."; + } else { + renderText = lastSaveTime.format(DateTimeFormatter.ofPattern("dd-MM-yyyy")); + } + return renderText; + } + return null; + } + private int backgroundClickedX = -1; private static char[] c = new char[]{'k', 'm', 'b', 't'}; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java index c95fadf0..76427cc8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java @@ -471,10 +471,8 @@ public class PlayerStats { tierNum = ""+(Integer.parseInt(tierNum)+1); } - int petRarityOffset = petsJson.get("pet_rarity_offset").getAsJsonObject().get(tier).getAsInt(); - JsonArray levelsArr = petsJson.get("pet_levels").getAsJsonArray(); + GuiProfileViewer.PetLevel levelObj = GuiProfileViewer.getPetLevel(petname, tier, exp); - GuiProfileViewer.PetLevel levelObj = GuiProfileViewer.getPetLevel(levelsArr, petRarityOffset, exp); float level = levelObj.level; float currentLevelRequirement = levelObj.currentLevelRequirement; float maxXP = levelObj.maxXP; 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 23c91dd0..371e9ef3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java @@ -310,6 +310,7 @@ public class ProfileViewer { private String latestProfile = null; private JsonArray playerInformation = null; + private JsonObject guildInformation = null; private JsonObject basicInfo = null; private final HashMap<String, JsonObject> profileMap = new HashMap<>(); @@ -331,6 +332,9 @@ public class ProfileViewer { private AtomicBoolean updatingPlayerInfoState = new AtomicBoolean(false); private long lastPlayerInfoState = 0; private AtomicBoolean updatingPlayerStatusState = new AtomicBoolean(false); + private AtomicBoolean updatingGuildInfoState = new AtomicBoolean(false); + private long lastGuildInfoState = 0; + private AtomicBoolean updatingGuildStatusState = new AtomicBoolean(false); public JsonObject getPlayerStatus() { if(playerStatus != null) return playerStatus; @@ -354,6 +358,7 @@ public class ProfileViewer { return null; } + public long getNetWorth(String profileId) { if(profileId == null) profileId = latestProfile; if(networth.get(profileId) != null) return networth.get(profileId); @@ -522,6 +527,7 @@ public class ProfileViewer { } } + String cute_name = profile.get("cute_name").getAsString(); if (backup == null) backup = cute_name; profileIds.add(cute_name); @@ -543,6 +549,35 @@ public class ProfileViewer { } ); + return null; + } + public JsonObject getGuildInfo(Runnable runnable) { + if (guildInformation != null) return guildInformation; + + long currentTime = System.currentTimeMillis(); + + if (currentTime - lastGuildInfoState < 15*1000 && updatingGuildInfoState.get()) return null; + + lastGuildInfoState = currentTime; + updatingGuildInfoState.set(true); + + HashMap<String, String> args = new HashMap<>(); + args.put("player", "" + uuid); + manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "guild", + args, jsonObject -> { + updatingGuildInfoState.set(false); + + if (jsonObject == null) return; + if (jsonObject.has("success") && jsonObject.get("success").getAsBoolean()) { + guildInformation = jsonObject.get("guild").getAsJsonObject(); + if (guildInformation == null) return; + if (runnable != null) runnable.run(); + } + }, () -> { + updatingGuildInfoState.set(false); + } + ); + return null; } @@ -570,6 +605,9 @@ public class ProfileViewer { if(profile.has("banking")) { profileInfo.add("banking", profile.get("banking").getAsJsonObject()); } + if(profile.has("game_mode")){ + profileInfo.add("game_mode", profile.get("game_mode")); + } profileMap.put(profileId, profileInfo); return profileInfo; } @@ -611,6 +649,7 @@ public class ProfileViewer { public void resetCache() { playerInformation = null; + guildInformation = null; basicInfo = null; playerStatus = null; stats.clear(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java b/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java index f7d5157f..e75eaebb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java @@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.util; import com.google.gson.Gson; import com.google.gson.JsonObject; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import org.apache.commons.io.IOUtils; import java.io.BufferedReader; @@ -80,7 +81,9 @@ public class HypixelApi { try { consumer.accept(getApiSync(getMyApiURL()+urlS)); } catch(Exception e) { - e.printStackTrace(); + if(NotEnoughUpdates.INSTANCE.config.hidden.dev) { + e.printStackTrace(); + } myApiError(current); error.run(); } 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 1a5e168d..e41ef78d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java @@ -125,7 +125,7 @@ public class SBInfo { private static final Pattern SKILL_LEVEL_PATTERN = Pattern.compile("([^0-9:]+) (\\d{1,2})"); public void tick() { - isInDungeon = false; + Boolean tempIsInDungeon = false; long currentTime = System.currentTimeMillis(); @@ -171,13 +171,16 @@ public class SBInfo { ScorePlayerTeam scoreplayerteam1 = scoreboard.getPlayersTeam(score.getPlayerName()); String line = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score.getPlayerName()); line = Utils.cleanDuplicateColourCodes(line); + + String cleanLine = Utils.cleanColour(line); - if(Utils.cleanColour(line).contains("Dungeon Cleared: ")) { - isInDungeon = true; + if(cleanLine.contains("Dungeon") && cleanLine.contains("Cleared:") && cleanLine.contains("%")) { + tempIsInDungeon = true; } lines.add(line); } + isInDungeon= tempIsInDungeon; if(lines.size() >= 5) { date = Utils.cleanColour(lines.get(1)).trim(); @@ -191,7 +194,13 @@ public class SBInfo { currentTimeDate = parseFormat.parse(timeSpace); } catch (ParseException e) {} } - location = Utils.cleanColour(lines.get(3)).replaceAll("[^A-Za-z0-9() ]", "").trim(); + //Replaced with for loop because in crystal hollows with events the line it's on can shift. + for (String line : lines){ + if (line.contains("⏣")) { + location = Utils.cleanColour(line).replaceAll("[^A-Za-z0-9() ]", "").trim(); + break; + } + } } objective = null; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index 37e9c600..b796fbe3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -8,6 +8,7 @@ import com.mojang.authlib.Agent; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; import io.github.moulberry.notenoughupdates.util.TexLoc; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -433,7 +434,11 @@ public class Utils { } public static Slot getSlotUnderMouse(GuiContainer container) { - return (Slot) getField(GuiContainer.class, container, "theSlot", "field_147006_u"); + Slot slot = (Slot) getField(GuiContainer.class, container, "theSlot", "field_147006_u"); + if(slot == null){ + slot = SlotLocking.getInstance().getRealSlot(); + } + return slot; } public static void drawTexturedRect(float x, float y, float width, float height) { @@ -464,26 +469,77 @@ public class Utils { return str.substring(0, 1).toUpperCase() + str.substring(1).toLowerCase(); } - private static String[] rarityArr = new String[] { - "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", + public static String[] rarityArr = new String[] { + "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", "SUPREME" }; + + public static String getRarityFromInt(int rarity){ + if(rarity < 0|| rarity >= rarityArr.length){ return rarityArr[0]; } + return rarityArr[rarity]; + } + + public static int checkItemTypePet(List<String> lore){ + for(int i=lore.size()-1; i>=0; i--){ + String line = Utils.cleanColour(lore.get(i)); + for (int i1 = 0; i1 < rarityArr.length; i1++) { + if(line.equals(rarityArr[i1])){ + return i1; + } + } + } + return -1; + } + public static int checkItemType(JsonArray lore, boolean contains, String... typeMatches) { for(int i=lore.size()-1; i>=0; i--) { String line = lore.get(i).getAsString(); - for(String rarity : rarityArr) { - for(int j=0; j<typeMatches.length; j++) { - if(contains) { - if(line.trim().contains(rarity + " " + typeMatches[j])) { - return j; - } else if(line.trim().contains(rarity + " DUNGEON " + typeMatches[j])) { - return j; - } - } else { - if(line.trim().endsWith(rarity + " " + typeMatches[j])) { - return j; - } else if(line.trim().endsWith(rarity + " DUNGEON " + typeMatches[j])) { - return j; - } + + int returnType = checkItemType(line, contains, typeMatches); + if(returnType != -1){ + return returnType; + } + } + return -1; + } + + public static int checkItemType(String[] lore, boolean contains, String... typeMatches) { + for(int i=lore.length-1; i>=0; i--) { + String line = lore[i]; + + int returnType = checkItemType(line, contains, typeMatches); + if(returnType != -1){ + return returnType; + } + } + return -1; + } + + public static int checkItemType(List<String> lore, boolean contains, String... typeMatches) { + for(int i=lore.size()-1; i>=0; i--) { + String line = lore.get(i); + + int returnType = checkItemType(line, contains, typeMatches); + if(returnType != -1){ + return returnType; + } + } + return -1; + } + + private static int checkItemType(String line, boolean contains, String... typeMatches) { + for (String rarity : rarityArr) { + for (int j = 0; j < typeMatches.length; j++) { + if (contains) { + if (line.trim().contains(rarity + " " + typeMatches[j])) { + return j; + } else if (line.trim().contains(rarity + " DUNGEON " + typeMatches[j])) { + return j; + } + } else { + if (line.trim().endsWith(rarity + " " + typeMatches[j])) { + return j; + } else if (line.trim().endsWith(rarity + " DUNGEON " + typeMatches[j])) { + return j; } } } @@ -491,10 +547,20 @@ public class Utils { return -1; } + public static float round (float value, int precision) { + int scale = (int) Math.pow(10, precision); + return (float) Math.round(value * scale) / scale; + } + + + public static void playPressSound() { - if(NotEnoughUpdates.INSTANCE.config.misc.guiButtonClicks) { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create( - new ResourceLocation("gui.button.press"), 1.0F)); + playSound(new ResourceLocation("gui.button.press"), true); + } + + public static void playSound(ResourceLocation sound, boolean gui) { + if(NotEnoughUpdates.INSTANCE.config.misc.guiButtonClicks || !gui) { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(sound, 1.0F)); } } @@ -607,6 +673,29 @@ public class Utils { return stack; } + public static ItemStack editItemStackInfo(ItemStack itemStack, String displayName, boolean disableNeuToolTips, String... lore){ + NBTTagCompound tag = itemStack.getTagCompound(); + NBTTagCompound display = tag.getCompoundTag("display"); + NBTTagList Lore = new NBTTagList(); + + for(String line : lore) { + Lore.appendTag(new NBTTagString(line)); + } + + display.setString("Name", displayName); + display.setTag("Lore", Lore); + + tag.setTag("display", display); + tag.setInteger("HideFlags", 254); + if(disableNeuToolTips){ + tag.setBoolean("disableNeuTooltip", true); + } + + itemStack.setTagCompound(tag); + + return itemStack; + } + public static void drawStringF(String str, FontRenderer fr, float x, float y, boolean shadow, int colour) { fr.drawString(str, x, y, colour, shadow); } @@ -956,6 +1045,11 @@ public class Utils { style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.YELLOW+value))); return style; } + public static ChatStyle createClickStyle(ClickEvent.Action action, String value, String message) { + ChatStyle style = createClickStyle(action, value); + style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(message))); + return style; + } public static void recursiveDelete(File file) { if(file.isDirectory() && !Files.isSymbolicLink(file.toPath())) { diff --git a/src/main/resources/assets/notenoughupdates/invbuttons/expanded_inventory.png b/src/main/resources/assets/notenoughupdates/invbuttons/expanded_inventory.png Binary files differdeleted file mode 100644 index d941fa6e..00000000 --- a/src/main/resources/assets/notenoughupdates/invbuttons/expanded_inventory.png +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/invbuttons/presets.json b/src/main/resources/assets/notenoughupdates/invbuttons/presets.json index 7692fc07..4184e6d4 100644 --- a/src/main/resources/assets/notenoughupdates/invbuttons/presets.json +++ b/src/main/resources/assets/notenoughupdates/invbuttons/presets.json @@ -2278,452 +2278,458 @@ "anchorRight":false, "anchorBottom":false, "backgroundIndex":0, - "command":"warp dungeon_hub", - "icon":"skull:9b56895b9659896ad647f58599238af532d46db9c1b0389b8bbeb70999dab33d" - }, - { - "x":108, - "y":63, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"reparty", - "icon":"COMMAND" - }, - { - "x":129, - "y":63, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"/p FragRunBot azael_mew azael_mewh", - "icon":"GIANT_FRAGMENT_DIAMOND" - }, - { - "x":150, - "y":63, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"pets", - "icon":"extra:pet_gold" - }, - { - "x":87, - "y":5, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":108, - "y":5, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":129, - "y":5, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":150, - "y":5, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":87, - "y":25, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":105, - "y":25, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":87, - "y":43, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":105, - "y":43, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":143, - "y":35, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":60, - "y":8, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":2, - "command":"/wardrobe", - "icon":"extra:baubles_gold" - }, - { - "x":60, - "y":60, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":26, - "y":8, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":26, - "y":60, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":2, - "y":2, - "playerInvOnly":false, - "anchorRight":true, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":2, - "y":22, - "playerInvOnly":false, - "anchorRight":true, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":2, - "y":42, - "playerInvOnly":false, - "anchorRight":true, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":2, - "y":62, - "playerInvOnly":false, - "anchorRight":true, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":2, - "y":-84, - "playerInvOnly":false, - "anchorRight":true, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":2, - "y":-64, - "playerInvOnly":false, - "anchorRight":true, - "anchorBottom":true, - "backgroundIndex":0, "command":"", "icon":"" }, { - "x":2, - "y":-44, - "playerInvOnly":false, - "anchorRight":true, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":2, - "y":-24, - "playerInvOnly":false, - "anchorRight":true, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":4, - "y":-19, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":25, - "y":-19, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":46, - "y":-19, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":67, - "y":-19, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":88, - "y":-19, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":109, - "y":-19, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":130, - "y":-19, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":151, - "y":-19, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":-19, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"joindungeon catacombs 1", - "icon":"GOLD_BONZO_HEAD" - }, - { - "x":-19, - "y":22, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"joindungeon catacombs 2", - "icon":"GOLD_SCARF_HEAD" - }, - { - "x":-19, - "y":42, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"joindungeon catacombs 3", - "icon":"GOLD_PROFESSOR_HEAD" - }, - { - "x":-19, - "y":62, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"joindungeon catacombs 4", - "icon":"GOLD_THORN_HEAD" - }, - { - "x":-19, - "y":-84, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"joindungeon catacombs 5", - "icon":"GOLD_LIVID_HEAD" - }, - { - "x":-19, - "y":-64, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"/joindungeon catacombs 6", - "icon":"GOLD_SADAN_HEAD" - }, - { - "x":-19, - "y":-44, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"joindungeons catacombs 7", - "icon":"GOLD_NECRON_HEAD" - }, - { - "x":-19, - "y":-24, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":4, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":25, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":46, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":67, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":88, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":109, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":130, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":151, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" + "x": 108, + "y": 63, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "warp dungeon_hub", + "icon": "skull:9b56895b9659896ad647f58599238af532d46db9c1b0389b8bbeb70999dab33d" + }, + { + "x": 129, + "y": 63, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "reparty", + "icon": "COMMAND" + }, + { + "x": 150, + "y": 63, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "pets", + "icon": "extra:pet_gold" + }, + { + "x": 87, + "y": 5, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 108, + "y": 5, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 129, + "y": 5, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 150, + "y": 5, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 87, + "y": 25, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 105, + "y": 25, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 87, + "y": 43, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 105, + "y": 43, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 143, + "y": 35, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 60, + "y": 8, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 2, + "command": "/wardrobe", + "icon": "extra:baubles_gold" + }, + { + "x": 60, + "y": 60, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 26, + "y": 8, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 26, + "y": 60, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 2, + "y": 2, + "playerInvOnly": false, + "anchorRight": true, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 2, + "y": 22, + "playerInvOnly": false, + "anchorRight": true, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 2, + "y": 42, + "playerInvOnly": false, + "anchorRight": true, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 2, + "y": 62, + "playerInvOnly": false, + "anchorRight": true, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 2, + "y": -84, + "playerInvOnly": false, + "anchorRight": true, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 2, + "y": -64, + "playerInvOnly": false, + "anchorRight": true, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "", + "icon": "" + }, + { + "x": 2, + "y": -44, + "playerInvOnly": false, + "anchorRight": true, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 2, + "y": -24, + "playerInvOnly": false, + "anchorRight": true, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 4, + "y": -19, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon master_catacombs 1", + "icon": "DIAMOND_BONZO_HEAD" + }, + { + "x": 25, + "y": -19, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon master_catacombs 2", + "icon": "DIAMOND_SCARF_HEAD" + }, + { + "x": 46, + "y": -19, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon master_catacombs 3", + "icon": "DIAMOND_PROFESSOR_HEAD" + }, + { + "x": 67, + "y": -19, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon master_catacombs 4", + "icon": "DIAMOND_THORN_HEAD" + }, + { + "x": 88, + "y": -19, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon master_catacombs 5", + "icon": "DIAMOND_LIVID_HEAD" + }, + { + "x": 109, + "y": -19, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon master_catacombs 6", + "icon": "DIAMOND_SADAN_HEAD" + }, + { + "x": 130, + "y": -19, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 151, + "y": -19, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": -19, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon catacombs 1", + "icon": "GOLD_BONZO_HEAD" + }, + { + "x": -19, + "y": 22, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon catacombs 2", + "icon": "GOLD_SCARF_HEAD" + }, + { + "x": -19, + "y": 42, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon catacombs 3", + "icon": "GOLD_PROFESSOR_HEAD" + }, + { + "x": -19, + "y": 62, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon catacombs 4", + "icon": "GOLD_THORN_HEAD" + }, + { + "x": -19, + "y": -84, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "joindungeon catacombs 5", + "icon": "GOLD_LIVID_HEAD" + }, + { + "x": -19, + "y": -64, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "/joindungeon catacombs 6", + "icon": "GOLD_SADAN_HEAD" + }, + { + "x": -19, + "y": -44, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "joindungeon catacombs 7", + "icon": "GOLD_NECRON_HEAD" + }, + { + "x": -19, + "y": -24, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 4, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 25, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 46, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 67, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 88, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 109, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 130, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 151, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" } ] -}
\ No newline at end of file +} diff --git a/src/main/resources/assets/notenoughupdates/pv_elements.png b/src/main/resources/assets/notenoughupdates/pv_elements.png Binary files differindex 68c4fd9f..7e9033bd 100644 --- a/src/main/resources/assets/notenoughupdates/pv_elements.png +++ b/src/main/resources/assets/notenoughupdates/pv_elements.png diff --git a/src/main/resources/assets/notenoughupdates/pv_ironman.png b/src/main/resources/assets/notenoughupdates/pv_ironman.png Binary files differnew file mode 100644 index 00000000..78802d29 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/pv_ironman.png diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss1-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss1-0.jpg Binary files differdeleted file mode 100644 index d05faab2..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss1-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss10-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss10-0.jpg Binary files differdeleted file mode 100644 index a3bbae70..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss10-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss11-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss11-0.jpg Binary files differdeleted file mode 100644 index 071a5df1..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss11-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss12-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss12-0.jpg Binary files differdeleted file mode 100644 index 447459cc..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss12-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss13-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss13-0.jpg Binary files differdeleted file mode 100644 index 88a89ae2..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss13-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss14-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss14-0.jpg Binary files differdeleted file mode 100644 index a83e64fa..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss14-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss15-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss15-0.jpg Binary files differdeleted file mode 100644 index 3d34bc43..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss15-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss16-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss16-0.jpg Binary files differdeleted file mode 100644 index 9827eec2..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss16-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss17-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss17-0.jpg Binary files differdeleted file mode 100644 index 560b1d9a..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss17-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss18-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss18-0.jpg Binary files differdeleted file mode 100644 index 6322f89d..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss18-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss2-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss2-0.jpg Binary files differdeleted file mode 100644 index ba71a84e..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss2-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss3-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss3-0.jpg Binary files differdeleted file mode 100644 index 7b179fcc..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss3-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss4-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss4-0.jpg Binary files differdeleted file mode 100644 index c8ee048c..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss4-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss5-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss5-0.jpg Binary files differdeleted file mode 100644 index 4435fd97..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss5-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss6-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss6-0.jpg Binary files differdeleted file mode 100644 index c027edbc..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss6-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss7-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss7-0.jpg Binary files differdeleted file mode 100644 index 47dffef2..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss7-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss8-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss8-0.jpg Binary files differdeleted file mode 100644 index fe4ae1bb..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss8-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss9-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss9-0.jpg Binary files differdeleted file mode 100644 index d06c092a..00000000 --- a/src/main/resources/assets/notenoughupdates/ss_small/ss9-0.jpg +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_0.png b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_0.png Binary files differindex 45e4bb3a..da1461be 100644 --- a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_0.png +++ b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_0.png diff --git a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_1.png b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_1.png Binary files differindex e8fdd727..3ff29ff1 100644 --- a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_1.png +++ b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_1.png diff --git a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_2.png b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_2.png Binary files differindex 9c1ff275..16150a20 100644 --- a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_2.png +++ b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_2.png diff --git a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_3.png b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_3.png Binary files differindex fe03a5bd..755dc865 100644 --- a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_3.png +++ b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_3.png diff --git a/src/main/resources/mixins.notenoughupdates.json b/src/main/resources/mixins.notenoughupdates.json index 0d415976..bec344ec 100644 --- a/src/main/resources/mixins.notenoughupdates.json +++ b/src/main/resources/mixins.notenoughupdates.json @@ -3,6 +3,7 @@ "refmap": "mixins.notenoughupdates.refmap.json", "compatibilityLevel": "JAVA_8", "mixins": [ + "MixinMinecraft", "MixinAbstractClientPlayer", "MixinContainer", "MixinEffectRenderer", @@ -21,7 +22,7 @@ "MixinItemStack", "MixinLayerArmorBase", "MixinLayerCustomHead", - "MixinLoadingScreenRenderer", + "MixinMouseHelper", "MixinNetHandlerPlayClient", "MixinPlayerControllerMP", |