From ff2829153c14e0f7ca655bfd4ef64bffae3212b2 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Mon, 19 Jul 2021 16:19:14 +0800 Subject: PRE29 --- .../notenoughupdates/NEUEventListener.java | 13 +- .../moulberry/notenoughupdates/NEUOverlay.java | 15 +- .../notenoughupdates/NotEnoughUpdates.java | 28 +- .../notenoughupdates/core/BackgroundBlur.java | 4 +- .../notenoughupdates/core/GuiElementTextField.java | 2 +- .../core/config/GuiPositionEditor.java | 115 +++ .../notenoughupdates/core/config/PositionNew.java | 160 +++++ .../notenoughupdates/cosmetics/CapeManager.java | 34 +- .../miscfeatures/BetterContainers.java | 2 +- .../miscfeatures/FishingHelper.java | 15 +- .../miscfeatures/ItemCooldowns.java | 18 +- .../miscfeatures/PetInfoOverlay.java | 13 +- .../notenoughupdates/miscfeatures/SlotLocking.java | 2 + .../miscfeatures/StorageManager.java | 43 +- .../notenoughupdates/miscgui/GuiCustomEnchant.java | 5 +- .../miscgui/InventoryStorageSelector.java | 125 +++- .../notenoughupdates/miscgui/StorageOverlay.java | 774 +++++++++++++++++++-- .../notenoughupdates/options/NEUConfig.java | 66 +- .../notenoughupdates/overlays/MiningOverlay.java | 2 +- .../moulberry/notenoughupdates/util/Utils.java | 2 +- .../notenoughupdates/util/XPInformation.java | 73 +- .../notenoughupdates/storage_gui/storage_gui_0.png | Bin 11050 -> 12354 bytes .../notenoughupdates/storage_gui/storage_gui_1.png | Bin 12260 -> 12408 bytes .../notenoughupdates/storage_gui/storage_gui_2.png | Bin 10640 -> 10543 bytes .../notenoughupdates/storage_gui/storage_gui_3.png | Bin 10729 -> 10623 bytes .../storage_gui/storage_gui_pane_ctm.png | Bin 0 -> 1523 bytes .../notenoughupdates/storage_gui/storage_icons.png | Bin 6708 -> 11843 bytes .../storage_gui/we_do_a_little_rolling/0.jpg | Bin 0 -> 3696 bytes .../storage_gui/we_do_a_little_rolling/1.jpg | Bin 0 -> 3642 bytes .../storage_gui/we_do_a_little_rolling/10.jpg | Bin 0 -> 3687 bytes .../storage_gui/we_do_a_little_rolling/11.jpg | Bin 0 -> 3827 bytes .../storage_gui/we_do_a_little_rolling/12.jpg | Bin 0 -> 3762 bytes .../storage_gui/we_do_a_little_rolling/13.jpg | Bin 0 -> 3701 bytes .../storage_gui/we_do_a_little_rolling/14.jpg | Bin 0 -> 3604 bytes .../storage_gui/we_do_a_little_rolling/15.jpg | Bin 0 -> 3574 bytes .../storage_gui/we_do_a_little_rolling/16.jpg | Bin 0 -> 3717 bytes .../storage_gui/we_do_a_little_rolling/17.jpg | Bin 0 -> 3798 bytes .../storage_gui/we_do_a_little_rolling/18.jpg | Bin 0 -> 4003 bytes .../storage_gui/we_do_a_little_rolling/2.jpg | Bin 0 -> 3719 bytes .../storage_gui/we_do_a_little_rolling/3.jpg | Bin 0 -> 3730 bytes .../storage_gui/we_do_a_little_rolling/4.jpg | Bin 0 -> 3762 bytes .../storage_gui/we_do_a_little_rolling/5.jpg | Bin 0 -> 3706 bytes .../storage_gui/we_do_a_little_rolling/6.jpg | Bin 0 -> 3560 bytes .../storage_gui/we_do_a_little_rolling/7.jpg | Bin 0 -> 3547 bytes .../storage_gui/we_do_a_little_rolling/8.jpg | Bin 0 -> 3579 bytes .../storage_gui/we_do_a_little_rolling/9.jpg | Bin 0 -> 3609 bytes src/main/resources/mixins.notenoughupdates.json | 1 - 47 files changed, 1369 insertions(+), 143 deletions(-) create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/core/config/GuiPositionEditor.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/core/config/PositionNew.java create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_pane_ctm.png create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/0.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/1.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/10.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/11.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/12.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/13.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/14.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/15.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/16.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/17.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/18.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/2.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/3.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/4.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/5.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/6.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/7.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/8.jpg create mode 100644 src/main/resources/assets/notenoughupdates/storage_gui/we_do_a_little_rolling/9.jpg (limited to 'src') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 0c35c56c..7fa81a59 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -320,7 +320,7 @@ public class NEUEventListener { if(neu.config.notifications.doRamNotif) { long maxMemoryMB = Runtime.getRuntime().maxMemory()/1024L/1024L; - if(maxMemoryMB > 4100 || true) { + if(maxMemoryMB > 4100) { notificationDisplayMillis = System.currentTimeMillis(); notificationLines = new ArrayList<>(); notificationLines.add(EnumChatFormatting.GRAY+"Too much memory allocated!"); @@ -447,21 +447,28 @@ public class NEUEventListener { Minecraft.getMinecraft().currentScreen instanceof GuiContainer && neu.overlay.isUsingMobsFilter()) { event.setCanceled(true); } + if(event.type != null && event.type.equals(RenderGameOverlayEvent.ElementType.PLAYER_LIST)) { + GlStateManager.enableDepth(); + } } @SubscribeEvent public void onRenderGameOverlayPost(RenderGameOverlayEvent.Post event) { - if(neu.hasSkyblockScoreboard() && event.type == RenderGameOverlayEvent.ElementType.ALL) { + if(neu.hasSkyblockScoreboard() && event.type.equals(RenderGameOverlayEvent.ElementType.ALL)) { DungeonWin.render(event.partialTicks); + GlStateManager.pushMatrix(); + GlStateManager.translate(0, 0, -200); for(TextOverlay overlay : OverlayManager.textOverlays) { if(OverlayManager.dontRenderOverlay != null && OverlayManager.dontRenderOverlay.isAssignableFrom(overlay.getClass())) { continue; } + GlStateManager.translate(0, 0, -1); + GlStateManager.enableDepth(); overlay.render(); } + GlStateManager.popMatrix(); OverlayManager.dontRenderOverlay = null; } - if(Keyboard.isKeyDown(Keyboard.KEY_X)) { notificationDisplayMillis = 0; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index ddef0828..d55bad48 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -1109,18 +1109,15 @@ public class NEUOverlay extends Gui { if(rarity1 < rarity2) return mult; if(rarity1 > rarity2) return -mult; } else if(getCompareMode() == COMPARE_MODE_VALUE) { - float cost1 = manager.auctionManager.getLowestBin(o1.get("internalname").getAsString()); - float cost2 = manager.auctionManager.getLowestBin(o2.get("internalname").getAsString()); + String internal1 = o1.get("internalname").getAsString(); + String internal2 = o2.get("internalname").getAsString(); - float craftCost1 = manager.auctionManager.getCraftCost(o1.get("internalname").getAsString()).craftCost; - float craftCost2 = manager.auctionManager.getCraftCost(o2.get("internalname").getAsString()).craftCost; + float cost1 = manager.auctionManager.getLowestBin(internal1); + float cost2 = manager.auctionManager.getLowestBin(internal2); - float diff = (cost1 - craftCost1) - (cost2 - craftCost2); - if(diff > 0) return mult; - if(diff < 0) return -mult; - /*if(cost1 < cost2) return mult; - if(cost1 > cost2) return -mult;*/ + if(cost1 < cost2) return mult; + if(cost1 > cost2) return -mult; } String i1 = o1.get("internalname").getAsString(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 78bb6536..86a36f49 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -6,11 +6,16 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.mojang.authlib.Agent; +import com.mojang.authlib.minecraft.MinecraftSessionService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; +import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; import io.github.moulberry.notenoughupdates.auction.CustomAHGui; import io.github.moulberry.notenoughupdates.collectionlog.GuiCollectionLog; import io.github.moulberry.notenoughupdates.commands.SimpleCommand; import io.github.moulberry.notenoughupdates.core.BackgroundBlur; import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper; +import io.github.moulberry.notenoughupdates.core.config.GuiPositionEditor; import io.github.moulberry.notenoughupdates.core.util.MiscUtils; import io.github.moulberry.notenoughupdates.cosmetics.CapeManager; import io.github.moulberry.notenoughupdates.cosmetics.GuiCosmetics; @@ -62,6 +67,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.text.WordUtils; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.impl.client.HttpClients; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.GL11; @@ -69,6 +76,7 @@ import java.awt.*; import java.awt.datatransfer.StringSelection; import java.io.*; import java.lang.management.ManagementFactory; +import java.net.Proxy; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.List; @@ -711,9 +719,10 @@ public class NotEnoughUpdates { private ScheduledExecutorService devES = Executors.newSingleThreadScheduledExecutor(); private static final String[] devFailStrings = {"No.", "I said no.", "You aren't allowed to use this.", - "Are you sure you want to use this? Type 'Yes' in chat.", "Lmao you thought", "Ok please stop", - "What do you want from me?", "This command almost certainly does nothing useful for you", - "Ok, this is the last message, after this it will repeat", "No.", "Dammit. I thought that would work. Uhh...", + "Are you sure you want to use this? Type 'Yes' in chat.", "Are you sure you want to use this? Type 'Yes' in chat.", + "Lmao you thought", "Ok please stop", "What do you want from me?", + "This command almost certainly does nothing useful for you", + "Ok, this is the last message, after this it will repeat", "No.", "I said no.", "Dammit. I thought that would work. Uhh...", "\u00a7dFrom \u00a7c[ADMIN] Minikloon\u00a77: If you use that command again, I'll have to ban you", "", "Ok, this is actually the last message, use the command again and you'll crash I promise"}; private int devFailIndex = 0; @@ -726,7 +735,7 @@ public class NotEnoughUpdates { throw new Error("L") { @Override public void printStackTrace() { - throw new Error("Double L"); + throw new Error("L"); } }; } @@ -750,9 +759,15 @@ public class NotEnoughUpdates { DupePOC.doDupe(args[0]); return; }*/ + if(args.length == 1 && args[0].equalsIgnoreCase("positiontest")) { + openGui = new GuiPositionEditor(); + return; + } + if(args.length == 2 && args[0].equalsIgnoreCase("pt")) { EnumParticleTypes t = EnumParticleTypes.valueOf(args[1]); FishingHelper.type = t; + return; } if(args.length == 1 && args[0].equalsIgnoreCase("dev")) { NotEnoughUpdates.INSTANCE.config.hidden.dev = true; @@ -1106,13 +1121,8 @@ public class NotEnoughUpdates { */ @EventHandler public void preinit(FMLPreInitializationEvent event) { - //if(!Minecraft.getMinecraft().getSession().getUsername().equalsIgnoreCase("moulberry")) throw new RuntimeException("moulbeBad"); - INSTANCE = this; - String uuid = Minecraft.getMinecraft().getSession().getPlayerID(); - if(uuid.equalsIgnoreCase("ea9b1c5a-bf68-4fa2-9492-2d4e69693228")) throw new RuntimeException("Ding-dong, racism is wrong."); - neuDir = new File(event.getModConfigurationDirectory(), "notenoughupdates"); neuDir.mkdirs(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java b/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java index a4001675..8a8655f9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java @@ -121,6 +121,7 @@ public class BackgroundBlur { if(event.type == RenderGameOverlayEvent.ElementType.ALL) { processBlurs(); } + Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false); } @SubscribeEvent @@ -215,9 +216,8 @@ public class BackgroundBlur { output.blurShaderVert.loadShader(0); GlStateManager.enableDepth(); GL11.glPopMatrix(); - - Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false); } + Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false); } public static void renderBlurredBackground(float blurStrength, int screenWidth, int screenHeight, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java index 658ab2f2..d221b37e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java @@ -495,7 +495,7 @@ public class GuiElementTextField { if(focus && System.currentTimeMillis()%1000>500) { String textNCBeforeCursor = textNoColor.substring(0, textField.getCursorPosition()+prependText.length()); int colorCodes = org.apache.commons.lang3.StringUtils.countMatches(textNCBeforeCursor, "\u00B6"); - String textBeforeCursor = text.substring(0, textField.getCursorPosition()+prependText.length()+(((options & COLOUR) != 0) ? colorCodes*2 : 0)); + String textBeforeCursor = text.substring(0, Math.min(text.length(), textField.getCursorPosition()+prependText.length()+(((options & COLOUR) != 0) ? colorCodes*2 : 0))); int numLinesBeforeCursor = org.apache.commons.lang3.StringUtils.countMatches(textBeforeCursor, "\n"); int yOff = numLinesBeforeCursor*extraSize; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/GuiPositionEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/GuiPositionEditor.java new file mode 100644 index 00000000..a48f3f1a --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/GuiPositionEditor.java @@ -0,0 +1,115 @@ +package io.github.moulberry.notenoughupdates.core.config; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; + +import java.io.IOException; + +public class GuiPositionEditor extends GuiScreen { + + public PositionNew position = new PositionNew(); + + public int clickedX; + public int clickedY; + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + super.drawDefaultBackground(); + + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + int width = scaledResolution.getScaledWidth(); + int height = scaledResolution.getScaledHeight(); + + int x = position.resolveX(scaledResolution, 200); + int y = position.resolveY(scaledResolution, 100); + + int centerWidth = 176; + int centerHeight = 166; + + float centerWF = centerWidth/2f / (float)width; + float centerHF = centerHeight/2f / (float)height; + + float left = 0; + float top = 0; + float right = 0; + float bottom = 0; + + switch(position.getAnchorX()) { + case MIN: { + left = 0; + right = 0.5f - centerWF; + break; + } + case MID: { + left = 0.5f - centerWF; + right = 0.5f + centerWF; + break; + } + case MAX: { + left = 0.5f + centerWF; + right = 1; + break; + } + } + switch(position.getAnchorY()) { + case MIN: { + top = 0; + bottom = 0.5f - centerHF; + break; + } + case MID: { + top = 0.5f - centerHF; + bottom = 0.5f + centerHF; + break; + } + case MAX: { + top = 0.5f + centerHF; + bottom = 1; + break; + } + } + + Gui.drawRect((int)(left*width), (int)(top*height), (int)(right*width), (int)(bottom*height), 0x40404040); + Gui.drawRect(x, y, x+200, y+100, 0x80404040); + } + + @Override + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + int x = position.resolveX(scaledResolution, 200); + int y = position.resolveY(scaledResolution, 100); + + if(mouseX > x && mouseX < x+200 && + mouseY > y && mouseY < y+100) { + clickedX = mouseX; + clickedY = mouseY; + } else { + clickedX = -1; + clickedY = -1; + } + } + + @Override + protected void mouseReleased(int mouseX, int mouseY, int state) { + clickedX = -1; + clickedY = -1; + } + + @Override + protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { + if(clickedX >= 0 && clickedY >= 0) { + int deltaX = mouseX - clickedX; + int deltaY = mouseY - clickedY; + + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + + deltaX = position.moveX(scaledResolution, deltaX, 200); + deltaY = position.moveY(scaledResolution, deltaY, 100); + + clickedX += deltaX; + clickedY += deltaY; + } + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/PositionNew.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/PositionNew.java new file mode 100644 index 00000000..842df73d --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/PositionNew.java @@ -0,0 +1,160 @@ +package io.github.moulberry.notenoughupdates.core.config; + +import com.google.gson.annotations.Expose; +import net.minecraft.client.gui.ScaledResolution; + +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; + +public class PositionNew { + + public enum Anchor { + MIN(0, 0, 0), + MID(0.5f, -0.5f, 0), + MAX(1f, -1f, 0), + GUI_MIN(0.5f, -1f, -0.5f), + GUI_MAX(0.5f, 0, 0.5f); + + float screenMult; + float elementMult; + float guiMult; + + Anchor(float screenMult, float elementMult, float guiMult) { + this.screenMult = screenMult; + this.elementMult = elementMult; + this.guiMult = guiMult; + } + } + + @Expose + private int x = 0; + @Expose + private int y = 0; + @Expose + private float scaleX = 1; + @Expose + private float scaleY = 1; + + @Expose + private Anchor anchorX = Anchor.MIN; + @Expose + private Anchor anchorY = Anchor.MIN; + + @Expose + private boolean pinned = false; + @Expose + private boolean allowPinToggle = true; + @Expose + private boolean allowResize = true; + + public PositionNew(int x, int y, int scaleX, int scaleY, Anchor anchorX, Anchor anchorY, boolean pinned, boolean allowPinToggle, boolean allowResize) { + this.x = x; + this.y = y; + this.scaleX = scaleX; + this.scaleY = scaleY; + this.anchorX = anchorX; + this.anchorY = anchorY; + this.pinned = pinned; + this.allowPinToggle = allowPinToggle; + this.allowResize = allowResize; + } + + protected PositionNew() { + } + + public int moveX(ScaledResolution scaledResolution, int deltaX, int sizeX) { + int originalX = resolveX(scaledResolution, sizeX); + AtomicInteger atomicInteger = new AtomicInteger(x+deltaX); + AtomicReference atomicReference = new AtomicReference<>(anchorX); + move(atomicInteger, atomicReference, anchorY, (int)Math.ceil(sizeX*scaleX), scaledResolution.getScaledWidth(), 176); + x = atomicInteger.get(); + anchorX = atomicReference.get(); + return resolveX(scaledResolution, sizeX) - originalX; + } + + public int moveY(ScaledResolution scaledResolution, int deltaY, int sizeY) { + int originalY = resolveY(scaledResolution, sizeY); + AtomicInteger atomicInteger = new AtomicInteger(y+deltaY); + AtomicReference atomicReference = new AtomicReference<>(anchorY); + move(atomicInteger, atomicReference, anchorY, (int)Math.ceil(sizeY*scaleY), scaledResolution.getScaledHeight(), 166); + y = atomicInteger.get(); + anchorY = atomicReference.get(); + return resolveY(scaledResolution, sizeY) - originalY; + } + + private void move(AtomicInteger coord, AtomicReference anchor, Anchor oppositeAnchor, int elementSize, int screenSize, int guiSize) { + int centerCoord = resolve(coord.get(), anchor.get(), elementSize, screenSize, guiSize) + elementSize/2; + + if(centerCoord < screenSize/2-guiSize/2) { + if(pinned && centerCoord > screenSize/4-guiSize/4 && oppositeAnchor == Anchor.MID) { + anchor.set(Anchor.GUI_MIN); + } else { + anchor.set(Anchor.MIN); + } + } else if(centerCoord > screenSize/2+guiSize/2) { + if(pinned && centerCoord < screenSize-(screenSize/4-guiSize/4) && oppositeAnchor == Anchor.MID) { + anchor.set(Anchor.GUI_MAX); + } else { + anchor.set(Anchor.MAX); + } + } else { + anchor.set(Anchor.MID); + } + + if(centerCoord - elementSize/2 < 0) centerCoord = elementSize/2; + if(centerCoord + elementSize/2 > screenSize) centerCoord = screenSize - elementSize/2; + + Anchor newAnchor = anchor.get(); + coord.set(Math.round(centerCoord - (elementSize*(newAnchor.elementMult+0.5f)) - screenSize*newAnchor.screenMult - guiSize*newAnchor.guiMult)); + } + + public int resolveX(ScaledResolution scaledResolution, int sizeX) { + return resolve(x, anchorX, (int)Math.ceil(sizeX*scaleX), scaledResolution.getScaledWidth(), 176); + } + + public int resolveY(ScaledResolution scaledResolution, int sizeY) { + return resolve(y, anchorY, (int)Math.ceil(sizeY*scaleY), scaledResolution.getScaledHeight(), 166); + } + + private int resolve(int coord, Anchor anchor, int elementSize, int screenSize, int guiSize) { + return Math.round(screenSize*anchor.screenMult + elementSize*anchor.elementMult + guiSize*anchor.guiMult + coord); + } + + public void setScaleX(float scaleX) { + if(allowResize) { + this.scaleX = scaleX; + } + } + + public void setScaleY(float scaleY) { + if(allowResize) { + this.scaleY = scaleY; + } + } + + public float getScaleX() { + return scaleX; + } + + public float getScaleY() { + return scaleY; + } + + public void setPinned(boolean pinned) { + if(allowPinToggle) { + this.pinned = pinned; + } + } + + public boolean isPinned() { + return pinned; + } + + public Anchor getAnchorX() { + return anchorX; + } + + public Anchor getAnchorY() { + return anchorY; + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java index aeedd5d1..560cdf51 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -211,24 +211,26 @@ public class CapeManager { public void onRenderPlayer(RenderPlayerEvent.Post e) { if(e.partialRenderTick == 1.0F) return; //rendering in inventory - String uuid = e.entityPlayer.getUniqueID().toString().replace("-", ""); - String clientUuid = Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", ""); - - if(Minecraft.getMinecraft().thePlayer != null && uuid.equals(clientUuid)) { - String selCape = NotEnoughUpdates.INSTANCE.config.hidden.selectedCape; - if(selCape != null && !selCape.isEmpty()) { - if(localCape == null) { - localCape = new MutablePair<>(new NEUCape(selCape), selCape); - } else { - localCape.setValue(selCape); + try { + String uuid = e.entityPlayer.getUniqueID().toString().replace("-", ""); + String clientUuid = Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", ""); + + if(Minecraft.getMinecraft().thePlayer != null && uuid.equals(clientUuid)) { + String selCape = NotEnoughUpdates.INSTANCE.config.hidden.selectedCape; + if(selCape != null && !selCape.isEmpty()) { + if(localCape == null) { + localCape = new MutablePair<>(new NEUCape(selCape), selCape); + } else { + localCape.setValue(selCape); + } } } - } - if(uuid.equals(clientUuid) && localCape != null && localCape.getRight() != null && !localCape.getRight().equals("null")) { - localCape.getLeft().onRenderPlayer(e); - } else if(capeMap.containsKey(uuid)) { - capeMap.get(uuid).getLeft().onRenderPlayer(e); - } + if(uuid.equals(clientUuid) && localCape != null && localCape.getRight() != null && !localCape.getRight().equals("null")) { + localCape.getLeft().onRenderPlayer(e); + } else if(capeMap.containsKey(uuid)) { + capeMap.get(uuid).getLeft().onRenderPlayer(e); + } + } catch(Exception ignored) {} } public static void onTickSlow() { 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 5af6e8bb..48601df3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java @@ -348,7 +348,7 @@ public class BetterContainers { return false; } - private static int getCTMIndex(boolean up, boolean right, boolean down, boolean left, boolean upleft, boolean upright, boolean downright, boolean downleft) { + public static int getCTMIndex(boolean up, boolean right, boolean down, boolean left, boolean upleft, boolean upright, boolean downright, boolean downleft) { if(up && right && down && left) { if(upleft && upright && downright && downleft) { return 26; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java index 71fec1c7..32c64f4c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java @@ -68,6 +68,10 @@ public class FishingHelper { private static final ResourceLocation FISHING_WARNING_EXCLAM = new ResourceLocation("notenoughupdates:fishing_warning_exclam.png"); public void onRenderBobber(EntityFishHook hook) { if(Minecraft.getMinecraft().thePlayer.fishEntity == hook && warningState != PlayerWarningState.NOTHING) { + + if(!NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarning && warningState == PlayerWarningState.FISH_INCOMING) return; + if(!NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarningR && warningState == PlayerWarningState.FISH_HOOKED) return; + GlStateManager.disableCull(); GlStateManager.disableLighting(); GL11.glDepthFunc(GL11.GL_ALWAYS); @@ -134,7 +138,7 @@ public class FishingHelper { if(Minecraft.getMinecraft().thePlayer != null && event.phase == TickEvent.Phase.END) { if(buildupSoundDelay > 0) buildupSoundDelay--; - if(NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarning) { + if(NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarning || NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarningR) { if(Minecraft.getMinecraft().thePlayer.fishEntity != null) { if(!pingDelayList.isEmpty()) { while(pingDelayList.size() > 5) pingDelayList.remove(pingDelayList.size()-1); @@ -270,7 +274,8 @@ public class FishingHelper { public boolean onSpawnParticle(EnumParticleTypes particleType, double x, double y, double z, double xOffset, double yOffset, double zOffset) { if(!NotEnoughUpdates.INSTANCE.config.fishing.hideOtherPlayerAll && !NotEnoughUpdates.INSTANCE.config.fishing.enableCustomParticles && - !NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarning) { + !NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarning && + !NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarningR) { return false; } if(hookEntities.isEmpty()) { @@ -340,12 +345,12 @@ public class FishingHelper { double delta = oldDistance - newDistance; if(newDistance < 0.2 || (delta > -0.1 && delta < 0.3)) { - if(NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarning && + if((NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarning || NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarningR) && Minecraft.getMinecraft().thePlayer.fishEntity != null && Minecraft.getMinecraft().thePlayer.fishEntity.getEntityId() == hookEntityId && chain.particleNum > 3) { - if(newDistance <= 0.2f + 0.1f*pingDelayTicks) { + if(newDistance <= 0.2f + 0.1f*pingDelayTicks && NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarningR) { if(NotEnoughUpdates.INSTANCE.config.fishing.incomingFishHookedSounds && hookedWarningStateTicks <= 0) { float vol = NotEnoughUpdates.INSTANCE.config.fishing.incomingFishHookedSoundsVol/100f; @@ -369,7 +374,7 @@ public class FishingHelper { } hookedWarningStateTicks = 12; - } else if(newDistance >= 0.4f + 0.1f*pingDelayTicks) { + } else if(newDistance >= 0.4f + 0.1f*pingDelayTicks && NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarning) { if(NotEnoughUpdates.INSTANCE.config.fishing.incomingFishIncSounds && buildupSoundDelay <= 0) { float vol = NotEnoughUpdates.INSTANCE.config.fishing.incomingFishIncSoundsVol/100f; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java index 546f9d89..59b3d802 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java @@ -109,12 +109,26 @@ public class ItemCooldowns { private static Pattern PICKAXE_COOLDOWN_LORE_REGEX = Pattern.compile("\\u00a78Cooldown: \\u00a7a(\\d+)s"); + private static boolean isPickaxe(String internalname) { + if(internalname == null) return false; + + if(internalname.endsWith("_PICKAXE")) { + return true; + } else if(internalname.contains("_DRILL_")) { + char lastChar = internalname.charAt(internalname.length()-1); + if(lastChar >= '0' && lastChar <= '9') { + return true; + } + } + return false; + } + private static void updatePickaxeCooldown() { if(pickaxeCooldown == -1) { for(ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) { if(stack != null && stack.hasTagCompound()) { String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack); - if(internalname != null && (internalname.endsWith("_PICKAXE") || internalname.contains("_DRILL_"))) { + if(isPickaxe(internalname)) { for(String line : NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound())) { Matcher matcher = PICKAXE_COOLDOWN_LORE_REGEX.matcher(line); if(matcher.find()) { @@ -154,7 +168,7 @@ public class ItemCooldowns { return -1; } - if(internalname.endsWith("_PICKAXE") || internalname.contains("_DRILL_")) { + if(isPickaxe(internalname)) { updatePickaxeCooldown(); if(pickaxeUseCooldownMillisRemaining < 0) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java index e7f5c8e6..62a3a5d1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -115,6 +115,7 @@ public class PetInfoOverlay extends TextOverlay { private static LinkedList xpGainQueue = new LinkedList<>(); private static float xpGainHourLast = -1; private static float xpGainHour = -1; + private static int pauseCountdown = 0; private static float xpGainHourSecondPet = -1; @@ -369,7 +370,15 @@ public class PetInfoOverlay extends TextOverlay { if(xpGain < 0) xpGain = 0; String xpGainString = EnumChatFormatting.AQUA + "XP/h: " + EnumChatFormatting.YELLOW + roundFloat(xpGain); - if(xpGain > 0 && xpGainHour == xpGainHourLast) xpGainString += EnumChatFormatting.RED + " (PAUSED)"; + if(!secondPet && xpGain > 0 && levelXp != levelXpLast) { + if(pauseCountdown <= 0) { + xpGainString += EnumChatFormatting.RED + " (PAUSED)"; + } else { + pauseCountdown--; + } + } else { + pauseCountdown = 60; + } String totalXpString = EnumChatFormatting.AQUA + "Total XP: " + EnumChatFormatting.YELLOW + roundFloat(currentPet.petLevel.totalXp); @@ -609,7 +618,7 @@ public class PetInfoOverlay extends TextOverlay { if(petItem) { ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(entry.getValue()); - itemMap.put(stack.getDisplayName(), entry.getKey()); + itemMap.put(stack.getDisplayName().replace("\u00a7f\u00a7f", ""), entry.getKey()); } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java index 3c53c735..1925811d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java @@ -512,7 +512,9 @@ public class SlotLocking { y2 -= vec.y; } + GlStateManager.translate(0, 0, 200); drawLinkArrow((int)x1, (int)y1, (int)x2, (int)y2); + GlStateManager.translate(0, 0, -200); } } else if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotBinding && slot.getSlotIndex() < 8 && pairingSlot != null && lockKeyHeld) { if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java index 53607fae..37a60b1b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java @@ -150,6 +150,7 @@ public class StorageManager { public ItemStack backpackDisplayStack; public String customTitle; public int rows = -1; + public boolean[] shouldDarkenIfNotSelected = new boolean[45]; public transient boolean matchesSearch; public transient int searchedId; @@ -185,7 +186,7 @@ public class StorageManager { private boolean shouldRenderStorageOverlayCached = false; - private static final Pattern WINDOW_REGEX = Pattern.compile(".+ Backpack \\((\\d+)/(\\d+)\\)"); + private static final Pattern WINDOW_REGEX = Pattern.compile(".+ Backpack (?:\u2726 )?\\((\\d+)/(\\d+)\\)"); private static final Pattern ECHEST_WINDOW_REGEX = Pattern.compile("Ender Chest \\((\\d+)/(\\d+)\\)"); public void loadConfig(File file) { @@ -313,7 +314,7 @@ public class StorageManager { public void sendToPage(int page) { if(desiredStoragePage != getCurrentPageId() && - System.currentTimeMillis() - storageOpenSwitchMillis < 1000) return; + System.currentTimeMillis() - storageOpenSwitchMillis < 100) return; if(getCurrentPageId() == page) return; if(page == 0) { @@ -325,6 +326,44 @@ public class StorageManager { sendMouseClick(getCurrentWindowId(), 27+page-MAX_ENDER_CHEST_PAGES); } } else { + boolean onEnderchest = page < MAX_ENDER_CHEST_PAGES && currentStoragePage < MAX_ENDER_CHEST_PAGES; + boolean onStorage = page >= MAX_ENDER_CHEST_PAGES && currentStoragePage >= MAX_ENDER_CHEST_PAGES; + if(currentStoragePage >= 0 && (onEnderchest || (onStorage))) { + int currentPageDisplay = getDisplayIdForStorageId(currentStoragePage); + int desiredPageDisplay = getDisplayIdForStorageId(page); + + if(onEnderchest && desiredPageDisplay > currentPageDisplay) { + boolean isLastPage = true; + for(int pageN=page+1; pageN= 0) { + isLastPage = false; + break; + } + } + if(isLastPage) { + sendMouseClick(getCurrentWindowId(), 8); + return; + } + } + + if(onStorage && page == MAX_ENDER_CHEST_PAGES) { + sendMouseClick(getCurrentWindowId(), 5); + return; + } else if(onStorage && desiredPageDisplay == storageConfig.displayToStorageIdMap.size()-1) { + sendMouseClick(getCurrentWindowId(), 8); + return; + } else { + int delta = desiredPageDisplay - currentPageDisplay; + if(delta == -1) { + sendMouseClick(getCurrentWindowId(), 6); + return; + } else if(delta == 1) { + sendMouseClick(getCurrentWindowId(), 7); + return; + } + } + } + storageOpenSwitchMillis = System.currentTimeMillis(); desiredStoragePage = page; 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 f3cb2ed9..d32d74af 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java @@ -199,9 +199,12 @@ public class GuiCustomEnchant extends Gui { } public boolean shouldOverride(String containerName) { + shouldOverrideFast = false; + if(true) return shouldOverrideFast; + shouldOverrideFast = containerName != null && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && - containerName.equalsIgnoreCase("Enchant Item") && !Keyboard.isKeyDown(Keyboard.KEY_K); + containerName.equalsIgnoreCase("Enchant Item"); if(!shouldOverrideFast) { currentState = EnchantState.NO_ITEM; applicable.clear(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java index 32a7c76a..4119c87b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java @@ -6,8 +6,10 @@ import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; 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.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.settings.KeyBinding; import net.minecraft.init.Blocks; import net.minecraft.item.Item; @@ -25,6 +27,7 @@ public class InventoryStorageSelector { private static final InventoryStorageSelector INSTANCE = new InventoryStorageSelector(); private static final ResourceLocation ICONS = new ResourceLocation("notenoughupdates:storage_gui/hotbar_icons.png"); + private static final ResourceLocation STORAGE_PANE_CTM_TEXTURE = new ResourceLocation("notenoughupdates:storage_gui/storage_gui_pane_ctm.png"); public boolean isOverridingSlot = false; public int selectedIndex = 0; @@ -178,7 +181,8 @@ public class InventoryStorageSelector { return 0; } - if(resultantSlot == 0 && direction == -1 && !isOverridingSlot) { + if(NotEnoughUpdates.INSTANCE.config.storageGUI.scrollToBackpack && + resultantSlot == 0 && direction == -1 && !isOverridingSlot) { isOverridingSlot = true; Minecraft.getMinecraft().getItemRenderer().resetEquippedProgress(); return 0; @@ -186,7 +190,8 @@ public class InventoryStorageSelector { isOverridingSlot = false; Minecraft.getMinecraft().getItemRenderer().resetEquippedProgress(); return 0; - } else if(resultantSlot == 8 && direction == 1 && !isOverridingSlot) { + } else if(NotEnoughUpdates.INSTANCE.config.storageGUI.scrollToBackpack && + resultantSlot == 8 && direction == 1 && !isOverridingSlot) { isOverridingSlot = true; Minecraft.getMinecraft().getItemRenderer().resetEquippedProgress(); return 0; @@ -262,7 +267,7 @@ public class InventoryStorageSelector { ResourceLocation storagePreviewTexture = StorageOverlay.STORAGE_PREVIEW_TEXTURES[NotEnoughUpdates.INSTANCE.config.storageGUI.displayStyle]; int startX = centerX - 172/2; - int startY = height - 70 - (10+18*rows); + int startY = height - 80 - (10+18*rows); GlStateManager.translate(0, 0, 100); GL11.glDepthMask(false); @@ -278,19 +283,127 @@ public class InventoryStorageSelector { GL11.glDepthMask(true); + int[] isPaneCache = new int[rows*9]; + int[] ctmIndexCache = new int[rows*9]; + for(int i=0; i 0) { + GlStateManager.disableAlpha(); + Gui.drawRect(itemX-1, itemY-1, itemX+17, itemY+17, 0x01000000); + GlStateManager.enableAlpha(); + + int ctmIndex = StorageOverlay.getCTMIndex(page, i, isPaneCache, ctmIndexCache); + int startCTMX = (ctmIndex%12)*19; + int startCTMY = (ctmIndex/12)*19; + + ctmIndexCache[i] = ctmIndex; + + if(paneType != 17) { + int rgb = StorageOverlay.getRGBFromPane(paneType-1); + { + int a = (rgb >> 24) & 0xFF; + int r = (rgb >> 16) & 0xFF; + int g = (rgb >> 8) & 0xFF; + int b = rgb & 0xFF; + Minecraft.getMinecraft().getTextureManager().bindTexture(STORAGE_PANE_CTM_TEXTURE); + GlStateManager.color(r/255f, g/255f, b/255f, a/255f); + Utils.drawTexturedRect(itemX-1, itemY-1, 18, 18, + startCTMX/227f, (startCTMX+18)/227f, startCTMY/75f, (startCTMY+18)/75f, GL11.GL_NEAREST); + } + + RenderItem itemRender = Minecraft.getMinecraft().getRenderItem(); + itemRender.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRendererObj, stack, itemX, itemY, null); + GlStateManager.disableLighting(); + } + + page.shouldDarkenIfNotSelected[i] = false; + continue; + } else { + int upIndex = i-9; + int leftIndex = i%9 > 0 ? i-1 : -1; + int rightIndex = i%9 < 8 ? i+1 : -1; + int downIndex = i+9; + + int[] indexArr = {rightIndex, downIndex, leftIndex, upIndex}; + + for(int j=0; j<4; j++) { + int index = indexArr[j]; + int type = index >= 0 && index < isPaneCache.length ? StorageOverlay.getPaneType(page.items[index], index, isPaneCache) : -1; + if(type > 0) { + int ctmIndex = StorageOverlay.getCTMIndex(page, index, isPaneCache, ctmIndexCache); + if(ctmIndex < 0) continue; + + boolean renderConnection; + boolean horizontal = ctmIndex == 1 || ctmIndex == 2 || ctmIndex == 3; + boolean vertical = ctmIndex == 12 || ctmIndex == 24 || ctmIndex == 36; + if((i%9 == 0 && index%9 == 0) || (i%9 == 8 && index%9 == 8)) { + renderConnection = horizontal || vertical; + } else if(index == leftIndex || index == rightIndex) { + renderConnection = horizontal; + } else { + renderConnection = vertical; + } + + if(renderConnection) { + Minecraft.getMinecraft().getTextureManager().bindTexture(STORAGE_PANE_CTM_TEXTURE); + int rgb = StorageOverlay.getRGBFromPane(type-1); + int a = (rgb >> 24) & 0xFF; + int r = (rgb >> 16) & 0xFF; + int g = (rgb >> 8) & 0xFF; + int b = rgb & 0xFF; + GlStateManager.color(r/255f, g/255f, b/255f, a/255f); + + GlStateManager.pushMatrix(); + GlStateManager.translate(itemX-1+9, itemY-1+9, 10); + GlStateManager.rotate(j*90, 0, 0, 1); + GlStateManager.enableAlpha(); + GlStateManager.disableLighting(); + + boolean horzFlip = false; + boolean vertFlip = false; + + if(index == leftIndex) { + vertFlip = true; + } else if(index == downIndex) { + vertFlip = true; + } + + Utils.drawTexturedRect(0, -9, 8, 18, + !horzFlip ? 209/227f : 219/227f, horzFlip ? 227/227f : 217/227f, + !vertFlip ? 57/75f : 75f/75f, vertFlip ? 57/75f : 75f/75f, GL11.GL_NEAREST); + Utils.drawTexturedRect(8, -9, 10, 18, + !horzFlip ? 217/227f : 209/227f, horzFlip ? 219/227f : 227/227f, + !vertFlip ? 57/75f : 75f/75f, vertFlip ? 57/75f : 75f/75f, GL11.GL_NEAREST); + + GlStateManager.popMatrix(); + } + } + } + } + + GlStateManager.translate(0, 0, 20); + Utils.drawItemStack(stack, itemX, itemY); + GlStateManager.translate(0, 0, -20); } } - ItemStack named = getNamedHeldItemOverride(); + String pageTitle; + if(page.customTitle != null && !page.customTitle.isEmpty()) { + pageTitle = page.customTitle; + } else { + pageTitle = getNamedHeldItemOverride().getDisplayName(); + } Utils.drawItemStack(held, centerX-8, startY-8); GlStateManager.translate(0, 0, 100); - Utils.drawStringCentered(named.getDisplayName(), fontRendererObj, centerX, height - 66, true, 0xffff0000); + Utils.drawStringCentered(pageTitle, fontRendererObj, centerX, height - 76, true, 0xffff0000); int keyCode = NotEnoughUpdates.INSTANCE.config.storageGUI.backpackScrollKey; if(KeybindHelper.isKeyValid(keyCode) && !KeybindHelper.isKeyDown(keyCode)) { String keyName = KeybindHelper.getKeyName(keyCode); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java index 24a4f413..b8d6dc38 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -2,14 +2,13 @@ package io.github.moulberry.notenoughupdates.miscgui; import com.google.common.collect.Lists; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; -import io.github.moulberry.notenoughupdates.core.BackgroundBlur; -import io.github.moulberry.notenoughupdates.core.GlScissorStack; -import io.github.moulberry.notenoughupdates.core.GuiElement; -import io.github.moulberry.notenoughupdates.core.GuiElementTextField; +import io.github.moulberry.notenoughupdates.core.*; import io.github.moulberry.notenoughupdates.core.config.KeybindHelper; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger; +import io.github.moulberry.notenoughupdates.miscfeatures.BetterContainers; import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; +import io.github.moulberry.notenoughupdates.util.SpecialColour; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -19,6 +18,10 @@ 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.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.shader.Framebuffer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -31,14 +34,14 @@ import net.minecraft.util.ResourceLocation; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL14; import org.lwjgl.util.vector.Vector2f; +import org.lwjgl.util.vector.Vector4f; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.awt.*; -import java.util.HashSet; +import java.util.*; import java.util.List; -import java.util.Map; -import java.util.Set; public class StorageOverlay extends GuiElement { @@ -53,7 +56,9 @@ public class StorageOverlay extends GuiElement { public static final ResourceLocation STORAGE_PREVIEW_TEXTURES[] = new ResourceLocation[4]; private static final ResourceLocation STORAGE_TEXTURES[] = new ResourceLocation[4]; private static final ResourceLocation STORAGE_ICONS_TEXTURE = new ResourceLocation("notenoughupdates:storage_gui/storage_icons.png"); + private static final ResourceLocation STORAGE_PANE_CTM_TEXTURE = new ResourceLocation("notenoughupdates:storage_gui/storage_gui_pane_ctm.png"); private static final ResourceLocation[] LOAD_CIRCLE_SEQ = new ResourceLocation[11]; + private static final ResourceLocation[] NOT_RICKROLL_SEQ = new ResourceLocation[19]; static { for(int i=0; i maxH) maxH = h; + } + + return maxH; } } @@ -161,6 +188,8 @@ public class StorageOverlay extends GuiElement { @Override public void render() { if(!(Minecraft.getMinecraft().currentScreen instanceof GuiChest)) return; + GuiChest guiChest = (GuiChest) Minecraft.getMinecraft().currentScreen; + ContainerChest containerChest = (ContainerChest) guiChest.inventorySlots; ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); int width = scaledResolution.getScaledWidth(); @@ -196,10 +225,15 @@ public class StorageOverlay extends GuiElement { millisAccumRotation += deltaTime; loadCircleRotation += millisAccumRotation / (1000/107); millisAccumRotation %= (1000/107); + + millisAccumRoll += deltaTime; + rollIndex += millisAccumRoll/100; + millisAccumRoll %= 100; } lastMillis = currentTime; loadCircleIndex %= LOAD_CIRCLE_SEQ.length; + rollIndex %= NOT_RICKROLL_SEQ.length*2; loadCircleRotation %= 360; Color loadCircleColour = Color.getHSBColor(loadCircleRotation/360f, 0.3f, 0.9f); @@ -283,9 +317,14 @@ public class StorageOverlay extends GuiElement { GlStateManager.enableDepth(); GlStateManager.translate(0, startY, 107.0001f); framebuffer.bindFramebufferTexture(); + GlStateManager.color(1, 1, 1, 1); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(GL11.GL_GREATER, 0F); Utils.drawTexturedRect(0, 0, w, h, 0, 1, 1, 0, GL11.GL_NEAREST); + GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); + renderEnchOverlay(enchantGlintRenderLocations); GlStateManager.translate(0, -startY, -107.0001f); @@ -338,22 +377,190 @@ public class StorageOverlay extends GuiElement { if(page != null && page.rows > 0) { int rows = page.rows; + isPaneCaches[storageId] = new int[page.rows*9]; + ctmIndexCaches[storageId] = new int[page.rows*9]; + int[] isPaneCache = isPaneCaches[storageId]; + int[] ctmIndexCache = ctmIndexCaches[storageId]; + for(int k=0; k 0) { + GlStateManager.disableAlpha(); + Gui.drawRect(itemX-1, itemY-1, itemX+17, itemY+17, 0x01000000); +