aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorText.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/NEUEventListener.java19
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java18
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java380
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/TutorialBase.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java154
14 files changed, 315 insertions, 299 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index 201cec86..ff8187f2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -212,7 +212,7 @@ public class NEUOverlay extends Gui {
private boolean redrawItems = false;
- private boolean searchBarHasFocus = false;
+ public static boolean searchBarHasFocus = false;
private static final GuiTextField textField = new GuiTextField(0, null, 0, 0, 0, 0);
private static final int COMPARE_MODE_ALPHABETICAL = 0;
@@ -1044,7 +1044,6 @@ public class NEUOverlay extends Gui {
*/
public boolean keyboardInput(boolean hoverInv) {
if (Minecraft.getMinecraft().currentScreen == null) return false;
- Keyboard.enableRepeatEvents(true);
int keyPressed = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 0de3fffe..77499d59 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -275,7 +275,6 @@ public class NotEnoughUpdates {
}
tmp.delete();
}
- //saveConfig();
}));
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
index 123da60a..4fae9ea5 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
@@ -35,14 +35,23 @@ import org.lwjgl.opengl.GL14;
import java.awt.*;
import java.awt.datatransfer.StringSelection;
import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.ConcurrentModificationException;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
-import java.util.*;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.*;
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.auction_accept;
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.auction_price;
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.auction_view;
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.auction_view_buttons;
public class CustomAH extends Gui {
private enum PriceFilter {
@@ -1589,7 +1598,6 @@ public class CustomAH extends Gui {
return false;
}
- Keyboard.enableRepeatEvents(true);
if (isEditingPrice() && Keyboard.getEventKey() == Keyboard.KEY_RETURN) {
Minecraft.getMinecraft().displayGuiScreen(null);
} else if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorText.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorText.java
index f98c87ee..7acc074b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorText.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorText.java
@@ -68,7 +68,6 @@ public class GuiOptionEditorText extends GuiOptionEditor {
@Override
public boolean keyboardInput() {
if (Keyboard.getEventKeyState() && textField.getFocus()) {
- Keyboard.enableRepeatEvents(true);
textField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
try {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java
index 651335ed..80ec3811 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java
@@ -129,8 +129,6 @@ public class GuiPositionEditor extends GuiScreen {
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
- Keyboard.enableRepeatEvents(true);
-
if (keyCode == Keyboard.KEY_R) {
position.set(originalPosition);
} else if (!clicked) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java
index 9f256d65..f2edf8bd 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java
@@ -164,10 +164,6 @@ public class NEUItemEditor extends GuiScreen {
);
}
- public void onGuiClosed() {
- Keyboard.enableRepeatEvents(false);
- }
-
public Supplier<String> addTextFieldWithSupplier(String initialText, int options) {
GuiElementTextField textField = new GuiElementTextField(initialText, options);
this.options.add(textField);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/NEUEventListener.java
index b86d5828..d070fc2d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/NEUEventListener.java
@@ -6,19 +6,24 @@ import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
import io.github.moulberry.notenoughupdates.cosmetics.CapeManager;
import io.github.moulberry.notenoughupdates.dungeons.DungeonBlocks;
import io.github.moulberry.notenoughupdates.dungeons.DungeonWin;
-import io.github.moulberry.notenoughupdates.miscfeatures.*;
+import io.github.moulberry.notenoughupdates.miscfeatures.CrystalMetalDetectorSolver;
+import io.github.moulberry.notenoughupdates.miscfeatures.CrystalOverlay;
+import io.github.moulberry.notenoughupdates.miscfeatures.FairySouls;
+import io.github.moulberry.notenoughupdates.miscfeatures.ItemCustomizeManager;
+import io.github.moulberry.notenoughupdates.miscfeatures.NPCRetexturing;
import io.github.moulberry.notenoughupdates.miscgui.AccessoryBagOverlay;
import io.github.moulberry.notenoughupdates.miscgui.GuiCustomEnchant;
import io.github.moulberry.notenoughupdates.miscgui.StorageOverlay;
import io.github.moulberry.notenoughupdates.overlays.OverlayManager;
import io.github.moulberry.notenoughupdates.overlays.TextOverlay;
-import io.github.moulberry.notenoughupdates.util.*;
+import io.github.moulberry.notenoughupdates.util.Constants;
+import io.github.moulberry.notenoughupdates.util.ProfileApiSyncer;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import io.github.moulberry.notenoughupdates.util.XPInformation;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.GuiChat;
-import net.minecraft.client.gui.GuiScreenBook;
import net.minecraft.client.gui.inventory.GuiChest;
-import net.minecraft.client.gui.inventory.GuiEditSign;
import net.minecraft.event.ClickEvent;
import net.minecraft.init.Items;
import net.minecraft.inventory.ContainerChest;
@@ -148,10 +153,6 @@ public class NEUEventListener {
if (event.phase != TickEvent.Phase.START) return;
if (Minecraft.getMinecraft().theWorld == null) return;
if (Minecraft.getMinecraft().thePlayer == null) return;
- Keyboard.enableRepeatEvents(Minecraft.getMinecraft().currentScreen != null &&
- (Minecraft.getMinecraft().currentScreen instanceof GuiChat ||
- Minecraft.getMinecraft().currentScreen instanceof GuiEditSign ||
- Minecraft.getMinecraft().currentScreen instanceof GuiScreenBook));
if ((Keyboard.isKeyDown(Keyboard.KEY_NUMPAD1) && Keyboard.isKeyDown(Keyboard.KEY_NUMPAD4) && Keyboard.isKeyDown(
Keyboard.KEY_NUMPAD9))) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
index 6df2dd9a..ef2c67a8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
@@ -1018,6 +1018,13 @@ public class RenderListener {
*/
@SubscribeEvent
public void onGuiScreenKeyboard(GuiScreenEvent.KeyboardInputEvent.Pre event) {
+ Keyboard.enableRepeatEvents(true);
+ if (Minecraft.getMinecraft().currentScreen instanceof GuiInventory &&
+ !NEUOverlay.searchBarHasFocus &&
+ Keyboard.isRepeatEvent()) {
+ event.setCanceled(true);
+ return;
+ }
if (typing) {
event.setCanceled(true);
}
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 7c74c6e2..850d8328 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java
@@ -1,6 +1,11 @@
package io.github.moulberry.notenoughupdates.miscgui;
-import com.google.gson.*;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParseException;
+import com.google.gson.JsonParser;
+import com.google.gson.JsonPrimitive;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.GlScissorStack;
import io.github.moulberry.notenoughupdates.core.GuiElementTextField;
@@ -17,7 +22,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ResourceLocation;
-import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -29,8 +33,15 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.List;
-import java.util.*;
+import java.util.Map;
+import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
@@ -130,7 +141,6 @@ public class GuiInvButtonEditor extends GuiScreen {
super();
reloadExtraIcons();
reloadPresets();
- Keyboard.enableRepeatEvents(true);
}
private static void reloadExtraIcons() {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java
index 12d48991..0645ede7 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java
@@ -1,7 +1,12 @@
package io.github.moulberry.notenoughupdates.miscgui;
import com.google.common.collect.Lists;
-import io.github.moulberry.notenoughupdates.core.*;
+import io.github.moulberry.notenoughupdates.core.ChromaColour;
+import io.github.moulberry.notenoughupdates.core.GlScissorStack;
+import io.github.moulberry.notenoughupdates.core.GuiElement;
+import io.github.moulberry.notenoughupdates.core.GuiElementBoolean;
+import io.github.moulberry.notenoughupdates.core.GuiElementColour;
+import io.github.moulberry.notenoughupdates.core.GuiElementTextField;
import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingFloat;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
import io.github.moulberry.notenoughupdates.miscfeatures.ItemCustomizeManager;
@@ -356,8 +361,6 @@ public class GuiItemCustomize extends GuiScreen {
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
- Keyboard.enableRepeatEvents(true);
-
if (textFieldRename.getFocus()) {
if (keyCode == Keyboard.KEY_ESCAPE) {
textFieldRename.setFocus(false);
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 0d8cb6ec..ac3ddfb8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java
@@ -2,7 +2,11 @@ package io.github.moulberry.notenoughupdates.miscgui;
import com.google.common.collect.Lists;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.core.*;
+import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
+import io.github.moulberry.notenoughupdates.core.ChromaColour;
+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.config.KeybindHelper;
import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger;
import io.github.moulberry.notenoughupdates.miscfeatures.BetterContainers;
@@ -38,19 +42,17 @@ import org.lwjgl.util.vector.Vector2f;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.awt.*;
+import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
-import java.util.*;
+import java.util.Map;
+import java.util.Set;
public class StorageOverlay extends GuiElement {
+ public static final ResourceLocation[] STORAGE_PREVIEW_TEXTURES = new ResourceLocation[4];
private static final int CHEST_TOP_OFFSET = 17;
private static final int CHEST_SLOT_SIZE = 18;
private static final int CHEST_BOTTOM_OFFSET = 215;
-
- private Framebuffer framebuffer = null;
-
- private final Set<Vector2f> enchantGlintRenderLocations = new HashSet<>();
-
- 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");
@@ -58,6 +60,9 @@ public class StorageOverlay extends GuiElement {
"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];
+ private static final StorageOverlay INSTANCE = new StorageOverlay();
+ private static final String CHROMA_STR = "230:255:255:0:0";
+ private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png");
static {
for (int i = 0; i < STORAGE_TEXTURES.length; i++) {
@@ -81,52 +86,193 @@ public class StorageOverlay extends GuiElement {
LOAD_CIRCLE_SEQ[10] = new ResourceLocation("notenoughupdates:loading_circle_seq/1.png");
}
- private static final StorageOverlay INSTANCE = new StorageOverlay();
-
- public static StorageOverlay getInstance() {
- return INSTANCE;
- }
-
+ private final Set<Vector2f> enchantGlintRenderLocations = new HashSet<>();
private final GuiElementTextField searchBar = new GuiElementTextField("", 88, 10,
GuiElementTextField.SCALE_TEXT | GuiElementTextField.DISABLE_BG
);
private final GuiElementTextField renameStorageField = new GuiElementTextField("", 100, 13,
GuiElementTextField.COLOUR
);
-
+ private final int[][] isPaneCaches = new int[40][];
+ private final int[][] ctmIndexCaches = new int[40][];
+ private final LerpingInteger scroll = new LerpingInteger(0, 200);
+ private Framebuffer framebuffer = null;
private int editingNameId = -1;
-
private int guiLeft;
private int guiTop;
-
private boolean fastRender = false;
-
private int loadCircleIndex = 0;
private int rollIndex = 0;
private int loadCircleRotation = 0;
-
private long millisAccumIndex = 0;
private long millisAccumRoll = 0;
private long millisAccumRotation = 0;
-
private long lastMillis = 0;
-
private int scrollVelocity = 0;
private long lastScroll = 0;
-
- private final int[][] isPaneCaches = new int[40][];
- private final int[][] ctmIndexCaches = new int[40][];
-
private int desiredHeightSwitch = -1;
private int desiredHeightMX = -1;
private int desiredHeightMY = -1;
-
private boolean dirty = false;
private boolean allowTypingInSearchBar = true;
-
private int scrollGrabOffset = -1;
- private final LerpingInteger scroll = new LerpingInteger(0, 200);
+ public static StorageOverlay getInstance() {
+ return INSTANCE;
+ }
+
+ private static boolean shouldConnect(int paneIndex1, int paneIndex2) {
+ if (paneIndex1 == 16 || paneIndex2 == 16) return false;
+ if (paneIndex1 < 1 || paneIndex2 < 1) return false;
+ return paneIndex1 == paneIndex2;
+
+ }
+
+ public static int getCTMIndex(StorageManager.StoragePage page, int index, int[] isPaneCache, int[] ctmIndexCache) {
+ if (page.items[index] == null) {
+ ctmIndexCache[index] = -1;
+ return -1;
+ }
+
+ int paneType = getPaneType(page.items[index], index, isPaneCache);
+
+ int upIndex = index - 9;
+ int leftIndex = index % 9 > 0 ? index - 1 : -1;
+ int rightIndex = index % 9 < 8 ? index + 1 : -1;
+ int downIndex = index + 9;
+ int upleftIndex = index % 9 > 0 ? index - 10 : -1;
+ int uprightIndex = index % 9 < 8 ? index - 8 : -1;
+ int downleftIndex = index % 9 > 0 ? index + 8 : -1;
+ int downrightIndex = index % 9 < 8 ? index + 10 : -1;
+
+ boolean up = upIndex >= 0 && upIndex < isPaneCache.length && shouldConnect(getPaneType(
+ page.items[upIndex],
+ upIndex,
+ isPaneCache
+ ), paneType);
+ boolean left = leftIndex >= 0 && leftIndex < isPaneCache.length && shouldConnect(getPaneType(
+ page.items[leftIndex],
+ leftIndex,
+ isPaneCache
+ ), paneType);
+ boolean down = downIndex >= 0 && downIndex < isPaneCache.length && shouldConnect(getPaneType(
+ page.items[downIndex],
+ downIndex,
+ isPaneCache
+ ), paneType);
+ boolean right = rightIndex >= 0 && rightIndex < isPaneCache.length && shouldConnect(getPaneType(
+ page.items[rightIndex],
+ rightIndex,
+ isPaneCache
+ ), paneType);
+ boolean upleft = upleftIndex >= 0 && upleftIndex < isPaneCache.length && shouldConnect(getPaneType(
+ page.items[upleftIndex],
+ upleftIndex,
+ isPaneCache
+ ), paneType);
+ boolean upright = uprightIndex >= 0 && uprightIndex < isPaneCache.length && shouldConnect(getPaneType(
+ page.items[uprightIndex],
+ uprightIndex,
+ isPaneCache
+ ), paneType);
+ boolean downleft = downleftIndex >= 0 && downleftIndex < isPaneCache.length && shouldConnect(getPaneType(
+ page.items[downleftIndex],
+ downleftIndex,
+ isPaneCache
+ ), paneType);
+ boolean downright = downrightIndex >= 0 && downrightIndex < isPaneCache.length &&
+ shouldConnect(getPaneType(page.items[downrightIndex], downrightIndex, isPaneCache), paneType);
+
+ int ctmIndex = BetterContainers.getCTMIndex(up, right, down, left, upleft, upright, downright, downleft);
+ ctmIndexCache[index] = ctmIndex;
+ return ctmIndex;
+ }
+
+ public static int getRGBFromPane(int paneType) {
+ int rgb = -1;
+ EnumChatFormatting formatting = EnumChatFormatting.WHITE;
+ switch (paneType) {
+ case 0:
+ formatting = EnumChatFormatting.WHITE;
+ break;
+ case 1:
+ formatting = EnumChatFormatting.GOLD;
+ break;
+ case 2:
+ formatting = EnumChatFormatting.LIGHT_PURPLE;
+ break;
+ case 3:
+ formatting = EnumChatFormatting.BLUE;
+ break;
+ case 4:
+ formatting = EnumChatFormatting.YELLOW;
+ break;
+ case 5:
+ formatting = EnumChatFormatting.GREEN;
+ break;
+ case 6:
+ rgb = 0xfff03c96;
+ break;
+ case 7:
+ formatting = EnumChatFormatting.DARK_GRAY;
+ break;
+ case 8:
+ formatting = EnumChatFormatting.GRAY;
+ break;
+ case 9:
+ formatting = EnumChatFormatting.DARK_AQUA;
+ break;
+ case 10:
+ formatting = EnumChatFormatting.DARK_PURPLE;
+ break;
+ case 11:
+ formatting = EnumChatFormatting.DARK_BLUE;
+ break;
+ case 12:
+ rgb = 0xffA0522D;
+ break;
+ case 13:
+ formatting = EnumChatFormatting.DARK_GREEN;
+ break;
+ case 14:
+ formatting = EnumChatFormatting.DARK_RED;
+ break;
+ case 15:
+ rgb = 0x00000000;
+ break;
+ case 16:
+ rgb = SpecialColour.specialToChromaRGB(CHROMA_STR);
+ break;
+ }
+ if (rgb != -1) return rgb;
+ return 0xff000000 | Minecraft.getMinecraft().fontRendererObj.getColorCode(formatting.toString().charAt(1));
+ }
+
+ public static int getPaneType(ItemStack stack, int index, int[] cache) {
+ if (cache != null && cache[index] != 0) return cache[index];
+
+ if (NotEnoughUpdates.INSTANCE.config.storageGUI.fancyPanes == 2) {
+ if (cache != null) cache[index] = -1;
+ return -1;
+ }
+
+ if (stack != null &&
+ (stack.getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) || stack.getItem() == Item.getItemFromBlock(
+ Blocks.glass_pane))) {
+ String internalName = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack);
+ if (internalName != null) {
+ if (internalName.startsWith("STAINED_GLASS_PANE")) {
+ if (cache != null) cache[index] = stack.getItemDamage() + 1;
+ return stack.getItemDamage() + 1;
+ } else if (internalName.startsWith("THIN_GLASS")) {
+ if (cache != null) cache[index] = 17;
+ return 17;
+ }
+ }
+ }
+ if (cache != null) cache[index] = -1;
+ return -1;
+ }
private int getMaximumScroll() {
synchronized (StorageManager.getInstance().storageConfig.displayToStorageIdMapRender) {
@@ -194,6 +340,7 @@ 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;
@@ -1537,161 +1684,6 @@ public class StorageOverlay extends GuiElement {
GlStateManager.translate(0, 0, -300);
}
- private static boolean shouldConnect(int paneIndex1, int paneIndex2) {
- if (paneIndex1 == 16 || paneIndex2 == 16) return false;
- if (paneIndex1 < 1 || paneIndex2 < 1) return false;
- return paneIndex1 == paneIndex2;
-
- }
-
- public static int getCTMIndex(StorageManager.StoragePage page, int index, int[] isPaneCache, int[] ctmIndexCache) {
- if (page.items[index] == null) {
- ctmIndexCache[index] = -1;
- return -1;
- }
-
- int paneType = getPaneType(page.items[index], index, isPaneCache);
-
- int upIndex = index - 9;
- int leftIndex = index % 9 > 0 ? index - 1 : -1;
- int rightIndex = index % 9 < 8 ? index + 1 : -1;
- int downIndex = index + 9;
- int upleftIndex = index % 9 > 0 ? index - 10 : -1;
- int uprightIndex = index % 9 < 8 ? index - 8 : -1;
- int downleftIndex = index % 9 > 0 ? index + 8 : -1;
- int downrightIndex = index % 9 < 8 ? index + 10 : -1;
-
- boolean up = upIndex >= 0 && upIndex < isPaneCache.length && shouldConnect(getPaneType(
- page.items[upIndex],
- upIndex,
- isPaneCache
- ), paneType);
- boolean left = leftIndex >= 0 && leftIndex < isPaneCache.length && shouldConnect(getPaneType(
- page.items[leftIndex],
- leftIndex,
- isPaneCache
- ), paneType);
- boolean down = downIndex >= 0 && downIndex < isPaneCache.length && shouldConnect(getPaneType(
- page.items[downIndex],
- downIndex,
- isPaneCache
- ), paneType);
- boolean right = rightIndex >= 0 && rightIndex < isPaneCache.length && shouldConnect(getPaneType(
- page.items[rightIndex],
- rightIndex,
- isPaneCache
- ), paneType);
- boolean upleft = upleftIndex >= 0 && upleftIndex < isPaneCache.length && shouldConnect(getPaneType(
- page.items[upleftIndex],
- upleftIndex,
- isPaneCache
- ), paneType);
- boolean upright = uprightIndex >= 0 && uprightIndex < isPaneCache.length && shouldConnect(getPaneType(
- page.items[uprightIndex],
- uprightIndex,
- isPaneCache
- ), paneType);
- boolean downleft = downleftIndex >= 0 && downleftIndex < isPaneCache.length && shouldConnect(getPaneType(
- page.items[downleftIndex],
- downleftIndex,
- isPaneCache
- ), paneType);
- boolean downright = downrightIndex >= 0 && downrightIndex < isPaneCache.length &&
- shouldConnect(getPaneType(page.items[downrightIndex], downrightIndex, isPaneCache), paneType);
-
- int ctmIndex = BetterContainers.getCTMIndex(up, right, down, left, upleft, upright, downright, downleft);
- ctmIndexCache[index] = ctmIndex;
- return ctmIndex;
- }
-
- private static final String CHROMA_STR = "230:255:255:0:0";
-
- public static int getRGBFromPane(int paneType) {
- int rgb = -1;
- EnumChatFormatting formatting = EnumChatFormatting.WHITE;
- switch (paneType) {
- case 0:
- formatting = EnumChatFormatting.WHITE;
- break;
- case 1:
- formatting = EnumChatFormatting.GOLD;
- break;
- case 2:
- formatting = EnumChatFormatting.LIGHT_PURPLE;
- break;
- case 3:
- formatting = EnumChatFormatting.BLUE;
- break;
- case 4:
- formatting = EnumChatFormatting.YELLOW;
- break;
- case 5:
- formatting = EnumChatFormatting.GREEN;
- break;
- case 6:
- rgb = 0xfff03c96;
- break;
- case 7:
- formatting = EnumChatFormatting.DARK_GRAY;
- break;
- case 8:
- formatting = EnumChatFormatting.GRAY;
- break;
- case 9:
- formatting = EnumChatFormatting.DARK_AQUA;
- break;
- case 10:
- formatting = EnumChatFormatting.DARK_PURPLE;
- break;
- case 11:
- formatting = EnumChatFormatting.DARK_BLUE;
- break;
- case 12:
- rgb = 0xffA0522D;
- break;
- case 13:
- formatting = EnumChatFormatting.DARK_GREEN;
- break;
- case 14:
- formatting = EnumChatFormatting.DARK_RED;
- break;
- case 15:
- rgb = 0x00000000;
- break;
- case 16:
- rgb = SpecialColour.specialToChromaRGB(CHROMA_STR);
- break;
- }
- if (rgb != -1) return rgb;
- return 0xff000000 | Minecraft.getMinecraft().fontRendererObj.getColorCode(formatting.toString().charAt(1));
- }
-
- public static int getPaneType(ItemStack stack, int index, int[] cache) {
- if (cache != null && cache[index] != 0) return cache[index];
-
- if (NotEnoughUpdates.INSTANCE.config.storageGUI.fancyPanes == 2) {
- if (cache != null) cache[index] = -1;
- return -1;
- }
-
- if (stack != null &&
- (stack.getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) || stack.getItem() == Item.getItemFromBlock(
- Blocks.glass_pane))) {
- String internalName = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack);
- if (internalName != null) {
- if (internalName.startsWith("STAINED_GLASS_PANE")) {
- if (cache != null) cache[index] = stack.getItemDamage() + 1;
- return stack.getItemDamage() + 1;
- } else if (internalName.startsWith("THIN_GLASS")) {
- if (cache != null) cache[index] = 17;
- return 17;
- }
- }
- }
- if (cache != null) cache[index] = -1;
- return -1;
- }
-
private List<String> createTooltip(String title, int selectedOption, String... options) {
String selPrefix = EnumChatFormatting.DARK_AQUA + " \u25b6 ";
String unselPrefix = EnumChatFormatting.GRAY.toString();
@@ -1710,16 +1702,6 @@ public class StorageOverlay extends GuiElement {
return list;
}
- private static class IntPair {
- int x;
- int y;
-
- public IntPair(int x, int y) {
- this.x = x;
- this.y = y;
- }
- }
-
public IntPair getPageCoords(int displayId) {
if (displayId < 0) displayId = 0;
@@ -2246,8 +2228,6 @@ public class StorageOverlay extends GuiElement {
return true;
}
- private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png");
-
private void renderEnchOverlay(Set<Vector2f> locations) {
float f = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F / 8.0F;
float f1 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F / 8.0F;
@@ -2321,4 +2301,14 @@ public class StorageOverlay extends GuiElement {
this.fastRender = false;
}
+ private static class IntPair {
+ int x;
+ int y;
+
+ public IntPair(int x, int y) {
+ this.x = x;
+ this.y = y;
+ }
+ }
+
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/TutorialBase.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/TutorialBase.java
index 433bb996..34167b3f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/TutorialBase.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/TutorialBase.java
@@ -43,7 +43,6 @@ public class TutorialBase extends GuiScreen {
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
- Keyboard.enableRepeatEvents(true);
super.keyTyped(typedChar, keyCode);
if (keyCode == Keyboard.KEY_LEFT) {
page--;
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 341c08ed..83ade3a9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
@@ -829,7 +829,6 @@ public class NEUConfigEditor extends GuiElement {
int innerWidth = xSize - 154 - innerPadding * 2;
if (Keyboard.getEventKeyState()) {
- Keyboard.enableRepeatEvents(true);
String old = searchField.getText();
searchField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
searchField.setText(Minecraft.getMinecraft().fontRendererObj.trimStringToWidth(
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
index e572a391..4f420de1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
@@ -66,13 +66,65 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Utils {
- public static boolean hasEffectOverride = false;
- public static boolean disableCustomDungColours = false;
private static final LinkedList<Integer> guiScales = new LinkedList<>();
- private static ScaledResolution lastScale = new ScaledResolution(Minecraft.getMinecraft());
//Labymod compatibility
private static final FloatBuffer projectionMatrixOld = BufferUtils.createFloatBuffer(16);
private static final FloatBuffer modelviewMatrixOld = BufferUtils.createFloatBuffer(16);
+ private static final EnumChatFormatting[] rainbow = new EnumChatFormatting[]{
+ EnumChatFormatting.RED,
+ EnumChatFormatting.GOLD,
+ EnumChatFormatting.YELLOW,
+ EnumChatFormatting.GREEN,
+ EnumChatFormatting.AQUA,
+ EnumChatFormatting.LIGHT_PURPLE,
+ EnumChatFormatting.DARK_PURPLE
+ };
+ private static final Pattern CHROMA_REPLACE_PATTERN = Pattern.compile("\u00a7z(.+?)(?=\u00a7|$)");
+ private static final char[] c = new char[]{'k', 'm', 'b', 't'};
+ private static final LerpingFloat scrollY = new LerpingFloat(0, 100);
+ public static boolean hasEffectOverride = false;
+ public static boolean disableCustomDungColours = false;
+ public static String[] rarityArr = new String[]{
+ "COMMON",
+ "UNCOMMON",
+ "RARE",
+ "EPIC",
+ "LEGENDARY",
+ "MYTHIC",
+ "SPECIAL",
+ "VERY SPECIAL",
+ "SUPREME",
+ "^^ THAT ONE IS DIVINE ^^"
+//, "DIVINE"
+ };
+ public static String[] rarityArrC = new String[]{
+ EnumChatFormatting.WHITE + EnumChatFormatting.BOLD.toString() + "COMMON",
+ EnumChatFormatting.GREEN + EnumChatFormatting.BOLD.toString() + "UNCOMMON",
+ EnumChatFormatting.BLUE + EnumChatFormatting.BOLD.toString() + "RARE",
+ EnumChatFormatting.DARK_PURPLE + EnumChatFormatting.BOLD.toString() + "EPIC",
+ EnumChatFormatting.GOLD + EnumChatFormatting.BOLD.toString() + "LEGENDARY",
+ EnumChatFormatting.LIGHT_PURPLE + EnumChatFormatting.BOLD.toString() + "MYTHIC",
+ EnumChatFormatting.RED + EnumChatFormatting.BOLD.toString() + "SPECIAL",
+ EnumChatFormatting.RED + EnumChatFormatting.BOLD.toString() + "VERY SPECIAL",
+ EnumChatFormatting.AQUA + EnumChatFormatting.BOLD.toString() + "DIVINE",
+ EnumChatFormatting.AQUA + EnumChatFormatting.BOLD.toString() + "DIVINE",
+ //EnumChatFormatting.AQUA+EnumChatFormatting.BOLD.toString()+"DIVINE",
+ };
+ public static final HashMap<String, String> rarityArrMap = new HashMap<String, String>() {{
+ put("COMMON", rarityArrC[0]);
+ put("UNCOMMON", rarityArrC[1]);
+ put("RARE", rarityArrC[2]);
+ put("EPIC", rarityArrC[3]);
+ put("LEGENDARY", rarityArrC[4]);
+ put("MYTHIC", rarityArrC[5]);
+ put("SPECIAL", rarityArrC[6]);
+ put("VERY SPECIAL", rarityArrC[7]);
+ put("DIVINE", rarityArrC[8]);
+ // put("DIVINE", rarityArrC[9]);
+ }};
+ public static Splitter PATH_SPLITTER = Splitter.on(".").omitEmptyStrings().limit(2);
+ private static ScaledResolution lastScale = new ScaledResolution(Minecraft.getMinecraft());
+ private static long startTime = 0;
public static <T> ArrayList<T> createList(T... values) {
ArrayList<T> list = new ArrayList<>();
@@ -203,22 +255,10 @@ public class Utils {
drawItemStackWithText(stack, x, y, null, skytilsRarity);
}
- private static final EnumChatFormatting[] rainbow = new EnumChatFormatting[]{
- EnumChatFormatting.RED,
- EnumChatFormatting.GOLD,
- EnumChatFormatting.YELLOW,
- EnumChatFormatting.GREEN,
- EnumChatFormatting.AQUA,
- EnumChatFormatting.LIGHT_PURPLE,
- EnumChatFormatting.DARK_PURPLE
- };
-
public static String chromaString(String str) {
return chromaString(str, 0, false);
}
- private static final Pattern CHROMA_REPLACE_PATTERN = Pattern.compile("\u00a7z(.+?)(?=\u00a7|$)");
-
public static String chromaStringByColourCode(String str) {
if (str.contains("\u00a7z")) {
Matcher matcher = CHROMA_REPLACE_PATTERN.matcher(str);
@@ -240,8 +280,6 @@ public class Utils {
return str;
}
- private static long startTime = 0;
-
public static String chromaString(String str, float offset, boolean bold) {
str = cleanColour(str);
@@ -268,8 +306,6 @@ public class Utils {
return rainbowText.toString();
}
- private static final char[] c = new char[]{'k', 'm', 'b', 't'};
-
public static String shortNumberFormat(double n, int iteration) {
double d = ((long) n / 100) / 10.0;
boolean isRound = (d * 10) % 10 == 0;
@@ -326,7 +362,7 @@ public class Utils {
int startIndex = indexOfFirstNonWhitespaceNonFormatCode(str);
int endIndex = lastIndexOfNonWhitespaceNonFormatCode(str);
if (startIndex == -1 || endIndex == -1) return "";
- return str.substring(startIndex, endIndex+1);
+ return str.substring(startIndex, endIndex + 1);
}
private static int indexOfFirstNonWhitespaceNonFormatCode(String str) {
@@ -532,46 +568,6 @@ public class Utils {
return str.substring(0, 1).toUpperCase() + str.substring(1).toLowerCase();
}
- public static String[] rarityArr = new String[]{
- "COMMON",
- "UNCOMMON",
- "RARE",
- "EPIC",
- "LEGENDARY",
- "MYTHIC",
- "SPECIAL",
- "VERY SPECIAL",
- "SUPREME",
- "^^ THAT ONE IS DIVINE ^^"
-//, "DIVINE"
- };
-
- public static String[] rarityArrC = new String[]{
- EnumChatFormatting.WHITE + EnumChatFormatting.BOLD.toString() + "COMMON",
- EnumChatFormatting.GREEN + EnumChatFormatting.BOLD.toString() + "UNCOMMON",
- EnumChatFormatting.BLUE + EnumChatFormatting.BOLD.toString() + "RARE",
- EnumChatFormatting.DARK_PURPLE + EnumChatFormatting.BOLD.toString() + "EPIC",
- EnumChatFormatting.GOLD + EnumChatFormatting.BOLD.toString() + "LEGENDARY",
- EnumChatFormatting.LIGHT_PURPLE + EnumChatFormatting.BOLD.toString() + "MYTHIC",
- EnumChatFormatting.RED + EnumChatFormatting.BOLD.toString() + "SPECIAL",
- EnumChatFormatting.RED + EnumChatFormatting.BOLD.toString() + "VERY SPECIAL",
- EnumChatFormatting.AQUA + EnumChatFormatting.BOLD.toString() + "DIVINE",
- EnumChatFormatting.AQUA + EnumChatFormatting.BOLD.toString() + "DIVINE",
- //EnumChatFormatting.AQUA+EnumChatFormatting.BOLD.toString()+"DIVINE",
- };
- public static final HashMap<String, String> rarityArrMap = new HashMap<String, String>() {{
- put("COMMON", rarityArrC[0]);
- put("UNCOMMON", rarityArrC[1]);
- put("RARE", rarityArrC[2]);
- put("EPIC", rarityArrC[3]);
- put("LEGENDARY", rarityArrC[4]);
- put("MYTHIC", rarityArrC[5]);
- put("SPECIAL", rarityArrC[6]);
- put("VERY SPECIAL", rarityArrC[7]);
- put("DIVINE", rarityArrC[8]);
- // put("DIVINE", rarityArrC[9]);
- }};
-
public static String getRarityFromInt(int rarity) {
if (rarity < 0 || rarity >= rarityArr.length) {
return rarityArr[0];
@@ -657,18 +653,33 @@ public class Utils {
public static int parseRomanNumeral(String input) {
int prevVal = 0;
int total = 0;
- for (int i = input.length()-1; i >= 0; i--) {
+ for (int i = input.length() - 1; i >= 0; i--) {
int val;
char ch = input.charAt(i);
switch (ch) {
- case 'I' : val = 1; break;
- case 'V' : val = 5; break;
- case 'X' : val = 10; break;
- case 'L' : val = 50; break;
- case 'C' : val = 100; break;
- case 'D' : val = 500; break;
- case 'M' : val = 1000; break;
- default: throw new IllegalArgumentException("Invalid Roman Numeral Character: " + ch);
+ case 'I':
+ val = 1;
+ break;
+ case 'V':
+ val = 5;
+ break;
+ case 'X':
+ val = 10;
+ break;
+ case 'L':
+ val = 50;
+ break;
+ case 'C':
+ val = 100;
+ break;
+ case 'D':
+ val = 500;
+ break;
+ case 'M':
+ val = 1000;
+ break;
+ default:
+ throw new IllegalArgumentException("Invalid Roman Numeral Character: " + ch);
}
if (val < prevVal) val = -val;
total += val;
@@ -810,6 +821,7 @@ public class Utils {
public static ItemStack createItemStack(Item item, String displayname, String... lore) {
return createItemStack(item, displayname, 0, lore);
}
+
public static ItemStack createItemStack(Block item, String displayname, String... lore) {
return createItemStack(Item.getItemFromBlock(item), displayname, lore);
}
@@ -1346,8 +1358,6 @@ public class Utils {
return prim.getAsString();
}
- public static Splitter PATH_SPLITTER = Splitter.on(".").omitEmptyStrings().limit(2);
-
public static JsonElement getElement(JsonElement element, String path) {
List<String> path_split = PATH_SPLITTER.splitToList(path);
if (element instanceof JsonObject) {
@@ -1429,8 +1439,6 @@ public class Utils {
scrollY.resetTimer();
}
- private static final LerpingFloat scrollY = new LerpingFloat(0, 100);
-
public static void drawHoveringText(
List<String> textLines,
final int mouseX,