diff options
| author | BuildTools <james.jenour@protonmail.com> | 2020-07-08 16:28:49 +1000 |
|---|---|---|
| committer | BuildTools <james.jenour@protonmail.com> | 2020-07-08 16:28:49 +1000 |
| commit | 7bdf7f256fe3968fe7129928c0a7100c30628bf9 (patch) | |
| tree | 222deed2be57223e3b1703a638843fbf21a254e7 /src/main/java | |
| parent | f39c28236bc47a9e5395b041b494fdd7f332734e (diff) | |
| download | NotEnoughUpdates-7bdf7f256fe3968fe7129928c0a7100c30628bf9.tar.gz NotEnoughUpdates-7bdf7f256fe3968fe7129928c0a7100c30628bf9.tar.bz2 NotEnoughUpdates-7bdf7f256fe3968fe7129928c0a7100c30628bf9.zip | |
1.9.7
Diffstat (limited to 'src/main/java')
12 files changed, 1042 insertions, 372 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/GuiItemRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/GuiItemRecipe.java index 0cdef647..613ebe5f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/GuiItemRecipe.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/GuiItemRecipe.java @@ -13,6 +13,7 @@ import net.minecraft.item.ItemStack; public class GuiItemRecipe extends GuiCrafting { private ItemStack[] craftMatrix; + private JsonObject result; private String text; private String craftText = ""; private NEUManager manager; @@ -20,9 +21,14 @@ public class GuiItemRecipe extends GuiCrafting { public GuiItemRecipe(ItemStack[] craftMatrix, JsonObject result, String text, NEUManager manager) { super(Minecraft.getMinecraft().thePlayer.inventory, Minecraft.getMinecraft().theWorld); this.craftMatrix = craftMatrix; + this.result = result; this.text = text; this.manager = manager; + setContents(); + } + + public void setContents() { ContainerWorkbench cw = (ContainerWorkbench) this.inventorySlots; for(int i=0; i<Math.min(craftMatrix.length, 9); i++) { if(craftMatrix[i] == null) continue; @@ -35,6 +41,8 @@ public class GuiItemRecipe extends GuiCrafting { } protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { + setContents(); + String t = text.equals("") ? I18n.format("container.crafting", new Object[0]) : text; Utils.drawStringScaledMaxWidth(t, fontRendererObj, 28, 6, t.contains("\u00a7"), xSize-38, 4210752); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/GuiItemUsages.java b/src/main/java/io/github/moulberry/notenoughupdates/GuiItemUsages.java index 06fc3d71..a56293e9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/GuiItemUsages.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/GuiItemUsages.java @@ -66,6 +66,8 @@ public class GuiItemUsages extends GuiCrafting { protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { String t = "Crafting Usages"; + setIndex(currentIndex); + int guiX = mouseX - guiLeft; int guiY = mouseY - guiTop; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/GuiTextures.java b/src/main/java/io/github/moulberry/notenoughupdates/GuiTextures.java index ec44474e..573e20cf 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/GuiTextures.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/GuiTextures.java @@ -24,6 +24,7 @@ public class GuiTextures { public static final ResourceLocation item_mask = new ResourceLocation("notenoughupdates:item_mask.png"); public static final ResourceLocation auction_view = new ResourceLocation("notenoughupdates:auction_view.png"); + public static final ResourceLocation auction_accept = new ResourceLocation("notenoughupdates:auction_accept.png"); public static final ResourceLocation auction_price = new ResourceLocation("notenoughupdates:auction_price.png"); public static final ResourceLocation auction_view_buttons = new ResourceLocation("notenoughupdates:auction_view_buttons.png"); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index c1056108..f3263e0f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -7,6 +7,7 @@ import io.github.moulberry.notenoughupdates.options.Options; import io.github.moulberry.notenoughupdates.util.HypixelApi; import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; +import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -323,10 +324,12 @@ public class NEUManager { * Parses a file in to a JsonObject. */ public JsonObject getJsonFromFile(File file) throws IOException { - InputStream in = new FileInputStream(file); - BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); - JsonObject json = gson.fromJson(reader, JsonObject.class); - return json; + try { + InputStream in = new FileInputStream(file); + BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); + JsonObject json = gson.fromJson(reader, JsonObject.class); + return json; + } catch(Exception e) { return null; } } /** @@ -433,7 +436,12 @@ public class NEUManager { currentlyInstalledItems.add(f.getName().substring(0, f.getName().length()-5)); } - Set<String> removedItems = neuio.getRemovedItems(currentlyInstalledItems); + Set<String> removedItems; + if(config.autoupdate.value) { + removedItems = neuio.getRemovedItems(currentlyInstalledItems); + } else { + removedItems = new HashSet<>(); + } for(File f : itemsLocation.listFiles()) { String internalname = f.getName().substring(0, f.getName().length()-5); if(!removedItems.contains(internalname)) { @@ -454,6 +462,11 @@ public class NEUManager { if(json == null) { return; } + + String itemid = json.get("itemid").getAsString(); + itemid = Item.getByNameOrId(itemid).getRegistryName(); + json.addProperty("itemid", itemid); + itemMap.put(internalName, json); if(json.has("recipe")) { @@ -767,67 +780,84 @@ public class NEUManager { public JsonObject getJsonFromItemBytes(String item_bytes) { try { NBTTagCompound tag = CompressedStreamTools.readCompressed(new ByteArrayInputStream(Base64.getDecoder().decode(item_bytes))); - tag = tag.getTagList("i", 10).getCompoundTagAt(0); - int id = tag.getShort("id"); - int damage = tag.getShort("Damage"); - int count = tag.getShort("Count"); - tag = tag.getCompoundTag("tag"); - - String internalname = ""; - if(tag != null && tag.hasKey("ExtraAttributes", 10)) { - NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes"); - - if(ea.hasKey("id", 8)) { - internalname = ea.getString("id"); - } - } + return getJsonFromNBT(tag); + } catch(IOException e) { + return null; + } + } - String[] lore = new String[0]; - NBTTagCompound display = tag.getCompoundTag("display"); + public String getInternalnameFromNBT(NBTTagCompound tag) { + String internalname = "UNKNOWN"; + if(tag != null && tag.hasKey("ExtraAttributes", 10)) { + NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes"); - if(display.hasKey("Lore", 9)) { - NBTTagList list = display.getTagList("Lore", 8); - lore = new String[list.tagCount()]; - for(int k=0; k<list.tagCount(); k++) { - lore[k] = list.getStringTagAt(k); - } + if(ea.hasKey("id", 8)) { + internalname = ea.getString("id"); } + } + return internalname; + } + + public String[] getLoreFromNBT(NBTTagCompound tag) { + String[] lore = new String[0]; + NBTTagCompound display = tag.getCompoundTag("display"); - Item itemMc = Item.getItemById(id); - String itemid = "null"; - if(itemMc != null) { - itemid = itemMc.getRegistryName(); + if(display.hasKey("Lore", 9)) { + NBTTagList list = display.getTagList("Lore", 8); + lore = new String[list.tagCount()]; + for(int k=0; k<list.tagCount(); k++) { + lore[k] = list.getStringTagAt(k); } - String displayname = display.getString("Name"); - String[] info = new String[0]; - String clickcommand = ""; + } + return lore; + } + public JsonObject getJsonFromNBT(NBTTagCompound tag) { + tag = tag.getTagList("i", 10).getCompoundTagAt(0); + int id = tag.getShort("id"); + int damage = tag.getShort("Damage"); + int count = tag.getShort("Count"); + tag = tag.getCompoundTag("tag"); - //public JsonObject createItemJson(String internalname, String itemid, String displayname, String[] lore, - // String crafttext, String infoType, String[] info, - // String clickcommand, int damage, NBTTagCompound nbttag) { + if(id == 141) id = 391; //for some reason hypixel thinks carrots have id 141 - JsonObject item = new JsonObject(); - item.addProperty("internalname", internalname); - item.addProperty("itemid", itemid); - item.addProperty("displayname", displayname); + String internalname = getInternalnameFromNBT(tag); - if(lore != null && lore.length > 0) { - JsonArray jsonLore = new JsonArray(); - for (String line : lore) { - jsonLore.add(new JsonPrimitive(line)); - } - item.add("lore", jsonLore); - } + NBTTagCompound display = tag.getCompoundTag("display"); + String[] lore = getLoreFromNBT(tag); - item.addProperty("damage", damage); - if(count > 1) item.addProperty("count", count); - item.addProperty("nbttag", tag.toString()); + Item itemMc = Item.getItemById(id); + String itemid = "null"; + if(itemMc != null) { + itemid = itemMc.getRegistryName(); + } + String displayname = display.getString("Name"); + String[] info = new String[0]; + String clickcommand = ""; - return item; - } catch(IOException e) { - return null; + + //public JsonObject createItemJson(String internalname, String itemid, String displayname, String[] lore, + // String crafttext, String infoType, String[] info, + // String clickcommand, int damage, NBTTagCompound nbttag) { + + JsonObject item = new JsonObject(); + item.addProperty("internalname", internalname); + item.addProperty("itemid", itemid); + item.addProperty("displayname", displayname); + + if(lore != null && lore.length > 0) { + JsonArray jsonLore = new JsonArray(); + for (String line : lore) { + jsonLore.add(new JsonPrimitive(line)); + } + item.add("lore", jsonLore); } + + item.addProperty("damage", damage); + if(count > 1) item.addProperty("count", count); + item.addProperty("nbttag", tag.toString()); + + return item; } private String clean(String str) { @@ -1269,7 +1299,7 @@ public class NEUManager { } if(stack.getItem() == null) { - stack = new ItemStack(Items.diamond, 1, 10); //Purple broken texture item + stack = new ItemStack(Item.getItemFromBlock(Blocks.stone), 0, 255); //Purple broken texture item } else { if(json.has("damage")) { stack.setItemDamage(json.get("damage").getAsInt()); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 95ceb21f..1d50daa6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -76,6 +76,8 @@ public class NEUOverlay extends Gui { private final int searchBarYSize = 40; private final int searchBarPadding = 2; + private float oldWidthMult = 0; + public static final int ITEM_PADDING = 4; public static final int ITEM_SIZE = 16; @@ -246,10 +248,12 @@ public class NEUOverlay extends Gui { int leftPrev = leftSide-1; if(mouseX > leftPrev && mouseX < leftPrev+buttonXSize) { //"Previous" button setPage(page-1); + Utils.playPressSound(); } int leftNext = rightSide+1-buttonXSize; if(mouseX > leftNext && mouseX < leftNext+buttonXSize) { //"Next" button setPage(page+1); + Utils.playPressSound(); } } @@ -268,9 +272,11 @@ public class NEUOverlay extends Gui { if(Mouse.getEventButton() == 0) { manager.config.compareMode.value = new Double(i); updateSearch(); + Utils.playPressSound(); } else if(Mouse.getEventButton() == 1) { manager.config.compareAscending.value.set(i, !manager.config.compareAscending.value.get(i)); updateSearch(); + Utils.playPressSound(); } } } @@ -280,6 +286,7 @@ public class NEUOverlay extends Gui { if(mouseX >= sortIconX && mouseX <= sortIconX+scaledITEM_SIZE) { manager.config.sortMode.value = new Double(i); updateSearch(); + Utils.playPressSound(); } } } @@ -287,15 +294,17 @@ public class NEUOverlay extends Gui { return true; } - if(Mouse.getEventButton() == 2) { - Slot slot = Utils.getSlotUnderMouse((GuiContainer)Minecraft.getMinecraft().currentScreen); - if(slot != null) { - ItemStack hover = slot.getStack(); - if(hover != null) { - textField.setText("id:"+manager.getInternalNameForItem(hover)); - updateSearch(); - searchMode = true; - return true; + if(Minecraft.getMinecraft().currentScreen instanceof GuiContainer) { + if(Mouse.getEventButton() == 2) { + Slot slot = Utils.getSlotUnderMouse((GuiContainer)Minecraft.getMinecraft().currentScreen); + if(slot != null) { + ItemStack hover = slot.getStack(); + if(hover != null) { + textField.setText("id:"+manager.getInternalNameForItem(hover)); + updateSearch(); + searchMode = true; + return true; + } } } } @@ -334,9 +343,11 @@ public class NEUOverlay extends Gui { String command = quickCommand.split(":")[0].trim(); if(command.startsWith("/")) { NotEnoughUpdates.INSTANCE.sendChatMessage(command); + Utils.playPressSound(); return true; } else { ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, command); + Utils.playPressSound(); return true; } } @@ -375,6 +386,7 @@ public class NEUOverlay extends Gui { if(Mouse.getEventButtonState()) { displayInformationPane(HTMLInfoPane.createFromWikiUrl(this, manager, "Help", "https://moulberry.github.io/files/neu_help.html")); + Utils.playPressSound(); } } else if(mouseX > width/2 - getSearchBarXSize()/2 - paddingUnscaled*6 - iconSize && mouseX < width/2 - getSearchBarXSize()/2 - paddingUnscaled*6) { @@ -384,6 +396,7 @@ public class NEUOverlay extends Gui { } else { displayInformationPane(new SettingsInfoPane(this, manager)); } + Utils.playPressSound(); } } } @@ -405,7 +418,7 @@ public class NEUOverlay extends Gui { */ public int getSearchBarXSize() { if(scaledresolution.getScaleFactor()==4) return (int)(searchBarXSize*0.8); - return searchBarXSize; + return (int)(searchBarXSize); } /** @@ -505,8 +518,9 @@ public class NEUOverlay extends Gui { AtomicReference<String> internalname = new AtomicReference<>(null); AtomicReference<ItemStack> itemstack = new AtomicReference<>(null); - Slot slot = Utils.getSlotUnderMouse((GuiContainer)Minecraft.getMinecraft().currentScreen); - if(slot != null) { + if(Minecraft.getMinecraft().currentScreen instanceof GuiContainer && + Utils.getSlotUnderMouse((GuiContainer)Minecraft.getMinecraft().currentScreen) != null) { + Slot slot = Utils.getSlotUnderMouse((GuiContainer)Minecraft.getMinecraft().currentScreen); ItemStack hover = slot.getStack(); if(hover != null) { internalname.set(manager.getInternalNameForItem(hover)); @@ -842,7 +856,8 @@ public class NEUOverlay extends Gui { public float getWidthMult() { float scaleFMult = 1; - if(scaledresolution.getScaleFactor()==4) scaleFMult = 0.9f; + if(scaledresolution.getScaleFactor()==4) scaleFMult *= 0.9f; + if(manager.auctionManager.customAH.isRenderOverAuctionView()) scaleFMult *= 0.8f; return (float)Math.max(0.5, Math.min(1.5, manager.config.paneWidthMult.value.floatValue()))*scaleFMult; } @@ -1047,32 +1062,34 @@ public class NEUOverlay extends Gui { */ public void renderOverlay(int mouseX, int mouseY) { if(searchMode && textField.getText().length() > 0) { - GuiContainer inv = (GuiContainer) Minecraft.getMinecraft().currentScreen; - int guiLeftI = (int)Utils.getField(GuiContainer.class, inv, "guiLeft", "field_147003_i"); - int guiTopI = (int)Utils.getField(GuiContainer.class, inv, "guiTop", "field_147009_r"); - - GL11.glTranslatef(0, 0, 260); - int overlay = new Color(0, 0, 0, 100).getRGB(); - for(Slot slot : inv.inventorySlots.inventorySlots) { - if(slot.getStack() == null || !manager.doesStackMatchSearch(slot.getStack(), textField.getText())) { - drawRect(guiLeftI+slot.xDisplayPosition, guiTopI+slot.yDisplayPosition, - guiLeftI+slot.xDisplayPosition+16, guiTopI+slot.yDisplayPosition+16, - overlay); + if(Minecraft.getMinecraft().currentScreen instanceof GuiContainer) { + GuiContainer inv = (GuiContainer) Minecraft.getMinecraft().currentScreen; + int guiLeftI = (int)Utils.getField(GuiContainer.class, inv, "guiLeft", "field_147003_i"); + int guiTopI = (int)Utils.getField(GuiContainer.class, inv, "guiTop", "field_147009_r"); + + GL11.glTranslatef(0, 0, 260); + int overlay = new Color(0, 0, 0, 100).getRGB(); + for(Slot slot : inv.inventorySlots.inventorySlots) { + if(slot.getStack() == null || !manager.doesStackMatchSearch(slot.getStack(), textField.getText())) { + drawRect(guiLeftI+slot.xDisplayPosition, guiTopI+slot.yDisplayPosition, + guiLeftI+slot.xDisplayPosition+16, guiTopI+slot.yDisplayPosition+16, + overlay); + } } - } - if(Utils.getSlotUnderMouse(inv) != null) { - ItemStack stack = Utils.getSlotUnderMouse(inv).getStack(); - //Minecraft.getMinecraft().currentScreen.renderToolTip(stack, mouseX, mouseY); - Class<?>[] params = new Class[]{ItemStack.class, int.class, int.class}; - Method renderToolTip = Utils.getMethod(GuiScreen.class, params, "renderToolTip", "func_146285_a"); - if(renderToolTip != null) { - renderToolTip.setAccessible(true); - try { - renderToolTip.invoke(Minecraft.getMinecraft().currentScreen, stack, mouseX, mouseY); - } catch(Exception e) {} + if(Utils.getSlotUnderMouse(inv) != null) { + ItemStack stack = Utils.getSlotUnderMouse(inv).getStack(); + //Minecraft.getMinecraft().currentScreen.renderToolTip(stack, mouseX, mouseY); + Class<?>[] params = new Class[]{ItemStack.class, int.class, int.class}; + Method renderToolTip = Utils.getMethod(GuiScreen.class, params, "renderToolTip", "func_146285_a"); + if(renderToolTip != null) { + renderToolTip.setAccessible(true); + try { + renderToolTip.invoke(Minecraft.getMinecraft().currentScreen, stack, mouseX, mouseY); + } catch(Exception e) {} + } } + GL11.glTranslatef(0, 0, -260); } - GL11.glTranslatef(0, 0, -260); } } @@ -1205,6 +1222,11 @@ public class NEUOverlay extends Gui { redrawItems = true; } + if(oldWidthMult != getWidthMult()) { + oldWidthMult = getWidthMult(); + redrawItems = true; + } + blurBackground(); yaw++; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 2946f930..32cd5980 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -73,6 +73,7 @@ public class NotEnoughUpdates { private static final long CHAT_MSG_COOLDOWN = 200; private long lastChatMessage = 0; + private long secondLastChatMessage = 0; private String currChatMessage = null; private boolean hoverInv = false; @@ -107,10 +108,18 @@ public class NotEnoughUpdates { SimpleCommand neuAhCommand = new SimpleCommand("neuah", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { - openGui = new CustomAHGui(); - manager.auctionManager.customAH.lastOpen = System.currentTimeMillis(); - manager.auctionManager.customAH.clearSearch(); - manager.auctionManager.customAH.updateSearch(); + if(!hasSkyblockScoreboard()) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+ + "You must be on Skyblock to use this feature.")); + } else if(manager.config.apiKey.value == null || manager.config.apiKey.value.isEmpty()) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+ + "Can't open NeuAH, Api Key is not set. Run /api new and put the result in settings.")); + } else { + openGui = new CustomAHGui(); + manager.auctionManager.customAH.lastOpen = System.currentTimeMillis(); + manager.auctionManager.customAH.clearSearch(); + manager.auctionManager.customAH.updateSearch(); + } } }); @@ -189,7 +198,8 @@ public class NotEnoughUpdates { * If the last chat message was sent <200 ago, will cache the message for #onTick to handle. */ public void sendChatMessage(String message) { - if (System.currentTimeMillis() - lastChatMessage > CHAT_MSG_COOLDOWN) { + if(System.currentTimeMillis() - lastChatMessage > CHAT_MSG_COOLDOWN) { + secondLastChatMessage = lastChatMessage; lastChatMessage = System.currentTimeMillis(); Minecraft.getMinecraft().thePlayer.sendChatMessage(message); currChatMessage = null; @@ -239,6 +249,17 @@ public class NotEnoughUpdates { usableContainer = false; break; } + if(!usableContainer) { + if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) { + GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; + ContainerChest container = (ContainerChest) chest.inventorySlots; + String containerName = container.getLowerChestInventory().getDisplayName().getUnformattedText(); + + if(containerName.equals("Accessory Bag")) { + usableContainer = true; + } + } + } if(usableContainer) { for(ItemStack stack : Minecraft.getMinecraft().thePlayer.openContainer.getInventory()) { processUniqueStack(stack, newItem); @@ -271,7 +292,7 @@ public class NotEnoughUpdates { @SubscribeEvent public void onRenderGameOverlay(RenderGameOverlayEvent event) { - if(event.type.equals(RenderGameOverlayEvent.ElementType.BOSSHEALTH) && + if(event.type != null && event.type.equals(RenderGameOverlayEvent.ElementType.BOSSHEALTH) && Minecraft.getMinecraft().currentScreen instanceof GuiContainer && overlay.isUsingMobsFilter()) { event.setCanceled(true); } @@ -301,7 +322,7 @@ public class NotEnoughUpdates { String containerName = container.getLowerChestInventory().getDisplayName().getUnformattedText(); manager.auctionManager.customAH.setRenderOverAuctionView(containerName.trim().equals("Auction View") || - containerName.trim().equals("BIN Auction View")); + containerName.trim().equals("BIN Auction View") || containerName.trim().equals("Confirm Bid")); } //OPEN @@ -468,36 +489,38 @@ public class NotEnoughUpdates { */ @SubscribeEvent public void onGuiBackgroundDraw(GuiScreenEvent.BackgroundDrawnEvent event) { - if(event.gui instanceof GuiContainer && isOnSkyblock()) { + if((event.gui instanceof GuiContainer || event.gui instanceof CustomAHGui) && isOnSkyblock()) { ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft()); int width = scaledresolution.getScaledWidth(); boolean hoverPane = event.getMouseX() < width*overlay.getInfoPaneOffsetFactor() || event.getMouseX() > width*overlay.getItemPaneOffsetFactor(); - try { - int xSize = (int) Utils.getField(GuiContainer.class, event.gui, "xSize", "field_146999_f"); - int ySize = (int) Utils.getField(GuiContainer.class, event.gui, "ySize", "field_147000_g"); - int guiLeft = (int) Utils.getField(GuiContainer.class, event.gui, "guiLeft", "field_147003_i"); - int guiTop = (int) Utils.getField(GuiContainer.class, event.gui, "guiTop", "field_147009_r"); - - hoverInv = event.getMouseX() > guiLeft && event.getMouseX() < guiLeft + xSize && - event.getMouseY() > guiTop && event.getMouseY() < guiTop + ySize; - - if(hoverPane) { - if(!hoverInv) focusInv = false; - } else { - focusInv = true; - } - } catch(NullPointerException npe) { - npe.printStackTrace(); - focusInv = !hoverPane; - } - if(focusInv) { + if(event.gui instanceof GuiContainer) { try { - overlay.render(event.getMouseX(), event.getMouseY(), hoverInv && focusInv); - } catch(ConcurrentModificationException e) {e.printStackTrace();} - GL11.glTranslatef(0, 0, 10); + int xSize = (int) Utils.getField(GuiContainer.class, event.gui, "xSize", "field_146999_f"); + int ySize = (int) Utils.getField(GuiContainer.class, event.gui, "ySize", "field_147000_g"); + int guiLeft = (int) Utils.getField(GuiContainer.class, event.gui, "guiLeft", "field_147003_i"); + int guiTop = (int) Utils.getField(GuiContainer.class, event.gui, "guiTop", "field_147009_r"); + + hoverInv = event.getMouseX() > guiLeft && event.getMouseX() < guiLeft + xSize && + event.getMouseY() > guiTop && event.getMouseY() < guiTop + ySize; + + if(hoverPane) { + if(!hoverInv) focusInv = false; + } else { + focusInv = true; + } + } catch(NullPointerException npe) { + npe.printStackTrace(); + focusInv = !hoverPane; + } + if(focusInv) { + try { + overlay.render(event.getMouseX(), event.getMouseY(), hoverInv && focusInv); + } catch(ConcurrentModificationException e) {e.printStackTrace();} + GL11.glTranslatef(0, 0, 10); + } } } } @@ -506,7 +529,22 @@ public class NotEnoughUpdates { public void onGuiScreenDrawPre(GuiScreenEvent.DrawScreenEvent.Pre event) { if(event.gui instanceof CustomAHGui || manager.auctionManager.customAH.isRenderOverAuctionView()) { event.setCanceled(true); - manager.auctionManager.customAH.drawScreen(event.mouseX, event.mouseY); + + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + int width = scaledResolution.getScaledWidth(); + int height = scaledResolution.getScaledHeight(); + + //Dark background + Utils.drawGradientRect(0, 0, width, height, -1072689136, -804253680); + + if(event.mouseX < width*overlay.getWidthMult()/3 || event.mouseX > width-width*overlay.getWidthMult()/3) { + manager.auctionManager.customAH.drawScreen(event.mouseX, event.mouseY); + overlay.render(event.mouseX, event.mouseY, false); + } else { + overlay.render(event.mouseX, event.mouseY, false); + manager.auctionManager.customAH.drawScreen(event.mouseX, event.mouseY); + } + } } @@ -517,13 +555,15 @@ public class NotEnoughUpdates { */ @Subscrib |
