diff options
32 files changed, 768 insertions, 354 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 48cd0e57..e0a36686 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -966,21 +966,6 @@ 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)) { @@ -1199,6 +1184,10 @@ public class NEUEventListener { } } if(!hoveringButton) buttonHovered = null; + + if(AuctionBINWarning.getInstance().shouldShow()) { + AuctionBINWarning.getInstance().render(); + } } private void renderDungeonChestOverlay(GuiScreen gui) { @@ -1408,6 +1397,18 @@ public class NEUEventListener { return; } + final ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft()); + final int scaledWidth = scaledresolution.getScaledWidth(); + final int scaledHeight = scaledresolution.getScaledHeight(); + int mouseX = Mouse.getX() * scaledWidth / Minecraft.getMinecraft().displayWidth; + int mouseY = scaledHeight - Mouse.getY() * scaledHeight / Minecraft.getMinecraft().displayHeight - 1; + + if(AuctionBINWarning.getInstance().shouldShow()) { + AuctionBINWarning.getInstance().mouseInput(mouseX, mouseY); + event.setCanceled(true); + return; + } + if(!event.isCanceled()) { Utils.scrollTooltip(Mouse.getEventDWheel()); } @@ -1422,20 +1423,14 @@ public class NEUEventListener { return; } - final ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft()); - final int scaledWidth = scaledresolution.getScaledWidth(); - final int scaledHeight = scaledresolution.getScaledHeight(); - int mouseX = Mouse.getX() * scaledWidth / Minecraft.getMinecraft().displayWidth; - int mouseY = scaledHeight - Mouse.getY() * scaledHeight / Minecraft.getMinecraft().displayHeight - 1; - String containerName = null; GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen; if(guiScreen instanceof GuiChest) { 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) { + if(containerName.contains(" Profile") && eventGui.isMouseOverSlot(cc.inventorySlots.get(42), mouseX, mouseY) + && Mouse.getEventButton() >= 0) { event.setCanceled(true); if(Mouse.getEventButtonState() && eventGui.inventorySlots.inventorySlots.get(22).getStack() != null && eventGui.inventorySlots.inventorySlots.get(22).getStack().getTagCompound() != null){ @@ -1547,6 +1542,12 @@ public class NEUEventListener { */ @SubscribeEvent public void onGuiScreenKeyboard(GuiScreenEvent.KeyboardInputEvent.Pre event) { + if(AuctionBINWarning.getInstance().shouldShow()) { + AuctionBINWarning.getInstance().keyboardInput(); + event.setCanceled(true); + return; + } + if(AuctionSearchOverlay.shouldReplace()) { AuctionSearchOverlay.keyEvent(); event.setCanceled(true); @@ -1846,7 +1847,6 @@ public class NEUEventListener { int index = 0; List<String> newTooltip = new ArrayList<>(); - for(String line : event.toolTip) { if(line.endsWith(EnumChatFormatting.DARK_GRAY+"Reforge Stone") && NotEnoughUpdates.INSTANCE.config.tooltipTweaks.showReforgeStats) { JsonObject reforgeStones = Constants.REFORGESTONES; @@ -2394,7 +2394,6 @@ public class NEUEventListener { private void onItemToolTipInternalNameNull(ItemTooltipEvent event){ petToolTipXPExtendPetMenu(event); - } private List<String> petToolTipXPExtend(ItemTooltipEvent event) { @@ -2407,7 +2406,6 @@ public class NEUEventListener { } //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; @@ -2427,8 +2425,6 @@ public class NEUEventListener { } } - - if (petlevel != null) { tooltipText.add(""); if(petlevel.totalXp > petlevel.maxXP) { @@ -2437,7 +2433,8 @@ public class NEUEventListener { 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"); + tooltipText.add(EnumChatFormatting.GRAY + "EXP: " + EnumChatFormatting.YELLOW + myFormatter.format(petlevel.levelXp) + + EnumChatFormatting.GOLD + "/" + EnumChatFormatting.YELLOW + myFormatter.format(petlevel.currentLevelRequirement) + " EXP"); } } } @@ -2446,9 +2443,7 @@ public class NEUEventListener { 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) { @@ -2477,7 +2472,8 @@ public class NEUEventListener { return; } - event.toolTip.add(xpLine+1, EnumChatFormatting.YELLOW + "" + myFormatter.format(petlevel.levelXp) + "/" + myFormatter.format(petlevel.currentLevelRequirement) + " EXP"); + event.toolTip.add(xpLine+1, EnumChatFormatting.GRAY + "EXP: " + EnumChatFormatting.YELLOW + myFormatter.format(petlevel.levelXp) + + EnumChatFormatting.GOLD + "/" + EnumChatFormatting.YELLOW + myFormatter.format(petlevel.currentLevelRequirement)); } } @@ -2486,9 +2482,6 @@ public class NEUEventListener { 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 @@ -2496,14 +2489,14 @@ public class NEUEventListener { @SubscribeEvent public void onItemTooltip(ItemTooltipEvent event) { if(!neu.isOnSkyblock()) return; - if(NotEnoughUpdates.INSTANCE.config.improvedSBMenu.hideEmptyPanes && + /*if(NotEnoughUpdates.INSTANCE.config.improvedSBMenu.hideEmptyPanes && event.itemStack.getItem().equals(Item.getItemFromBlock(Blocks.stained_glass_pane))) { String first = Utils.cleanColour(event.toolTip.get(0)); first = first.replaceAll("\\(.*\\)", "").trim(); if(first.length() == 0) { event.toolTip.clear(); } - } + }*/ //AH prices /*if(Minecraft.getMinecraft().currentScreen != null) { if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 1c6ae7f7..080353a7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -329,7 +329,7 @@ public class NEUOverlay extends Gui { return; } if(Mouse.getEventButtonState()) { - NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper(new NEUConfigEditor(NotEnoughUpdates.INSTANCE.config)); + NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper(NEUConfigEditor.editor); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 38c46415..5eb0f861 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -1157,7 +1157,7 @@ public class NotEnoughUpdates { if(args.length > 0) { openGui = new GuiScreenElementWrapper(new NEUConfigEditor(config, StringUtils.join(args, " "))); } else { - openGui = new GuiScreenElementWrapper(new NEUConfigEditor(config)); + openGui = new GuiScreenElementWrapper(NEUConfigEditor.editor); } } }; 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 6011f0ac..3b0e0928 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java @@ -95,8 +95,6 @@ public class NEUCape { if(defaultBehaviour){ this.capeName = capeName; - - if (capeName.equalsIgnoreCase("fade")) { shaderName = "fade_cape"; } else if (capeName.equalsIgnoreCase("space")) { @@ -125,26 +123,6 @@ public class NEUCape { ResourceLocation staticCapeTex = new ResourceLocation("notenoughupdates:capes/" + capeName + ".png"); capeTextures = new ResourceLocation[1]; capeTextures[0] = staticCapeTex; - - /*if(rlExists(staticCapeTex)) { - capeTextures = new ResourceLocation[1]; - capeTextures[0] = staticCapeTex; - } else { - List<ResourceLocation> texs = new ArrayList<>(); - for(int i=0; i<99; i++) { - ResourceLocation frame = new ResourceLocation( - "notenoughupdates:capes/"+capeName+"/"+capeName+"_"+String.format("%02d", i)+".png"); - if(rlExists(frame)) { - texs.add(frame); - } else { - break; - } - } - capeTextures = new ResourceLocation[texs.size()]; - for(int i=0; i<texs.size(); i++) { - capeTextures[i] = texs.get(i); - } - }*/ } private void bindTexture() { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java new file mode 100644 index 00000000..fc2eaf61 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java @@ -0,0 +1,243 @@ +package io.github.moulberry.notenoughupdates.miscfeatures; + +import com.google.gson.JsonObject; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.core.GuiElement; +import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; +import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils; +import io.github.moulberry.notenoughupdates.util.SBInfo; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class AuctionBINWarning extends GuiElement { + + private static final AuctionBINWarning INSTANCE = new AuctionBINWarning(); + public static AuctionBINWarning getInstance() { + return INSTANCE; + } + + private static final Pattern ITEM_PRICE_REGEX = Pattern.compile("\u00a7fItem price: \u00a76([0-9,]+) coins"); + + private boolean showWarning = false; + private List<String> sellingTooltip; + private String sellingName; + private int sellingPrice; + private int lowestPrice; + + private boolean shouldPerformCheck() { + if(!NotEnoughUpdates.INSTANCE.config.ahTweaks.enableBINWarning || + !NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) { + sellingTooltip = null; + showWarning = false; + return false; + } + + if(Minecraft.getMinecraft().currentScreen instanceof GuiChest && + SBInfo.getInstance().lastOpenContainerName.startsWith("Create BIN Auction")) { + return true; + } else { + sellingTooltip = null; + showWarning = false; + return false; + } + } + + public boolean shouldShow() { + return shouldPerformCheck() && showWarning; + } + + public boolean onMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType) { + if(!shouldPerformCheck()) return false; + + if(slotId == 29) { + GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; + + sellingPrice = -1; + + ItemStack priceStack = chest.inventorySlots.getSlot(31).getStack(); + if(priceStack != null) { + String displayName = priceStack.getDisplayName(); + Matcher priceMatcher = ITEM_PRICE_REGEX.matcher(displayName); + + if(priceMatcher.matches()) { + try { + sellingPrice = Integer.parseInt(priceMatcher.group(1).replace(",", "")); + } catch(NumberFormatException ignored) { + } + } + } + + ItemStack sellStack = chest.inventorySlots.getSlot(13).getStack(); + String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(sellStack); + + if(internalname == null) { + return false; + } + + JsonObject itemInfo = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(internalname); + if(itemInfo == null || !itemInfo.has("displayname")) { + sellingName = internalname; + } else { + sellingName = itemInfo.get("displayname").getAsString(); + } + + sellingTooltip = sellStack.getTooltip(Minecraft.getMinecraft().thePlayer, + Minecraft.getMinecraft().gameSettings.advancedItemTooltips); + + lowestPrice = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBin(internalname); + if(lowestPrice <= 0) { + lowestPrice = (int)NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAvgBin(internalname); + } + + //TODO: Add option for warning if lowest price does not exist + + float factor = 1 - NotEnoughUpdates.INSTANCE.config.ahTweaks.warningThreshold/100; + if(factor < 0) factor = 0; + if(factor > 1) factor = 1; + + if(sellingPrice > 0 && lowestPrice > 0 && sellingPrice < lowestPrice*factor) { + showWarning = true; + return true; + } else { + return false; + } + } + return false; + } + + public void overrideIsMouseOverSlot(Slot slot, int mouseX, int mouseY, CallbackInfoReturnable<Boolean> cir) { + if(shouldShow()) { + cir.setReturnValue(false); + } + } + + @Override + public void render() { + final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + final int width = scaledResolution.getScaledWidth(); + final int height = scaledResolution.getScaledHeight(); + + GlStateManager.disableLighting(); + + GlStateManager.pushMatrix(); + GlStateManager.translate(0, 0, 500); + + Gui.drawRect(0, 0, width, height, 0x80000000); + + RenderUtils.drawFloatingRectDark(width/2-90, height/2-45, 180, 90); + + int neuLength = Minecraft.getMinecraft().fontRendererObj.getStringWidth("\u00a7lNEU"); + Minecraft.getMinecraft().fontRendererObj.drawString("\u00a7lNEU", width/2+90-neuLength-3, height/2-45+4, 0xff000000); + + TextRenderUtils.drawStringCenteredScaledMaxWidth("Are you SURE?", Minecraft.getMinecraft().fontRendererObj, + width/2, height/2-45+10, false, 170, 0xffff4040); + + String lowestPriceStr; + if(lowestPrice > 999) { + lowestPriceStr = Utils.shortNumberFormat(lowestPrice, 0); + } else { + lowestPriceStr = ""+lowestPrice; + } + + String sellingPriceStr; + if(sellingPrice > 999) { + sellingPriceStr = Utils.shortNumberFormat(sellingPrice, 0); + } else { + sellingPriceStr = ""+sellingPrice; + } + + String sellLine = "\u00a77[ \u00a7r"+sellingName+"\u00a77 ]"; + + TextRenderUtils.drawStringCenteredScaledMaxWidth(sellLine, Minecraft.getMinecraft().fontRendererObj, + width/2, height/2-45+25, false, 170, 0xffffffff); + TextRenderUtils.drawStringCenteredScaledMaxWidth("has a lowest BIN of \u00a76"+lowestPriceStr+"\u00a7r coins", Minecraft.getMinecraft().fontRendererObj, + width/2, height/2-45+34, false, 170, 0xffa0a0a0); + + int buyPercentage = 100 - sellingPrice*100/lowestPrice; + if(buyPercentage <= 0) buyPercentage = 1; + + TextRenderUtils.drawStringCenteredScaledMaxWidth("Continue selling it for", Minecraft.getMinecraft().fontRendererObj, + width/2, height/2-45+50, false, 170, 0xffa0a0a0); + TextRenderUtils.drawStringCenteredScaledMaxWidth("\u00a76"+sellingPriceStr+"\u00a7r coins? (\u00a7c-"+buyPercentage+"%\u00a7r)", + Minecraft.getMinecraft().fontRendererObj, + width/2, height/2-45+59, false, 170, 0xffa0a0a0); + + RenderUtils.drawFloatingRectDark(width/2-43, height/2+23, 40, 16, false); + RenderUtils.drawFloatingRectDark(width/2+3, height/2+23, 40, 16, false); + + TextRenderUtils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GREEN+"[Y]es", Minecraft.getMinecraft().fontRendererObj, + width/2-23, height/2+31, true, 36, 0xff00ff00); + TextRenderUtils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.RED+"[n]o", Minecraft.getMinecraft().fontRendererObj, + width/2+23, height/2+31, true, 36, 0xffff0000); + + if(sellingTooltip != null) { + int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth; + int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; + + int sellLineLength = Minecraft.getMinecraft().fontRendererObj.getStringWidth(sellLine); + + if(mouseX >= width/2-sellLineLength/2 && mouseX <= width/2+sellLineLength/2 && + mouseY >= height/2-45+20 && mouseY <= height/2-45+30) { + Utils.drawHoveringText(sellingTooltip, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj); + } + } + + GlStateManager.popMatrix(); + } + + @Override + public boolean mouseInput(int mouseX, int mouseY) { + final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + final int width = scaledResolution.getScaledWidth(); + final int height = scaledResolution.getScaledHeight(); + + if(Mouse.getEventButtonState()) { + if(mouseY >= height/2+23 && mouseY <= height/2+23+16) { + if(mouseX >= width/2-43 && mouseX <= width/2-3) { + GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; + Minecraft.getMinecraft().playerController.windowClick(chest.inventorySlots.windowId, + 29, 0, 0, Minecraft.getMinecraft().thePlayer); + showWarning = false; + } else { + showWarning = false; + } + } + + if(mouseX < width/2-90 || mouseX > width/2+90 || + mouseY < height/2-45 || mouseY > height/2+45) { + showWarning = false; + } + } + + return false; + } + + @Override + public boolean keyboardInput() { + if(!Keyboard.getEventKeyState()) { + if(Keyboard.getEventKey() == Keyboard.KEY_Y || Keyboard.getEventKey() == Keyboard.KEY_RETURN) { + GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; + Minecraft.getMinecraft().playerController.windowClick(chest.inventorySlots.windowId, + 29, 0, 0, Minecraft.getMinecraft().thePlayer); + } + showWarning = false; + } + + return false; + } + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java new file mode 100644 index 00000000..3002bce0 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java @@ -0,0 +1,75 @@ +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.core.util.render.TextRenderUtils; +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.renderer.GlStateManager; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import java.util.List; + +public class AuctionSortModeWarning { + + private static final AuctionSortModeWarning INSTANCE = new AuctionSortModeWarning(); + public static AuctionSortModeWarning getInstance() { + return INSTANCE; + } + + private boolean isAuctionBrowser() { + return NotEnoughUpdates.INSTANCE.config.ahTweaks.enableSortWarning && + Minecraft.getMinecraft().currentScreen instanceof GuiChest && + (SBInfo.getInstance().lastOpenContainerName.startsWith("Auctions Browser") || + SBInfo.getInstance().lastOpenContainerName.startsWith("Auctions: \"")); + } + + public void onPostGuiRender() { + if(isAuctionBrowser()) { + GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; + + ItemStack stack = chest.inventorySlots.getSlot(50).getStack(); + + if(stack != null) { + List<String> tooltip = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + + String selectedSort = null; + for(String line : tooltip) { + if(line.startsWith("\u00a75\u00a7o\u00a7b\u25B6 ")) { + selectedSort = Utils.cleanColour(line.substring("\u00a75\u00a7o\u00a7b\u25B6 ".length())); + } + } + + if(selectedSort != null) { + if(!selectedSort.trim().equals("Lowest Price")) { + GlStateManager.disableLighting(); + GlStateManager.pushMatrix(); + GlStateManager.translate(0, 0, 500); + + String selectedColour = "\u00a7e"; + + if(selectedSort.trim().equals("Highest Price")) { + selectedColour = "\u00a7c"; + } + + String warningText = "\u00a7aSort: " + selectedColour + selectedSort; + int warningLength = Minecraft.getMinecraft().fontRendererObj.getStringWidth(warningText); + + int centerX = chest.guiLeft+chest.xSize/2+9; + int centerY = chest.guiTop+26; + + RenderUtils.drawFloatingRectDark(centerX - warningLength/2 - 4, centerY - 6, + warningLength+8, 12, false); + TextRenderUtils.drawStringCenteredScaledMaxWidth(warningText, Minecraft.getMinecraft().fontRendererObj, + centerX, centerY, true, chest.width/2, 0xffffffff); + GlStateManager.popMatrix(); + } + } + } + } + } + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java index 0aa5e84d..65ccd73f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java @@ -3,6 +3,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures; import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.NEUEventListener; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.TexLoc; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; @@ -119,17 +120,29 @@ public class BetterContainers { return isChestOpen() && ((loaded && texture != null) || System.currentTimeMillis() - lastRenderMillis < 200) && !isBlacklistedInventory(); } - public static boolean isBlankStack(ItemStack stack) { + public static boolean isBlankStack(int index, ItemStack stack) { + if(index == 42 && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && + (SBInfo.getInstance().lastOpenContainerName.contains("'s Profile") || + SBInfo.getInstance().lastOpenContainerName.contains("s' Profile"))) { + return false; + } + return stack != null && stack.getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) && stack.getItemDamage() == 15 && stack.getDisplayName() != null && stack.getDisplayName().trim().isEmpty(); } - public static boolean shouldRenderStack(ItemStack stack) { - return !isBlankStack(stack) && !isToggleOff(stack) && !isToggleOn(stack); + public static boolean shouldRenderStack(int index, ItemStack stack) { + return !isBlankStack(index, stack) && !isToggleOff(stack) && !isToggleOn(stack); } - public static boolean isButtonStack(ItemStack stack) { + public static boolean isButtonStack(int index, ItemStack stack) { + if(index == 42 && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && + (SBInfo.getInstance().lastOpenContainerName.contains("'s Profile") || + SBInfo.getInstance().lastOpenContainerName.contains("s' Profile"))) { + return true; + } + return stack != null && stack.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane) && NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack) == null && !isToggleOn(stack) && !isToggleOff(stack); } @@ -220,7 +233,7 @@ public class BetterContainers { !lower.getDisplayName().getUnformattedText().contains("Stakes"); for (int index = 0; index < size; index++) { ItemStack stack = getStackCached(lower, index); - buttons[index%9][index/9] = isButtonStack(stack); + buttons[index%9][index/9] = isButtonStack(index, stack); if(ultrasequencer && stack.getItem() == Items.dye) { buttons[index%9][index/9] = false; @@ -234,7 +247,7 @@ public class BetterContainers { //buttons[index%9][index/9] = false; //slots[index%9][index/9] = true; } else { - slots[index%9][index/9] = !isBlankStack(stack) && !buttons[index%9][index/9]; + slots[index%9][index/9] = !isBlankStack(index, stack) && !buttons[index%9][index/9]; } } for (int index = 0; index < size; index++) { @@ -351,7 +364,7 @@ public class BetterContainers { IInventory lower = ((ContainerChest)container).getLowerChestInventory(); int size = lower.getSizeInventory(); for(int index=0; index<size; index++) { - if(isBlankStack(getStackCached(lower, index))) return true; + if(isBlankStack(index, getStackCached(lower, index))) return true; } } return false; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java deleted file mode 100644 index 0fd2100c..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java +++ /dev/null @@ -1,74 +0,0 @@ -package io.github.moulberry.notenoughupdates.miscfeatures; - -import io.github.moulberry.notenoughupdates.NotEnoughUpdates; -import io.github.moulberry.notenoughupdates.util.SBInfo; -import net.minecraft.client.Minecraft; -import net.minecraft.network.play.client.C13PacketPlayerAbilities; -import net.minecraft.network.play.server.S39PacketPlayerAbilities; - -public class FlyFix { - - private static boolean serverWantFly = false; - private static boolean clientWantFly = false; - private static long lastAbilitySend = 0; - - public static void onSendAbilities(C13PacketPlayerAbilities packet) { - if(true) return; - //if(!NotEnoughUpdates.INSTANCE.config.misc.flyFix) return; - if(Minecraft.getMinecraft().thePlayer == null) return; - if(!Minecraft.getMinecraft().thePlayer.capabilities.allowFlying) return; - if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return; - if(SBInfo.getInstance().getLocation() == null) return; - if(!SBInfo.getInstance().getLocation().equals("dynamic")) return; - - long currentTime = System.currentTimeMillis(); - - clientWantFly = packet.isFlying(); - if(clientWantFly != serverWantFly) lastAbilitySend = currentTime; - } - - public static void onReceiveAbilities(S39PacketPlayerAbilities packet) { - if(true) return; - //if(!NotEnoughUpdates.INSTANCE.config.misc.flyFix) return; - if(Minecraft.getMinecraft().thePlayer == null) return; - if(!Minecraft.getMinecraft().thePlayer.capabilities.allowFlying) return; - if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return; - if(SBInfo.getInstance().getLocation() == null) return; - if(!SBInfo.getInstance().getLocation().equals("dynamic")) return; - - long currentTime = System.currentTimeMillis(); - - serverWantFly = packet.isFlying(); - - if(serverWantFly != clientWantFly) { - if(currentTime - lastAbilitySend > 0 && currentTime - lastAbilitySend < 500) { - packet.setFlying(clientWantFly); - } else { - clientWantFly = serverWantFly; - } - } - } - - public static void tick() { - if(true) return; - //if(!NotEnoughUpdates.INSTANCE.config.misc.flyFix) return; - if(Minecraft.getMinecraft().thePlayer == null) return; - if(!Minecraft.getMinecraft().thePlayer.capabilities.allowFlying) return; - if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return; - if(SBInfo.getInstance().getLocation() == null) return; - if(!SBInfo.getInstance().getLocation().equals("dynamic")) return; - - long currentTime = System.currentTimeMillis(); - - if(currentTime - lastAbilitySend > 1000 && currentTime - lastAbilitySend < 5000) { - if(clientWantFly != serverWantFly) { - Minecraft.getMinecraft().thePlayer.capabilities.isFlying = serverWantFly; - Minecraft.getMinecraft().thePlayer.sendPlayerAbilities(); - clientWantFly = serverWantFly; - } - } else { - clientWantFly = Minecraft.getMinecraft().thePlayer.capabilities.isFlying; - } - } - -} 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 1b07ebdc..0fbf9406 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java @@ -29,6 +29,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.play.client.C0EPacketClickWindow; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import org.apache.commons.lang3.text.WordUtils; @@ -199,12 +200,6 @@ public class GuiCustomEnchant extends Gui { } public boolean shouldOverride(String containerName) { - - if(!NotEnoughUpdates.INSTANCE.config.hidden.dev) { - shouldOverrideFast = false; - return false; - } - shouldOverrideFast = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableTableGUI && containerName != null && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && @@ -509,6 +504,25 @@ public class GuiCustomEnchant extends Gui { this.pageOpen += this.pageOpenVelocity; } + + private List<String> createTooltip(String title, int selectedOption, String... options) { + String selPrefix = EnumChatFormatting.DARK_AQUA + " \u25b6 "; + String unselPrefix = EnumChatFormatting.GRAY.toString(); + + for(int i=0; i<options.length; i++) { + if(i == selectedOption) { + options[i] = selPrefix + options[i]; + } else { + options[i] = unselPrefix + options[i]; + } + } + + List list = Lists.newArrayList(options); + list.add(0, ""); + list.add(0, EnumChatFormatting.GREEN+title); + return list; + } + public void render(float partialTicks) { if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) return; @@ -549,12 +563,14 @@ public class GuiCustomEnchant extends Gui { Minecraft.getMinecraft().fontRendererObj.drawString("Applicable", guiLeft+7, guiTop+7, 0x404040, false); Minecraft.getMinecraft().fontRendererObj.drawString("Removable", guiLeft+247, guiTop+7, 0x404040, false); + //Page Text if(currentState == EnchantState.HAS_ITEM || currentState == EnchantState.ADDING_ENCHANT) { String pageStr = "Page: "+currentPage+"/"+expectedMaxPage; int pageStrLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(pageStr); Utils.drawStringCentered(pageStr, Minecraft.getMinecraft().fontRendererObj, guiLeft+X_SIZE/2, guiTop+14, false, 0x404040); + //Page Arrows Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(guiLeft+X_SIZE/2-pageStrLen/2-2-15, guiTop+6, 15, 15, @@ -563,6 +579,57 @@ public class GuiCustomEnchant extends Gui { 15/512f, 30/512f, 372/512f, 387/512f, GL11.GL_NEAREST); } + //Settings Buttons + Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE); + GlStateManager.color(1, 1, 1, 1); + //On Settings Button + Utils.drawTexturedRect(guiLeft+295, guiTop+147, 16, 16, + 0, 16/512f, 387/512f, (387+16)/512f, GL11.GL_NEAREST); + //Incompatible Settings Button + float incompatibleMinU = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.incompatibleEnchants*16/512f; + Utils.drawTexturedRect(guiLeft+295+18, guiTop+147, 16, 16, + incompatibleMinU, incompatibleMinU+16/512f, 403/512f, (403+16)/512f, GL11.GL_NEAREST); + //Sorting Settings Button + float sortingMinU = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enchantSorting*16/512f; + Utils.drawTexturedRect(guiLeft+295, guiTop+147+18, 16, 16, + sortingMinU, sortingMinU+16/512f, 419/512f, (419+16)/512f, GL11.GL_NEAREST); + //Ordering Settings Button + float orderingMinU = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enchantOrdering*16/512f; + Utils.drawTexturedRect(guiLeft+295+18, guiTop+147+18, 16, 16, + orderingMinU, orderingMinU+16/512f, 435/512f, (435+16)/512f, GL11.GL_NEAREST); + + if(mouseX >= guiLeft+294 && mouseX < guiLeft+294+36 && + mouseY >= guiTop+146 && mouseY < guiTop+146+36) { + int index = (mouseX-(guiLeft+295))/18 + (mouseY-(guiTop+147))/18*2; + switch (index) { + case 0: + Gui.drawRect(guiLeft+295, guiTop+147, guiLeft+295+16, guiTop+147+16, 0x80ffffff); + tooltipToDisplay = createTooltip("Enable GUI", 0, "On", "Off"); + break; + case 1: + Gui.drawRect(guiLeft+295+18, guiTop+147, guiLeft+295+16+18, guiTop+147+16, 0x80ffffff); + tooltipToDisplay = createTooltip("Incompatible Enchants", + NotEnoughUpdates.INSTANCE.config.enchantingSolvers.incompatibleEnchants, + "Highlight", "Hide"); + tooltipToDisplay.add(1, EnumChatFormatting.GRAY+"How to display enchants that are"); + tooltipToDisplay.add(2, EnumChatFormatting.GRAY+"incompatible with your current item,"); + tooltipToDisplay.add(3, EnumChatFormatting.GRAY+"eg. Smite on a sword with Sharpness"); + break; + case 2: + Gui.drawRect(guiLeft+295, guiTop+147+18, guiLeft+295+16, guiTop+147+16+18, 0x80ffffff); + tooltipToDisplay = createTooltip("Sort enchants...", + NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enchantSorting, + "By Cost", "Alphabetically"); + break; + case 3: + Gui.drawRect(guiLeft+295+18, guiTop+147+18, guiLeft+295+16+18, guiTop+147+16+18, 0x80ffffff); + tooltipToDisplay = createTooltip("Order enchants...", + NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enchantOrdering, + "Ascending", "Descending"); + break; + } + } + //Left scroll bar { int offset; @@ -1355,6 +1422,48 @@ public class GuiCustomEnchant extends Gui { lerpingInteger.setValue(newScroll); } } + + //Config options + if(Mouse.getEventButtonState()) { + if(mouseX >= guiLeft+294 && mouseX < guiLeft+294+36 && + mouseY >= guiTop+146 && mouseY < guiTop+146+36) { + int index = (mouseX-(guiLeft+295))/18 + (mouseY-(guiTop+147))/18*2; + + int direction = Mouse.getEventButton() == 0 ? 1 : -1; + + switch (index) { + case 0: { + NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableTableGUI = false; + break; + } + case 1: { + int val = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.incompatibleEnchants; + val += direction; + if (val < 0) val = 1; + if (val > 1) val = 0; + NotEnoughUpdates.INSTANCE.config.enchantingSolvers.incompatibleEnchants = val; + break; + } + case 2: { + int val = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enchantSorting; + val += direction; + if (val < 0) val = 1; + if (val > 1) val = 0; + NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enchantSorting = val; + break; + } + case 3: { + int val = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enchantOrdering; + val += direction; + if (val < 0) val = 1; + if (val > 1) val = 0; + NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enchantOrdering = val; + break; + } + } + } + } + if(Mouse.getEventButton() == 0) { if(Mouse.getEventButtonState()) { if(mouseX > guiLeft+104 && mouseX < guiLeft+104+12) { 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 c518afaa..f9344a3a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java @@ -12,6 +12,7 @@ import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.EnumChatFormatting; @@ -39,6 +40,7 @@ public class GuiEnchantColour extends GuiScreen { public static final ResourceLocation custom_ench_colour = new ResourceLocation("notenoughupdates:custom_ench_colour.png"); + private static final String sharePrefix = "NEUEC/"; private int guiLeft; private int guiTop; @@ -126,12 +128,6 @@ 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); @@ -196,13 +192,8 @@ public class GuiEnchantColour extends GuiScreen { } 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) { @@ -225,52 +216,15 @@ public class GuiEnchantColour extends GuiScreen { 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("Load preset", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+8, false, 86, 4210752); + Utils.drawStringCenteredScaledMaxWidth("from Clipboard", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+16, false, 86, 4210752); + Utils.drawStringCenteredScaledMaxWidth("Save preset", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+8+24, false, 86, 4210752); + Utils.drawStringCenteredScaledMaxWidth("to Clipboard", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+16+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; + if(!validShareContents()) { + Gui.drawRect(guiLeft+xSize+3, guiTopSidebar+2, guiLeft+xSize+3+88, guiTopSidebar+2+20, 0x80000000); + } } @Override @@ -353,6 +307,22 @@ public class GuiEnchantColour extends GuiScreen { } } + private boolean validShareContents() { + try { + String base64 = (String)Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor); + + if(base64.length() <= sharePrefix.length()) return false; + + try { + return new String(Base64.getDecoder().decode(base64)).startsWith(sharePrefix); + } catch (IllegalArgumentException e){ + return false; + } + } catch (HeadlessException | IOException | UnsupportedFlavorException e) { + return false; + } + } + @Override protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { super.mouseClicked(mouseX, mouseY, mouseButton); @@ -437,14 +407,9 @@ 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 { @@ -452,13 +417,20 @@ public class GuiEnchantColour extends GuiScreen { } catch (HeadlessException | IOException | UnsupportedFlavorException e) { return; } + + if(base64.length() <= sharePrefix.length()) return; + String jsonString; try { jsonString = new String(Base64.getDecoder().decode(base64)); + if(!jsonString.startsWith(sharePrefix)) return; + jsonString = jsonString.substring(sharePrefix.length()); } catch (IllegalArgumentException e){ return; - } + + System.out.println(jsonString); + JsonArray presetArray; try{ presetArray = new JsonParser().parse(jsonString).getAsJsonArray(); @@ -490,39 +462,11 @@ public class GuiEnchantColour extends GuiScreen { 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)); + String base64String = Base64.getEncoder().encodeToString((sharePrefix+jsonArray).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; -// } -// } -// } -// } -// } -// } } } 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 02f64f82..cfc51708 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java @@ -46,6 +46,8 @@ public class GuiInvButtonEditor extends GuiScreen { private static final ResourceLocation EXTRA_ICONS_JSON = new ResourceLocation("notenoughupdates:invbuttons/extraicons.json"); private static final ResourceLocation PRESETS_JSON = new ResourceLocation("notenoughupdates:invbuttons/presets.json"); + private static final String sharePrefix = "NEUBUTTONS/"; + private int xSize = 176; private int ySize = 166; @@ -293,8 +295,15 @@ public class GuiInvButtonEditor extends GuiScreen { 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); + Utils.drawStringCenteredScaledMaxWidth("Load preset", fontRendererObj, guiLeft-44-2-22, guiTop+8, false, 86, 4210752); + Utils.drawStringCenteredScaledMaxWidth("from Clipboard", fontRendererObj, guiLeft-44-2-22, guiTop+16, false, 86, 4210752); + Utils.drawStringCenteredScaledMaxWidth("Save preset", fontRendererObj, guiLeft-44-2-22, guiTop+8+24, false, 86, 4210752); + Utils.drawStringCenteredScaledMaxWidth("to Clipboard", fontRendererObj, guiLeft-44-2-22, guiTop+16+24, false, 86, 4210752); + + if(!validShareContents()) { + Gui.drawRect(guiLeft-88-2-22, guiTop+2, guiLeft-2-22, guiTop+2+20, 0x80000000); + } + GlStateManager.color(1, 1, 1, 1); if(presets != null) { @@ -475,6 +484,22 @@ public class GuiInvButtonEditor extends GuiScreen { super.handleMouseInput(); } + private boolean validShareContents() { + try { + String base64 = (String)Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor); + + if(base64.length() <= sharePrefix.length()) return false; + + try { + return new String(Base64.getDecoder().decode(base64)).startsWith(sharePrefix); + } catch (IllegalArgumentException e){ + return false; + } + } catch (HeadlessException | IOException | UnsupportedFlavorException e) { + return false; + } + } + @Override protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { super.mouseClicked(mouseX, mouseY, mouseButton); @@ -572,9 +597,6 @@ 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 { @@ -582,9 +604,14 @@ public class GuiInvButtonEditor extends GuiScreen { } catch (HeadlessException | IOException | UnsupportedFlavorException e) { return; } + + if(base64.length() <= sharePrefix.length()) return; + String jsonString; try { jsonString = new String(Base64.getDecoder().decode(base64)); + if(!jsonString.startsWith(sharePrefix)) return; + jsonString = jsonString.substring(sharePrefix.length()); } catch (IllegalArgumentException e) { return; @@ -629,7 +656,7 @@ public class GuiInvButtonEditor extends GuiScreen { 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)); + String base64String = Base64.getEncoder().encodeToString((sharePrefix+jsonArray).getBytes(StandardCharsets.UTF_8)); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(base64String), null); return; } 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 82634c87..89d97dfa 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java @@ -2,27 +2,27 @@ package io.github.moulberry.notenoughupdates.mixins; import io.github.moulberry.notenoughupdates.NEUEventListener; import io.github.moulberry.notenoughupdates.NEUOverlay; -import io.github.moulberry.notenoughupdates.miscfeatures.BetterContainers; -import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers; +import io.github.moulberry.notenoughupdates.miscfeatures.*; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; -import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay; -import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; import io.github.moulberry.notenoughupdates.miscgui.GuiCustomEnchant; import io.github.moulberry.notenoughupdates.miscgui.StorageOverlay; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.init.Blocks; import net.minecraft.inventory.Container; 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; +import net.minecraft.util.EnumChatFormatting; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -38,6 +38,11 @@ import java.util.concurrent.atomic.AtomicBoolean; @Mixin(GuiContainer.class) public abstract class MixinGuiContainer extends GuiScreen { + private static boolean hasProfileViewerStack = false; + private static final ItemStack profileViewerStack = Utils.createItemStack(Item.getItemFromBlock(Blocks.command_block), + EnumChatFormatting.GREEN + "Profile Viewer", + EnumChatFormatting.YELLOW + "Click to open NEU profile viewer!"); + @Inject(method="drawSlot", at=@At("RETURN")) public void drawSlotRet(Slot slotIn, CallbackInfo ci) { SlotLocking.getInstance().drawSlot(slotIn); @@ -47,6 +52,41 @@ public abstract class MixinGuiContainer extends GuiScreen { public void drawSlot(Slot slot, CallbackInfo ci) { if(slot == null) return; + GuiContainer $this = (GuiContainer)(Object)this; + + if(slot.slotNumber == 42 && $this instanceof GuiChest) { + hasProfileViewerStack = false; + + GuiChest eventGui = (GuiChest) $this; + ContainerChest cc = (ContainerChest) eventGui.inventorySlots; + String 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()))) { + ci.cancel(); + + this.zLevel = 100.0F; + this.itemRender.zLevel = 100.0F; + + GlStateManager.enableDepth(); + this.itemRender.renderItemAndEffectIntoGUI(profileViewerStack, slot.xDisplayPosition, slot.yDisplayPosition); + this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, profileViewerStack, + slot.xDisplayPosition, slot.yDisplayPosition, ""); + + this.itemRender.zLevel = 0.0F; + this.zLevel = 0.0F; + + hasProfileViewerStack = true; + } + } + } + } + } + if(slot.getStack() == null && NotEnoughUpdates.INSTANCE.overlay.searchMode && NEUEventListener.drawingGuiScreen) { GlStateManager.pushMatrix(); GlStateManager.translate(0, 0, 100 + Minecraft.getMinecraft().getRenderItem().zLevel); @@ -57,7 +97,6 @@ public abstract class MixinGuiContainer extends GuiScreen { GlStateManager.popMatrix(); } - GuiContainer $this = (GuiContainer)(Object)this; ItemStack stack = slot.getStack(); if(stack != null) { @@ -69,11 +108,33 @@ public abstract class MixinGuiContainer extends GuiScreen { RenderHelper.enableGUIStandardItemLighting(); - if(BetterContainers.isOverriding() && !BetterContainers.shouldRenderStack(stack)) { + if(BetterContainers.isOverriding() && !BetterContainers.shouldRenderStack(slot.slotNumber, stack)) { ci.cancel(); } } + @Redirect(method="drawScreen", at=@At( + value = "INVOKE", + target = "Lnet/minecraft/client/gui/inventory/GuiContainer;renderToolTip(Lnet/minecraft/item/ItemStack;II)V")) + public void drawScreen_renderTooltip(GuiContainer guiContainer, ItemStack stack, int x, int y) { + if(hasProfileViewerStack && theSlot.slotNumber == 42) { + this.renderToolTip(profileViewerStack, x, y); + } else { + this.renderToolTip(stack, x, y); + } + } + + @Inject(method="drawScreen", + at=@At( + value = "INVOKE", + target = "Lnet/minecraft/client/renderer/GlStateManager;popMatrix()V", + shift = At.Shift.AFTER + ) + ) + public void drawScreen_after(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { + AuctionSortModeWarning.getInstance().onPostGuiRender(); + } + @Redirect(method="mouseReleased", at=@At(value = "INVOKE", target = "Ljava/util/Set;isEmpty()Z")) public boolean mouseReleased_isEmpty(Set<?> set) { return set.size() <= 1; @@ -83,6 +144,7 @@ public abstract class MixinGuiContainer extends GuiScreen { public void isMouseOverSlot(Slot slotIn, int mouseX, int mouseY, CallbackInfoReturnable<Boolean> cir) { StorageOverlay.getInstance().overrideIsMouseOverSlot(slotIn, mouseX, mouseY, cir); GuiCustomEnchant.getInstance().overrideIsMouseOverSlot(slotIn, mouseX, mouseY, cir); + AuctionBINWarning.getInstance().overrideIsMouseOverSlot(slotIn, mouseX, mouseY, cir); } @Redirect(method="drawScreen", at=@At(value="INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiContainer;drawGradientRect(IIIIII)V")) @@ -104,7 +166,7 @@ public abstract class MixinGuiContainer extends GuiScreen { if(theSlot != null && SlotLocking.getInstance().isSlotLocked(theSlot)) { SlotLocking.getInstance().setRealSlot(theSlot); theSlot = null; - } else if( theSlot == null){ + } else if(theSlot == null){ SlotLocking.getInstance().setRealSlot(null); } } @@ -162,11 +224,12 @@ public abstract class MixinGuiContainer extends GuiScreen { @Redirect(method="drawScreen", at=@At(value="INVOKE", target=TARGET_CANBEHOVERED)) public boolean drawScreen_canBeHovered(Slot slot) { if(NotEnoughUpdates.INSTANCE.config.improvedSBMenu.hideEmptyPanes && - BetterContainers.isOverriding() && BetterContainers.isBlankStack(slot.getStack())) { + BetterContainers.isOverriding() && BetterContainers.isBlankStack(slot.slotNumber, slot.getStack())) { return false; } 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)){ @@ -178,6 +241,11 @@ public abstract class MixinGuiContainer extends GuiScreen { public void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType, CallbackInfo ci) { GuiContainer $this = (GuiContainer)(Object)this; + if(AuctionBINWarning.getInstance().onMouseClick(slotIn, slotId, clickedButton, clickType)) { + ci.cancel(); + return; + } + AtomicBoolean ret = new AtomicBoolean(false); SlotLocking.getInstance().onWindowClick(slotIn, slotId, clickedButton, clickType, (tuple) -> { ci.cancel(); @@ -204,11 +272,11 @@ public abstract class MixinGuiContainer extends GuiScreen { slotId, clickedButton, clickType); } } - if(slotIn != null && BetterContainers.isOverriding() && (BetterContainers.isBlankStack(slotIn.getStack()) || - BetterContainers.isButtonStack(slotIn.getStack()))) { + if(slotIn != null && BetterContainers.isOverriding() && (BetterContainers.isBlankStack(slotIn.slotNumber, slotIn.getStack()) || + BetterContainers.isButtonStack(slotIn.slotNumber, slotIn.getStack()))) { BetterContainers.clickSlot(slotIn.getSlotIndex()); - if(BetterContainers.isBlankStack(slotIn.getStack())) { + if(BetterContainers.isBlankStack(slotIn.slotNumber, slotIn.getStack())) { $this.mc.playerController.windowClick($this.inventorySlots.windowId, slotId, 2, clickType, $this.mc.thePlayer); ci.cancel(); } else { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java index 729fd5f4..5711f92b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java @@ -82,11 +82,6 @@ public class MixinNetHandlerPlayClient { ItemCooldowns.processBlockChangePacket(packetIn); } - @Inject(method="handlePlayerAbilities", at=@At("HEAD")) - public void handlePlayerAbilities(S39PacketPlayerAbilities packetIn, CallbackInfo ci) { - FlyFix.onReceiveAbilities(packetIn); - } - @Inject(method="addToSendQueue", at=@At("HEAD")) public void addToSendQueue(Packet packet, CallbackInfo ci) { if(packet instanceof C0EPacketClickWindow) { 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 98816714..a789acfd 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -35,8 +35,7 @@ public class NEUConfig extends Config { overlay.renderDummy(); OverlayManager.dontRenderOverlay = overlay.getClass(); }, () -> { - }, () -> NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper( - new NEUConfigEditor(NotEnoughUpdates.INSTANCE.config, activeConfig)) + }, () -> NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper(NEUConfigEditor.editor) )); } @@ -49,7 +48,6 @@ public class NEUConfig extends Config { activeConfigCategory = ((NEUConfigEditor)wrapper.element).getSelectedCategoryName(); } } - final String activeConfigCategoryF = activeConfigCategory; switch (runnableId) { case 0: @@ -63,8 +61,7 @@ public class NEUConfig extends Config { NotEnoughUpdates.INSTANCE.config.mining.drillFuelBarPosition, NotEnoughUpdates.INSTANCE.config.mining.drillFuelBarWidth, 12, () -> { }, () -> { - }, () -> NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper( - new NEUConfigEditor(NotEnoughUpdates.INSTANCE.config, activeConfigCategoryF)) + }, () -> NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper(NEUConfigEditor.editor) )); return; case 3: @@ -236,12 +233,13 @@ public class NEUConfig extends Config { ) public PetOverlay petOverlay = new PetOverlay(); + @Expose @Category( - name = "AH Search GUI", - desc = "AH Search GUI" + name = "AH Tweaks", + desc = "Tweaks for Hypixel's (Not NEU's) Auction House" ) - public AuctionHouseSearch auctionHouseSearch = new AuctionHouseSearch(); + public AHTweaks ahTweaks = new AHTweaks(); @Expose @Category( diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java index 2d89d4b4..8e5edef1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java @@ -33,6 +33,8 @@ import java.util.List; public class NEUConfigEditor extends GuiElement { + public static NEUConfigEditor editor = new NEUConfigEditor(NotEnoughUpdates.INSTANCE.config); + private static final ResourceLocation[] socialsIco = new ResourceLocation[] { DISCORD, GITHUB, @@ -112,6 +114,8 @@ public class NEUConfigEditor extends GuiElement { } } } + + editor = this; } private LinkedHashMap<String, ConfigProcessor.ProcessedCategory> getCurrentConfigEditing() { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AHTweaks.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AHTweaks.java new file mode 100644 index 00000000..3e602b08 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AHTweaks.java @@ -0,0 +1,97 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections; + +import com.google.gson.annotations.Expose; +import io.github.moulberry.notenoughupdates.core.config.annotations.*; + +public class AHTweaks { + + @ConfigOption( + name = "Search GUI", + desc = "" + ) + @ConfigEditorAccordion(id = 0) + public boolean searchAccordion = false; + + @Expose + @ConfigOption( + name = "Enable Search GUI", + desc = "Use the advanced search GUI with autocomplete and history instead of the normal sign GUI\n\u00a7eStar Selection Texture: Johnny#4567" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean enableSearchOverlay = true; + + @Expose + @ConfigOption( + name = "Keep Previous Search", + desc = "Don't clear the search bar after closing the GUI" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean keepPreviousSearch = false; + + @Expose + @ConfigOption( + name = "Past Searches", + desc = "Show past searches below the autocomplete box" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean showPastSearches = true; + + @Expose + @ConfigOption( + name = "ESC to Full Close", + desc = "Make pressing ESCAPE close the search GUI without opening up the AH again\n" + + "ENTER can still be used to search" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean escFullClose = true; + + @ConfigOption( + name = "BIN Warning", + desc = "" + ) + @ConfigEditorAccordion(id = 1) + public boolean binWarningAccordion = false; + + @Expose + @ConfigOption( + name = "Enable BIN Warning", + desc = "Ask for confirmation when BINing an item for below X% of lowestbin" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 1) + public boolean enableBINWarning = true; + + @Expose + @ConfigOption( + name = "Warning Threshold", + desc = "Threshold for BIN warning\nExample: 10% means warn if sell price is 10% lower than lowestbin" + ) + @ConfigEditorSlider( + minValue = 0.0f, + maxValue = 100.0f, + minStep = 5f + ) + @ConfigAccordionId(id = 1) + public float warningThreshold = 10f; + + @ConfigOption( + name = "Sort Warning", + desc = "" + ) + @ConfigEditorAccordion(id = 2) + public boolean sortWarningAccordion = false; + + @Expose + @ConfigOption( + name = "Enable Sort Warning", + desc = "Show the sort mode when the mode is not 'Lowest Price'" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 2) + public boolean enableSortWarning = true; + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AuctionHouseSearch.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AuctionHouseSearch.java deleted file mode 100644 index 89e25222..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AuctionHouseSearch.java +++ /dev/null @@ -1,40 +0,0 @@ -package io.github.moulberry.notenoughupdates.options.seperateSections;
-
-import com.google.gson.annotations.Expose;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
-
-public class AuctionHouseSearch {
- @Expose
- @ConfigOption(
- name = "Enable Search GUI",
- desc = "Use the advanced search GUI with autocomplete and history instead of the normal sign GUI\n\u00a7eStar Selection Texture: Johnny#4567"
- )
- @ConfigEditorBoolean
- public boolean enableSearchOverlay = true;
-
- @Expose
- @ConfigOption(
- name = "Keep Previous Search",
- desc = "Don't clear the search bar after closing the GUI"
- )
- @ConfigEditorBoolean
- public boolean keepPreviousSearch = false;
-
- @Expose
- @ConfigOption(
- name = "Past Searches",
- desc = "Show past searches below the autocomplete box"
- )
- @ConfigEditorBoolean
- public boolean showPastSearches = true;
-
- @Expose
- @ConfigOption(
- name = "ESC to Full Close",
- desc = "Make pressing ESCAPE close the search GUI without opening up the AH again\n" +
- "ENTER can still be used to search"
- )
- @ConfigEditorBoolean
- public boolean escFullClose = true;
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Enchanting.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Enchanting.java index a505f8b7..9c4156f0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Enchanting.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Enchanting.java @@ -23,7 +23,7 @@ public class Enchanting { @Expose @ConfigOption( name = "Incompatible Enchants", - desc = "Handle enchants that are incompatible with your current item, eg. Smite on a sword with Sharpness" + desc = "How to display enchants that are incompatible with your current item, eg. Smite on a sword with Sharpness" ) @ConfigEditorDropdown( values = {"Highlight", "Hide"} @@ -45,7 +45,7 @@ public class Enchanting { @Expose @ConfigOption( name = "Enchant Ordering", - desc = "Change the method of ordered used by the sort" + desc = "Change the method of ordering used by the sort" ) @ConfigEditorDropdown( values = {"Ascending", "Descending"} 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 86256650..4e4524e2 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 @@ -240,7 +240,7 @@ public class ItemOverlays { "\u00a7rHold a Bonemerang to display the overlay"
)
@ConfigEditorDraggableList(
- exampleText = {"\u00a74Gonna break",
+ exampleText = {"\u00a7cBonemerang will break!",
"\u00a77Targets: \u00a76\u00a7l10"
}
)
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java index 47fbfcc5..0209b097 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java @@ -23,7 +23,7 @@ public class MiscOverlays { )
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
- public boolean todoOverlay = false;
+ public boolean todoOverlay2 = false;
@Expose
@ConfigOption(
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 98358d83..df8df020 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 @@ -50,7 +50,7 @@ public class SlotLocking { public boolean lockSlotsInTrade = true;
@Expose
- @ConfigOption(
+ /*@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."
@@ -59,7 +59,7 @@ public class SlotLocking { minValue = 0,
maxValue = 500,
minStep = 5
- )
+ )*/
public int slotLockSwapDelay = 100;
@Expose
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 1bdbc84a..c6266393 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 @@ -101,9 +101,7 @@ public class TooltipTweaks { desc = "Show which the full amount of pet xp required"
)
@ConfigEditorBoolean
- public boolean petExtendExp = true;
-
-
+ public boolean petExtendExp = false;
@Expose
@ConfigOption(
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java index 00a91219..816a6c63 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java @@ -69,10 +69,10 @@ public class AuctionSearchOverlay { public static boolean shouldReplace() { if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return false; - if(!NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.enableSearchOverlay) return false; + if(!NotEnoughUpdates.INSTANCE.config.ahTweaks.enableSearchOverlay) return false; if(!(Minecraft.getMinecraft().currentScreen instanceof GuiEditSign)) { - if(!NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.keepPreviousSearch) searchString = ""; + if(!NotEnoughUpdates.INSTANCE.config.ahTweaks.keepPreviousSearch) searchString = ""; return false; } @@ -100,7 +100,7 @@ public class AuctionSearchOverlay { Utils.drawGradientRect(0, 0, width, height, -1072689136, -804253680); - int h = NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.showPastSearches ? 219 : 145; + int h = NotEnoughUpdates.INSTANCE.config.ahTweaks.showPastSearches ? 219 : 145; int topY = height/4; if(scaledResolution.getScaleFactor() >= 4) { @@ -177,7 +177,7 @@ public class AuctionSearchOverlay { } } - if(NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.showPastSearches) { + if(NotEnoughUpdates.INSTANCE.config.ahTweaks.showPastSearches) { Minecraft.getMinecraft().fontRendererObj.drawString("Past Searches:", width/2-100, topY+25+ AUTOCOMPLETE_HEIGHT +5, 0xdddddd, true); for(int i=0; i<5; i++) { @@ -195,7 +195,7 @@ public class AuctionSearchOverlay { } public static void close() { - if(NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.keepPreviousSearch) { + if(NotEnoughUpdates.INSTANCE.config.ahTweaks.keepPreviousSearch) { search(); } else { synchronized(autocompletedItems) { @@ -328,7 +328,7 @@ public class AuctionSearchOverlay { if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { searchStringExtra = ""; close(); - if(NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.escFullClose) { + if(NotEnoughUpdates.INSTANCE.config.ahTweaks.escFullClose) { Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(Minecraft.getMinecraft().thePlayer.openContainer.windowId)); } } else if(Keyboard.getEventKey() == Keyboard.KEY_RETURN) { @@ -351,7 +351,7 @@ public class AuctionSearchOverlay { int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth; int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; - int h = NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.showPastSearches ? 219 : 145; + int h = NotEnoughUpdates.INSTANCE.config.ahTweaks.showPastSearches ? 219 : 145; int topY = height/4; if(scaledResolution.getScaleFactor() >= 4) { @@ -451,7 +451,7 @@ public class AuctionSearchOverlay { } } - if(NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.showPastSearches) { + if(NotEnoughUpdates.INSTANCE.config.ahTweaks.showPastSearches) { for(int i=0; i<5; i++) { if(i >= NotEnoughUpdates.INSTANCE.config.hidden.previousAuctionSearches.size()) break; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java index 7d54cf47..80bc9855 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java @@ -19,24 +19,21 @@ import java.util.function.Supplier; import static net.minecraft.util.EnumChatFormatting.DARK_AQUA; -public class BonemerangOverlay extends TextOverlay{ +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 static BonemerangOverlay INSTANCE; public final Set<EntityLivingBase> bonemeragedEntities = new HashSet<>(); - - @Override public void updateFrequent() { if(NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangFastUpdate){ updateOverlay(); } - } @Override @@ -44,7 +41,6 @@ public class BonemerangOverlay extends TextOverlay{ if(!NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangFastUpdate){ updateOverlay(); } - } private void updateOverlay(){ @@ -66,7 +62,6 @@ public class BonemerangOverlay extends TextOverlay{ 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; @@ -89,7 +84,6 @@ public class BonemerangOverlay extends TextOverlay{ 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()) { @@ -102,7 +96,6 @@ public class BonemerangOverlay extends TextOverlay{ 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)) { 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 b1cf5b11..409f1a70 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java @@ -111,8 +111,8 @@ public class OverlayManager { }); List<String> bonemerangDummy = Lists.newArrayList( - "\u00a74Gonna break", - "\u00a77Targets: \u00a76\u00a7lLike alot" + "\u00a7cBonemerang will break!", + "\u00a77Targets: \u00a76\u00a7l10" ); bonemerangOverlay = new BonemerangOverlay(NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangPosition, () -> bonemerangDummy, () -> { int style = NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangOverlayStyle; 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 8c5c119d..56fa2e99 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java @@ -1,6 +1,5 @@ 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; @@ -14,8 +13,6 @@ 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; @@ -314,7 +311,7 @@ public class TimersOverlay extends TextOverlay { } - if (!NotEnoughUpdates.INSTANCE.config.miscOverlays.todoOverlay) { + if (!NotEnoughUpdates.INSTANCE.config.miscOverlays.todoOverlay2) { overlayStrings = null; return; } 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 01f789de..d84038fa 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -429,7 +429,7 @@ public class GuiProfileViewer extends GuiScreen { desk.browse(new URI("https://sky.shiiyu.moe/stats/"+profile.getHypixelProfile().get("displayname").getAsString()+"/"+profileId)); Utils.playPressSound(); return; - } catch (IOException | URISyntaxException ignored) { + } catch (UnsupportedOperationException | IOException | URISyntaxException ignored) { //no idea how this sounds, but ya know just in case Utils.playSound(new ResourceLocation("game.player.hurt"), true); return; @@ -1259,14 +1259,10 @@ public class GuiProfileViewer extends GuiScreen { } 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; 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 e41ef78d..9699f4ad 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java @@ -28,6 +28,9 @@ import java.util.regex.Pattern; public class SBInfo { private static final SBInfo INSTANCE = new SBInfo(); + public static SBInfo getInstance() { + return INSTANCE; + } private static final Pattern timePattern = Pattern.compile(".+(am|pm)"); @@ -43,11 +46,7 @@ public class SBInfo { public Date currentTimeDate = null; - public String lastOpenContainerName = null; - - public static SBInfo getInstance() { - return INSTANCE; - } + public String lastOpenContainerName = ""; private long lastManualLocRaw = -1; private long lastLocRaw = -1; @@ -77,7 +76,7 @@ public class SBInfo { locraw = null; mode = null; joinedWorld = System.currentTimeMillis(); - lastOpenContainerName = null; + lastOpenContainerName = ""; } @SubscribeEvent diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java index 20219ff6..68815fb8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java @@ -181,9 +181,8 @@ public class XPInformation { correctionCounter = 0; skillInfoMap.put(skill.toLowerCase(), skillInfo); } - - updateWithPercentage.remove(skill); } + updateWithPercentage.clear(); } public void tick() { diff --git a/src/main/resources/assets/notenoughupdates/custom_enchant_gui.png b/src/main/resources/assets/notenoughupdates/custom_enchant_gui.png Binary files differindex 0da375a5..06a1fb5d 100644 --- a/src/main/resources/assets/notenoughupdates/custom_enchant_gui.png +++ b/src/main/resources/assets/notenoughupdates/custom_enchant_gui.png diff --git a/src/main/resources/assets/notenoughupdates/nohup.out b/src/main/resources/assets/notenoughupdates/nohup.out new file mode 100644 index 00000000..14abc1f2 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/nohup.out @@ -0,0 +1,2 @@ +using gegl copy +using gegl copy |