aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java26
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java69
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/Position.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java20
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinWorld.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java65
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java18
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java271
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java163
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java2
-rw-r--r--src/main/resources/assets/notenoughupdates/ah_search_overlay.pngbin0 -> 3513 bytes
17 files changed, 497 insertions, 182 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index d2eaea1b..710561f8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -6,6 +6,7 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import io.github.moulberry.notenoughupdates.auction.CustomAHGui;
import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
+import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
import io.github.moulberry.notenoughupdates.cosmetics.CapeManager;
import io.github.moulberry.notenoughupdates.dungeons.DungeonBlocks;
import io.github.moulberry.notenoughupdates.dungeons.DungeonWin;
@@ -267,6 +268,7 @@ public class NEUEventListener {
}
if(neu.hasSkyblockScoreboard()) {
+ SBInfo.getInstance().tick();
if(Loader.isModLoaded("morus")) {
MorusIntegration.getInstance().tick();
}
@@ -307,7 +309,6 @@ public class NEUEventListener {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""));
}
}
- SBInfo.getInstance().tick();
}
if(currentTime - lastSkyblockScoreboard < 5*60*1000) { //5 minutes
neu.manager.auctionManager.tick();
@@ -469,6 +470,14 @@ public class NEUEventListener {
AtomicBoolean missingRecipe = new AtomicBoolean(false);
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event) {
+ if(Minecraft.getMinecraft().currentScreen instanceof GuiScreenElementWrapper &&
+ event.gui == null && !(Keyboard.getEventKeyState() && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) &&
+ System.currentTimeMillis() - NotEnoughUpdates.INSTANCE.lastOpenedGui < 500) {
+ NotEnoughUpdates.INSTANCE.lastOpenedGui = 0;
+ event.setCanceled(true);
+ return;
+ }
+
if(!(event.gui instanceof GuiContainer) && Minecraft.getMinecraft().currentScreen != null) {
CalendarOverlay.setEnabled(false);
}
@@ -791,6 +800,11 @@ public class NEUEventListener {
event.setCanceled(true);
return;
}
+ if(RancherBootOverlay.shouldReplace()) {
+ RancherBootOverlay.render();
+ event.setCanceled(true);
+ return;
+ }
if(TradeWindow.tradeWindowActive() ||
event.gui instanceof CustomAHGui || neu.manager.auctionManager.customAH.isRenderOverAuctionView()) {
@@ -1073,6 +1087,11 @@ public class NEUEventListener {
event.setCanceled(true);
return;
}
+ if(RancherBootOverlay.shouldReplace()) {
+ RancherBootOverlay.mouseEvent();
+ event.setCanceled(true);
+ return;
+ }
if(TradeWindow.tradeWindowActive() || event.gui instanceof CustomAHGui ||
neu.manager.auctionManager.customAH.isRenderOverAuctionView()) {
event.setCanceled(true);
@@ -1113,6 +1132,11 @@ public class NEUEventListener {
event.setCanceled(true);
return;
}
+ if(RancherBootOverlay.shouldReplace()) {
+ RancherBootOverlay.keyEvent();
+ event.setCanceled(true);
+ return;
+ }
if(TradeWindow.tradeWindowActive() || event.gui instanceof CustomAHGui ||
neu.manager.auctionManager.customAH.isRenderOverAuctionView()) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
index 0381a70a..bbaa08db 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
@@ -204,48 +204,45 @@ public class NEUManager {
if (Display.isActive()) dialog.toFront();
- if (false) {
- } else {
- Utils.recursiveDelete(repoLocation);
- repoLocation.mkdirs();
+ Utils.recursiveDelete(repoLocation);
+ repoLocation.mkdirs();
- //TODO: Store hard-coded value somewhere else
- String dlUrl = "https://github.com/Moulberry/NotEnoughUpdates-REPO/archive/master.zip";
+ //TODO: Store hard-coded value somewhere else
+ String dlUrl = "https://github.com/Moulberry/NotEnoughUpdates-REPO/archive/master.zip";
- pane.setMessage("Downloading NEU Master Archive. (DL# >20)");
- dialog.pack();
- if(NotEnoughUpdates.INSTANCE.config.hidden.dev) dialog.setVisible(true);
- if (Display.isActive()) dialog.toFront();
+ pane.setMessage("Downloading NEU Master Archive. (DL# >20)");
+ dialog.pack();
+ if(NotEnoughUpdates.INSTANCE.config.hidden.dev) dialog.setVisible(true);
+ if (Display.isActive()) dialog.toFront();
- File itemsZip = new File(repoLocation, "neu-items-master.zip");
- try {
- itemsZip.createNewFile();
- } catch (IOException e) {
- return;
- }
- URL url = new URL(dlUrl);
- URLConnection urlConnection = url.openConnection();
- urlConnection.setConnectTimeout(15000);
- urlConnection.setReadTimeout(20000);
- try (BufferedInputStream inStream = new BufferedInputStream(urlConnection.getInputStream());
- FileOutputStream fileOutputStream = new FileOutputStream(itemsZip)) {
- byte dataBuffer[] = new byte[1024];
- int bytesRead;
- while ((bytesRead = inStream.read(dataBuffer, 0, 1024)) != -1) {
- fileOutputStream.write(dataBuffer, 0, bytesRead);
- }
- } catch (IOException e) {
- dialog.dispose();
- return;
+ File itemsZip = new File(repoLocation, "neu-items-master.zip");
+ try {
+ itemsZip.createNewFile();
+ } catch (IOException e) {
+ return;
+ }
+ URL url = new URL(dlUrl);
+ URLConnection urlConnection = url.openConnection();
+ urlConnection.setConnectTimeout(15000);
+ urlConnection.setReadTimeout(20000);
+ try (BufferedInputStream inStream = new BufferedInputStream(urlConnection.getInputStream());
+ FileOutputStream fileOutputStream = new FileOutputStream(itemsZip)) {
+ byte dataBuffer[] = new byte[1024];
+ int bytesRead;
+ while ((bytesRead = inStream.read(dataBuffer, 0, 1024)) != -1) {
+ fileOutputStream.write(dataBuffer, 0, bytesRead);
}
+ } catch (IOException e) {
+ dialog.dispose();
+ return;
+ }
- pane.setMessage("Unzipping NEU Master Archive.");
- dialog.pack();
- //dialog.setVisible(true);
- if (Display.isActive()) dialog.toFront();
+ pane.setMessage("Unzipping NEU Master Archive.");
+ dialog.pack();
+ //dialog.setVisible(true);
+ if (Display.isActive()) dialog.toFront();
- unzipIgnoreFirstFolder(itemsZip.getAbsolutePath(), repoLocation.getAbsolutePath());
- }
+ unzipIgnoreFirstFolder(itemsZip.getAbsolutePath(), repoLocation.getAbsolutePath());
if(currentCommitJSON == null || !currentCommitJSON.get("sha").getAsString().equals(latestRepoCommit)) {
JsonObject newCurrentCommitJSON = new JsonObject();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index d072612b..dea4d520 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -103,6 +103,7 @@ public class NotEnoughUpdates {
private static final Set<String> SKYBLOCK_IN_ALL_LANGUAGES = Sets.newHashSet("SKYBLOCK","\u7A7A\u5C9B\u751F\u5B58", "\u7A7A\u5CF6\u751F\u5B58");
public GuiScreen openGui = null;
+ public long lastOpenedGui = 0;
SimpleCommand collectionLogCommand = new SimpleCommand("neucl", new SimpleCommand.ProcessCommandRunnable() {
public void processCommand(ICommandSender sender, String[] args) {
@@ -1047,6 +1048,7 @@ public class NotEnoughUpdates {
}
Minecraft.getMinecraft().displayGuiScreen(openGui);
openGui = null;
+ lastOpenedGui = System.currentTimeMillis();
}
if(currChatMessage != null && currentTime - lastChatMessage > CHAT_MSG_COOLDOWN) {
lastChatMessage = currentTime;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/Position.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/Position.java
index e003e440..e7198631 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/Position.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/Position.java
@@ -162,9 +162,9 @@ public class Position {
this.y = screenHeight-EDGE_OFFSET;
}
} else {
- if(this.y+objHeight > -EDGE_OFFSET) {
- deltaY += -EDGE_OFFSET-objHeight-this.y;
- this.y = -EDGE_OFFSET-objHeight;
+ if(this.y+1 > -EDGE_OFFSET) {
+ deltaY += -EDGE_OFFSET-1-this.y;
+ this.y = -EDGE_OFFSET-1;
}
if(this.y+screenHeight < EDGE_OFFSET) {
deltaY += EDGE_OFFSET-screenHeight-this.y;
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 d7d84d28..3b0df42d 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
@@ -1,7 +1,6 @@
package io.github.moulberry.notenoughupdates.core.config.gui;
import io.github.moulberry.notenoughupdates.core.config.Position;
-import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
@@ -13,20 +12,17 @@ import java.io.IOException;
public class GuiPositionEditor extends GuiScreen {
- private Position position;
+ private final Position position;
private Position originalPosition;
- private int elementWidth;
- private int elementHeight;
- private Runnable renderCallback;
- private Runnable positionChangedCallback;
- private Runnable closedCallback;
+ private final int elementWidth;
+ private final int elementHeight;
+ private final Runnable renderCallback;
+ private final Runnable positionChangedCallback;
+ private final Runnable closedCallback;
private boolean clicked = false;
private int grabbedX = 0;
private int grabbedY = 0;
- private int oldMouseX = 0;
- private int oldMouseY = 0;
-
private int guiScaleOverride = -1;
public GuiPositionEditor(Position position, int elementWidth, int elementHeight,
@@ -63,7 +59,6 @@ public class GuiPositionEditor extends GuiScreen {
scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
}
-
this.width = scaledResolution.getScaledWidth();
this.height = scaledResolution.getScaledHeight();
mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
@@ -142,9 +137,6 @@ public class GuiPositionEditor extends GuiScreen {
mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1;
- oldMouseX = mouseX;
- oldMouseY = mouseY;
-
grabbedX += position.moveX(mouseX - grabbedX, elementWidth, scaledResolution);
grabbedY += position.moveY(mouseY - grabbedY, elementHeight, scaledResolution);
positionChangedCallback.run();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java
index 817e80e9..b0e46e00 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java
@@ -478,8 +478,8 @@ public class GuiDungeonMapEditor extends GuiScreen {
NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPosition,
size, size, () -> {
ScaledResolution scaledResolution = Utils.pushGuiScale(2);
- demoMap.renderMap(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPosition.getAbsX(scaledResolution, size/2)+size/2,
- NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPosition.getAbsY(scaledResolution, size/2)+size/2,
+ demoMap.renderMap(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPosition.getAbsX(scaledResolution, size)+size/2,
+ NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPosition.getAbsY(scaledResolution, size)+size/2,
NotEnoughUpdates.INSTANCE.colourMap, decorations, 0,
players, false, 0);
Utils.pushGuiScale(-1);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java
index 9e97cfc0..b96fefef 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java
@@ -144,7 +144,7 @@ public class CrystalOverlay {
ItemStack held = p.getHeldItem();
String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held);
if(internal != null) {
- if(internal.endsWith("_CRYSTAL")) {
+ if(internal.endsWith("_CRYSTAL") && !internal.equals("POWER_CRYSTAL")) {
displayMillis = System.currentTimeMillis();
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java
index d33cb7d3..0fd2100c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java
@@ -13,8 +13,8 @@ public class FlyFix {
private static long lastAbilitySend = 0;
public static void onSendAbilities(C13PacketPlayerAbilities packet) {
- //if(true) return;
- if(!NotEnoughUpdates.INSTANCE.config.misc.flyFix) return;
+ if(true) return;
+ //if(!NotEnoughUpdates.INSTANCE.config.misc.flyFix) return;
if(Minecraft.getMinecraft().thePlayer == null) return;
if(!Minecraft.getMinecraft().thePlayer.capabilities.allowFlying) return;
if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return;
@@ -28,8 +28,8 @@ public class FlyFix {
}
public static void onReceiveAbilities(S39PacketPlayerAbilities packet) {
- //if(true) return;
- if(!NotEnoughUpdates.INSTANCE.config.misc.flyFix) return;
+ if(true) return;
+ //if(!NotEnoughUpdates.INSTANCE.config.misc.flyFix) return;
if(Minecraft.getMinecraft().thePlayer == null) return;
if(!Minecraft.getMinecraft().thePlayer.capabilities.allowFlying) return;
if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return;
@@ -39,6 +39,7 @@ public class FlyFix {
long currentTime = System.currentTimeMillis();
serverWantFly = packet.isFlying();
+
if(serverWantFly != clientWantFly) {
if(currentTime - lastAbilitySend > 0 && currentTime - lastAbilitySend < 500) {
packet.setFlying(clientWantFly);
@@ -49,8 +50,8 @@ public class FlyFix {
}
public static void tick() {
- //if(true) return;
- if(!NotEnoughUpdates.INSTANCE.config.misc.flyFix) return;
+ if(true) return;
+ //if(!NotEnoughUpdates.INSTANCE.config.misc.flyFix) return;
if(Minecraft.getMinecraft().thePlayer == null) return;
if(!Minecraft.getMinecraft().thePlayer.capabilities.allowFlying) return;
if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java
index 5cb2dc8d..10509dd1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java
@@ -2,10 +2,12 @@ package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.miscfeatures.*;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C13PacketPlayerAbilities;
+import net.minecraft.network.play.server.S03PacketTimeUpdate;
import net.minecraft.network.play.server.S23PacketBlockChange;
import net.minecraft.network.play.server.S2FPacketSetSlot;
import net.minecraft.network.play.server.S39PacketPlayerAbilities;
@@ -19,7 +21,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(NetHandlerPlayClient.class)
public class MixinNetHandlerPlayClient {
-
private static final String TARGET = "Lnet/minecraft/entity/player/EntityPlayer;" +
"setPositionAndRotation(DDDFF)V";
@Redirect(method="handlePlayerPosLook", at=@At(value="INVOKE", target=TARGET))
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinWorld.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinWorld.java
index 19cc7606..6c640390 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinWorld.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinWorld.java
@@ -3,6 +3,7 @@ package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects;
import io.github.moulberry.notenoughupdates.miscfeatures.DwarvenMinesTextures;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
@@ -14,7 +15,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(World.class)
public class MixinWorld {
-
@Inject(method="spawnParticle(IZDDDDDD[I)V", at=@At("HEAD"), cancellable = true)
public void spawnParticle(int particleID, boolean p_175720_2_, double xCood, double yCoord, double zCoord,
double xOffset, double yOffset, double zOffset, int[] p_175720_15_, CallbackInfo ci) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
index 1c0528da..1f70d235 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -219,6 +219,21 @@ public class NEUConfig extends Config {
@Expose
@Category(
+ name = "Smooth AOTE",
+ desc = "Smooth AOTE"
+ )
+ public SmoothAOTE smoothAOTE = new SmoothAOTE();
+
+
+ @Expose
+ @Category(
+ name = "AH Search GUI",
+ desc = "AH Search GUI"
+ )
+ public AuctionHouseSearch auctionHouseSearch = new AuctionHouseSearch();
+
+ @Expose
+ @Category(
name = "Dungeon Block Overlay",
desc = "Dungeon Block Overlay"
)
@@ -233,13 +248,6 @@ public class NEUConfig extends Config {
@Expose
@Category(
- name = "Smooth AOTE",
- desc = "Smooth AOTE"
- )
- public SmoothAOTE smoothAOTE = new SmoothAOTE();
-
- @Expose
- @Category(
name = "Custom Rod Colours",
desc = "Custom Rod Colours"
)
@@ -276,14 +284,6 @@ public class NEUConfig extends Config {
@Expose
@ConfigOption(
- name = "Private Island Fly Fix",
- desc = "Fix flying being delaying on private islands"
- )
- @ConfigEditorBoolean
- public boolean flyFix = true;
-
- @Expose
- @ConfigOption(
name = "Hide Potion Effects",
desc = "Hide the potion effects inside your inventory while on skyblock"
)
@@ -1218,6 +1218,41 @@ public class NEUConfig extends Config {
public boolean showOwnHeadAsMarker = false;
}
+ public static class AuctionHouseSearch {
+ @Expose
+ @ConfigOption(
+ name = "Enable Search GUI",
+ desc = "Use the advanced search GUI with autocomplete and history instead of the normal sign GUI"
+ )
+ @ConfigEditorBoolean
+ public boolean enableSearchOverlay = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Keep Previous Search",
+ desc = "Don't clear the search bar after closing the GUI"
+ )
+ @ConfigEditorBoolean
+ public boolean keepPreviousSearch = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Past Searches",
+ desc = "Show past searches below the autocomplete box"
+ )
+ @ConfigEditorBoolean
+ public boolean showPastSearches = true;
+
+ @Expose
+ @ConfigOption(
+ name = "ESC to Full Close",
+ desc = "Make pressing ESCAPE close the search GUI without opening up the AH again\n" +
+ "ENTER can still be used to search"
+ )
+ @ConfigEditorBoolean
+ public boolean escFullClose = true;
+ }
+
public static class DungeonBlock {
@Expose
@ConfigOption(
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 0b00cd5a..5d91e268 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
@@ -63,24 +63,24 @@ public class NEUConfigEditor extends GuiElement {
this.processedConfig = ConfigProcessor.create(config);
if(categoryOpen != null) {
- for(String category : processedConfig.keySet()) {
- if(category.equalsIgnoreCase(categoryOpen)) {
- selectedCategory = category;
+ for(Map.Entry<String, ConfigProcessor.ProcessedCategory> category : processedConfig.entrySet()) {
+ if(category.getValue().name.equalsIgnoreCase(categoryOpen)) {
+ selectedCategory = category.getKey();
break;
}
}
if(selectedCategory == null) {
- for(String category : processedConfig.keySet()) {
- if(category.toLowerCase().startsWith(categoryOpen.toLowerCase())) {
- selectedCategory = category;
+ for(Map.Entry<String, ConfigProcessor.ProcessedCategory> category : processedConfig.entrySet()) {
+ if(category.getValue().name.toLowerCase().startsWith(categoryOpen.toLowerCase())) {
+ selectedCategory = category.getKey();
break;
}
}
}
if(selectedCategory == null) {
- for(String category : processedConfig.keySet()) {
- if(category.toLowerCase().contains(categoryOpen.toLowerCase())) {
- selectedCategory = category;
+ for(Map.Entry<String, ConfigProcessor.ProcessedCategory> category : processedConfig.entrySet()) {
+ if(category.getValue().name.toLowerCase().contains(categoryOpen.toLowerCase())) {
+ selectedCategory = category.getKey();
break;
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java
index 33322f8a..3401bb21 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java
@@ -4,7 +4,9 @@ import com.google.common.base.Splitter;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.GuiElementTextField;
+import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
import io.github.moulberry.notenoughupdates.mixins.GuiEditSignAccessor;
+import io.github.moulberry.notenoughupdates.options.NEUConfigEditor;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -13,15 +15,26 @@ import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiEditSign;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemStack;
+import net.minecraft.network.play.client.C0DPacketCloseWindow;
import net.minecraft.tileentity.TileEntitySign;
import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.ResourceLocation;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.text.WordUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
import java.util.*;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.atomic.AtomicInteger;
public class AuctionSearchOverlay {
+ private static final ResourceLocation SEARCH_OVERLAY_TEXTURE = new ResourceLocation("notenoughupdates:ah_search_overlay.png");
+
private static GuiElementTextField textField = new GuiElementTextField("", 200, 20, 0);
private static boolean searchFieldClicked = false;
private static String searchString = "";
@@ -29,7 +42,7 @@ public class AuctionSearchOverlay {
private static final int AUTOCOMPLETE_HEIGHT = 118;
- private static Set<String> autocompletedItems = new LinkedHashSet<>();
+ private static final Set<String> autocompletedItems = new LinkedHashSet<>();
private static final Comparator<String> salesComparator = (o1, o2) -> {
JsonObject auctionInfo1 = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(o1);
@@ -51,14 +64,21 @@ public class AuctionSearchOverlay {
};
public static boolean shouldReplace() {
- if(!(Minecraft.getMinecraft().currentScreen instanceof GuiEditSign)) return false;
+ if(!NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.enableSearchOverlay) return false;
+
+ if(!(Minecraft.getMinecraft().currentScreen instanceof GuiEditSign)) {
+ if(!NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.keepPreviousSearch) searchString = "";
+ return false;
+ }
String lastContainer = SBInfo.getInstance().lastOpenContainerName;
+ if(lastContainer == null) return false;
if(!lastContainer.equals("Auctions Browser") && !lastContainer.startsWith("Auctions: ")) return false;
TileEntitySign tes = ((GuiEditSignAccessor)Minecraft.getMinecraft().currentScreen).getTileSign();
+ if(tes == null) return false;
if(tes.getPos().getY() != 0) return false;
if(!tes.signText[2].getUnformattedText().equals("^^^^^^^^^^^^^^^")) return false;
if(!tes.signText[3].getUnformattedText().equals("Enter query")) return false;
@@ -75,55 +95,76 @@ public class AuctionSearchOverlay {
Utils.drawGradientRect(0, 0, width, height, -1072689136, -804253680);
- Minecraft.getMinecraft().fontRendererObj.drawString("Enter Query:", width/2-100, height/4-10, 0xdddddd, true);
+ int h = NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.showPastSearches ? 219 : 145;
+
+ int topY = height/4;
+ if(scaledResolution.getScaleFactor() >= 4) {
+ topY = height/2 - h/2 + 5;
+ }
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(SEARCH_OVERLAY_TEXTURE);
+ Utils.drawTexturedRect(width/2-100, topY-1, 203, h, 0, 203/512f, 0, h/256f, GL11.GL_NEAREST);
+
+ Minecraft.getMinecraft().fontRendererObj.drawString("Enter Query:", width/2-100, topY-10, 0xdddddd, true);
textField.setText(searchString);
- textField.render(width/2-100, height/4);
+ textField.setSize(149, 20);
+ textField.setCustomBorderColour(0xffffff);
+ textField.render(width/2-100+1, topY+1);
if(textField.getText().trim().isEmpty()) autocompletedItems.clear();
- Gui.drawRect(width/2-101, height/4+25, width/2+101, height/4+25+ AUTOCOMPLETE_HEIGHT, 0xffffffff);
- Gui.drawRect(width/2-100, height/4+25+1, width/2+100, height/4+25-1+ AUTOCOMPLETE_HEIGHT, 0xff000000);
+ //Gui.drawRect(width/2-101, height/4+25, width/2+101, height/4+25+ AUTOCOMPLETE_HEIGHT, 0xffffffff);
+ //Gui.drawRect(width/2-100, height/4+25+1, width/2+100, height/4+25-1+ AUTOCOMPLETE_HEIGHT, 0xff000000);
List<String> tooltipToDisplay = null;
int num = 0;
- for(String str : autocompletedItems) {
- JsonObject obj = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(str);
- if(obj != null) {
- ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(obj);
- Gui.drawRect(width/2-96, height/4+30+num*22, width/2+96, height/4+30+num*22+20, 0xff505050);
- Minecraft.getMinecraft().fontRendererObj.drawString(Utils.trimIgnoreColour(stack.getDisplayName().replaceAll("\\[.+]", "")),
- width/2-74, height/4+35+num*22, 0xdddddd, true);
-
- GlStateManager.enableDepth();
- Utils.drawItemStack(stack, width/2-94, height/4+32+num*22);
-
- if(mouseX > width/2-96 && mouseX < width/2+96 && mouseY > height/4+30+num*22 && mouseY < height/4+30+num*22+20) {
- tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
- }
+ synchronized(autocompletedItems) {
+ for(String str : autocompletedItems) {
+ JsonObject obj = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(str);
+ if(obj != null) {
+ ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(obj);
+ //Gui.drawRect(width/2-96, height/4+30+num*22, width/2+96, height/4+30+num*22+20, 0xff505050);
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(SEARCH_OVERLAY_TEXTURE);
+ GlStateManager.color(1, 1, 1, 1);
+ Utils.drawTexturedRect(width/2-96+1, topY+30+num*22+1, 193, 21, 214/512f, 407/512f, 0, 21/256f, GL11.GL_NEAREST);
+
+ String itemName = Utils.trimIgnoreColour(stack.getDisplayName().replaceAll("\\[.+]", ""));
+ if(itemName.contains("Enchanted Book") && str.contains(";")) {
+ itemName = EnumChatFormatting.BLUE+WordUtils.capitalizeFully(str.split(";")[0].replace("_", " "));
+ }
+ Minecraft.getMinecraft().fontRendererObj.drawString(Minecraft.getMinecraft().fontRendererObj.trimStringToWidth(itemName, 165),
+ width/2-74, topY+35+num*22+1, 0xdddddd, true);
+
+ GlStateManager.enableDepth();
+ Utils.drawItemStack(stack, width/2-94+2, topY+32+num*22+1);
+
+ if(mouseX > width/2-96 && mouseX < width/2+96 && mouseY > topY+30+num*22 && mouseY < topY+30+num*22+20) {
+ tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
+ }
- if(++num >= 5) break;
+ if(++num >= 5) break;
+ }
}
}
- Minecraft.getMinecraft().fontRendererObj.drawString("Past Searches:", width/2-100, height/4+25+ AUTOCOMPLETE_HEIGHT +5, 0xdddddd, true);
-
- int pastSearchHeight = 9 + 10 * Math.min(5, NotEnoughUpdates.INSTANCE.config.hidden.previousAuctionSearches.size());
+ if(NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.showPastSearches) {
+ Minecraft.getMinecraft().fontRendererObj.drawString("Past Searches:", width/2-100, topY+25+ AUTOCOMPLETE_HEIGHT +5, 0xdddddd, true);
- Gui.drawRect(width/2-101, height/4+ AUTOCOMPLETE_HEIGHT +40, width/2+101, height/4+ AUTOCOMPLETE_HEIGHT +40+pastSearchHeight, 0xffffffff);
- Gui.drawRect(width/2-100, height/4+ AUTOCOMPLETE_HEIGHT +40+1, width/2+100, height/4+ AUTOCOMPLETE_HEIGHT +40-1+pastSearchHeight, 0xff000000);
+ for(int i=0; i<5; i++) {
+ if(i >= NotEnoughUpdates.INSTANCE.config.hidden.previousAuctionSearches.size()) break;
- for(int i=0; i<5; i++) {
- if(i >= NotEnoughUpdates.INSTANCE.config.hidden.previousAuctionSearches.size()) break;
+ String s = NotEnoughUpdates.INSTANCE.config.hidden.previousAuctionSearches.get(i);
+ Minecraft.getMinecraft().fontRendererObj.drawString(s, width/2-95+1, topY+45+ AUTOCOMPLETE_HEIGHT +i*10+2, 0xdddddd, true);
+ }
- String s = NotEnoughUpdates.INSTANCE.config.hidden.previousAuctionSearches.get(i);
- Minecraft.getMinecraft().fontRendererObj.drawString(s, width/2-95, height/4+45+ AUTOCOMPLETE_HEIGHT +i*10, 0xdddddd, true);
+ if(tooltipToDisplay != null) {
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj);
+ }
}
- if(tooltipToDisplay != null) {
- Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj);
- }
}
public static void close() {
@@ -189,45 +230,70 @@ public class AuctionSearchOverlay {
}
}
+ private static ExecutorService searchES = Executors.newSingleThreadExecutor();
+ private static AtomicInteger searchId = new AtomicInteger(0);
+
public static void keyEvent() {
- if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE || Keyboard.getEventKey() == Keyboard.KEY_RETURN) {
+ if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
+ close();
+ if(NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.escFullClose) {
+ Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(Minecraft.getMinecraft().thePlayer.openContainer.windowId));
+ }
+ } else if(Keyboard.getEventKey() == Keyboard.KEY_RETURN) {
close();
} else if(Keyboard.getEventKeyState()) {
textField.setText(searchString);
textField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
searchString = textField.getText();
- autocompletedItems.clear();
+ final int thisSearchId = searchId.incrementAndGet();
+
+ searchES.submit(() -> {
+ if(thisSearchId != searchId.get()) return;
- List<String> title = new ArrayList<>(NotEnoughUpdates.INSTANCE.manager.search("title:"+searchString.trim()));
- if(!searchString.trim().contains(" ")) {
- StringBuilder sb = new StringBuilder();
- for(char c : searchString.toCharArray()) {
- sb.append(c).append(" ");
+ List<String> title = new ArrayList<>(NotEnoughUpdates.INSTANCE.manager.search("title:"+searchString.trim()));
+
+ if(thisSearchId != searchId.get()) return;
+
+ if(!searchString.trim().contains(" ")) {
+ StringBuilder sb = new StringBuilder();
+ for(char c : searchString.toCharArray()) {
+ sb.append(c).append(" ");
+ }
+ title.addAll(NotEnoughUpdates.INSTANCE.manager.search("title:"+sb.toString().trim()));
}
- title.addAll(NotEnoughUpdates.INSTANCE.manager.search("title:"+sb.toString().trim()));
- }
- List<String> desc = new ArrayList<>(NotEnoughUpdates.INSTANCE.manager.search("desc:"+searchString.trim()));
- desc.removeAll(title);
- Set<String> auctionableItems = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBinKeySet();
- auctionableItems.addAll(NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfoKeySet());
+ if(thisSearchId != searchId.get()) return;
- if(!auctionableItems.isEmpty()) {
- title.retainAll(auctionableItems);
- desc.retainAll(auctionableItems);
+ List<String> desc = new ArrayList<>(NotEnoughUpdates.INSTANCE.manager.search("desc:"+searchString.trim()));
+ desc.removeAll(title);
- title.sort(salesComparator);
- desc.sort(salesComparator);
- } else {
- Set<String> bazaarItems = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarKeySet();
+ if(thisSearchId != searchId.get()) return;
- title.removeAll(bazaarItems);
- desc.removeAll(bazaarItems);
- }
+ Set<String> auctionableItems = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBinKeySet();
+ auctionableItems.addAll(NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfoKeySet());
+
+ if(!auctionableItems.isEmpty()) {
+ title.retainAll(auctionableItems);
+ desc.retainAll(auctionableItems);
+
+ title.sort(salesComparator);
+ desc.sort(salesComparator);
+ } else {
+ Set<String> bazaarItems = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarKeySet();
+
+ title.removeAll(bazaarItems);
+ desc.removeAll(bazaarItems);
+ }
- autocompletedItems.addAll(title);
- autocompletedItems.addAll(desc);
+ if(thisSearchId != searchId.get()) return;
+
+ synchronized(autocompletedItems) {
+ autocompletedItems.clear();
+ autocompletedItems.addAll(title);
+ autocompletedItems.addAll(desc);
+ }
+ });
}
}
@@ -238,51 +304,80 @@ public class AuctionSearchOverlay {
int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1;
+ int h = NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.showPastSearches ? 219 : 145;
+
+ int topY = height/4;
+ if(scaledResolution.getScaleFactor() >= 4) {
+ topY = height/2 - h/2 + 5;
+ }
+
if(!Mouse.getEventButtonState() && Mouse.getEventButton() == -1 && searchFieldClicked) {
- textField.mouseClickMove(mouseX-2, height/4+10, 0, 0);
+ textField.mouseClickMove(mouseX-2, topY+10, 0, 0);
}
if(Mouse.getEventButton() != -1) {
searchFieldClicked = false;
}
- if(mouseX > width/2-100 && mouseX < width/2+100 && mouseY > height/4 && mouseY < height/4+20) {
- if(Mouse.getEventButtonState()) {
- searchFieldClicked = true;
- textField.mouseClicked(mouseX-2, mouseY, Mouse.getEventButton());
-
- if(Mouse.getEventButton() == 1) {
- searchString = "";
- autocompletedItems.clear();
- }
- }
- } else if(Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
- int num = 0;
- for(String str : autocompletedItems) {
- JsonObject obj = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(str);
- if(obj != null) {
- ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(obj);
- if(mouseX >= width/2-96 && mouseX <= width/2+96 && mouseY >= height/4+30+num*22 && mouseY <= height/4+30+num*22+20) {
- searchString = Utils.cleanColour(stack.getDisplayName().replaceAll("\\[.+]", "")).trim();
+ if(Mouse.getEventButtonState()) {
+ if(mouseY > topY && mouseY < topY+20) {
+ if(mouseX > width/2-100) {
+ if(mouseX < width/2+49) {
+ searchFieldClicked = true;
+ textField.mouseClicked(mouseX-2, mouseY, Mouse.getEventButton());
+
+ if(Mouse.getEventButton() == 1) {
+ searchString = "";
+ synchronized(autocompletedItems) {
+ autocompletedItems.clear();
+ }
+ }
+ } else if(mouseX < width/2+75) {
close();
- return;
+ } else if(mouseX < width/2+100) {
+ close();
+ Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(Minecraft.getMinecraft().thePlayer.openContainer.windowId));
+ NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper(new NEUConfigEditor(
+ NotEnoughUpdates.INSTANCE.config, "AH Search GUI"));
+ }
+ }
+ } else if(Mouse.getEventButton() == 0) {
+ int num = 0;
+ synchronized(autocompletedItems) {
+ for(String str : autocompletedItems) {
+ JsonObject obj = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(str);
+ if(obj != null) {
+ ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(obj);
+ if(mouseX >= width/2-96 && mouseX <= width/2+96 && mouseY >= topY+30+num*22 && mouseY <= topY+30+num*22+20) {
+ searchString = Utils.cleanColour(stack.getDisplayName().replaceAll("\\[.+]", "")).trim();
+ if(searchString.contains("Enchanted Book") && str.contains(";")) {
+ searchString = WordUtils.capitalizeFully(str.split(";")[0].replace("_", " "));
+ }
+ close();
+ return;
+ }
+
+ if(++num >= 5) break;
+ }
}
-
- if(++num >= 5) break;
}
- }
- for(int i=0; i<5; i++) {
- if(i >= NotEnoughUpdates.INSTANCE.config.hidden.previousAuctionSearches.size()) break;
+ if(NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.showPastSearches) {
+ for(int i=0; i<5; i++) {
+ if(i >= NotEnoughUpdates.INSTANCE.config.hidden.previousAuctionSearches.size()) break;
- String s = NotEnoughUpdates.INSTANCE.config.hidden.previousAuctionSearches.get(i);
- if(mouseX >= width/2-95 && mouseX <= width/2+95 && mouseY >= height/4+45+AUTOCOMPLETE_HEIGHT+i*10 && mouseY <= height/4+45+AUTOCOMPLETE_HEIGHT+i*10+10) {
- searchString = s;
- close();
- return;
+ String s = NotEnoughUpdates.INSTANCE.config.hidden.previousAuctionSearches.get(i);
+ if(mouseX >= width/2-95 && mouseX <= width/2+95 && mouseY >= topY+45+AUTOCOMPLETE_HEIGHT+i*10 && mouseY <= topY+45+AUTOCOMPLETE_HEIGHT+i*10+10) {
+ searchString = s;
+ close();
+ return;
+ }
+ }
}
}
}
+
+
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
index d4671986..930d4d39 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
@@ -62,11 +62,16 @@ public class MiningOverlay extends TextOverlay {
}
String clean = StringUtils.cleanColour(name);
if(forges && clean.startsWith(" ")) {
- if(name.contains("LOCKED")) continue;
- if(name.contains("EMPTY")) {
- forgeStringsEmpty.add(DARK_AQUA+"Forge "+ Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""));
+ char firstChar = clean.trim().charAt(0);
+ if(firstChar < '0' || firstChar > '9') {
+ forges = false;
} else {
- forgeStrings.add(DARK_AQUA+"Forge "+ Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""));
+ if(name.contains("LOCKED")) continue;
+ if(name.contains("EMPTY")) {
+ forgeStringsEmpty.add(DARK_AQUA+"Forge "+ Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""));
+ } else {
+ forgeStrings.add(DARK_AQUA+"Forge "+ Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""));
+ }
}
} else if(commissions && clean.startsWith(" ")) {
String[] split = clean.trim().split(": ");
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java
new file mode 100644
index 00000000..54988e70
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java
@@ -0,0 +1,163 @@
+package io.github.moulberry.notenoughupdates.overlays;
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.core.GuiElementTextField;
+import io.github.moulberry.notenoughupdates.core.util.GuiElementSlider;
+import io.github.moulberry.notenoughupdates.mixins.GuiEditSignAccessor;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.gui.inventory.GuiEditSign;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntitySign;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+
+import java.util.HashMap;
+
+public class RancherBootOverlay {
+
+ private static int selectedIndex = 0;
+
+ private static HashMap<Integer, Integer> currentSpeeds = new HashMap<>();
+ private static GuiElementSlider slider = new GuiElementSlider(0, 0, 145, 100, 400, 1, 300, (val) -> {
+ setValue(val.intValue());
+ });
+ private static GuiElementTextField textField = new GuiElementTextField("", 48, 20, GuiElementTextField.NUM_ONLY);
+ private static boolean textFieldClicked = false;
+
+ public static boolean shouldReplace() {
+ //if(!NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.enableSearchOverlay) return false;
+
+ if(!(Minecraft.getMinecraft().currentScreen instanceof GuiEditSign)) return false;
+
+ TileEntitySign tes = ((GuiEditSignAccessor)Minecraft.getMinecraft().currentScreen).getTileSign();
+
+ if(tes == null) return false;
+ if(tes.getPos().getY() != 0) return false;
+ if(!tes.signText[1].getUnformattedText().equals("^^^^^^")) return false;
+ if(!tes.signText[2].getUnformattedText().equals("Set your")) return false;
+ if(!tes.signText[3].getUnformattedText().equals("speed cap!")) return false;
+
+ return true;
+ }
+
+ public static void render() {
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ int width = scaledResolution.getScaledWidth();
+ int height = scaledResolution.getScaledHeight();
+ int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
+ int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1;
+
+ Utils.drawGradientRect(0, 0, width, height, -1072689136, -804253680);
+
+ int topY = height/4;
+
+ //Gui.drawRect(width/2-100, topY, width/2+48, topY+20, 0xffffffff);
+ Gui.drawRect(width/2+52, topY, width/2+100, topY+20, 0xffffffff);
+
+ textField.render(width/2+52, topY);
+
+ slider.x = width/2-100;
+ slider.y = topY;
+ slider.render();
+
+ int numIcons = 3;
+ int iconsLeft = width/2 - (numIcons*25 - 5)/2 ;
+
+ for(int i=0; i<numIcons; i++) {
+ Gui.drawRect(iconsLeft+i*25, topY+25, iconsLeft+i*25+20, topY+45, selectedIndex == i ? 0xff0000ff : 0xff808080);
+ Utils.drawItemStack(new ItemStack(Items.carrot), iconsLeft+i*25+2, topY+25+2);
+ Utils.drawStringCentered(""+currentSpeeds.get(i), Minecraft.getMinecraft().fontRendererObj, iconsLeft+i*25+10, topY+52, true, 0xffffffff);
+ //Minecraft.getMinecraft().fontRendererObj.drawString("\u2710", iconsLeft+i*25+15, topY+40, 0xffffff, false);
+ }
+
+ //Minecraft.getMinecraft().fontRendererObj.drawString("Hello!", 100, 100, 0xffffff);
+ }
+
+ public static void close() {
+
+ }
+
+ public static void keyEvent() {
+ if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
+ Minecraft.getMinecraft().displayGuiScreen(null);
+ } else {
+ slider.keyboardInput();
+
+ if(Keyboard.getEventKeyState()) {
+ textField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
+ if(textField.getText().length() > 5) textField.setText(textField.getText().substring(0, 5));
+
+ try {
+ setCurrentSpeed(Integer.parseInt(textField.getText().trim()));
+ slider.setValue(getCurrentSpeed());
+ textField.setCustomBorderColour(0xfeffffff);
+ } catch(NumberFormatException ignored) {
+ textField.setCustomBorderColour(0xffff0000);
+ }
+ }
+ }
+ }
+
+ private static int getCurrentSpeed() {
+ return currentSpeeds.get(selectedIndex);
+ }
+
+ private static void setCurrentSpeed(int speed) {
+ currentSpeeds.put(selectedIndex, speed);
+ }
+
+ public static void setValue(int value) {
+ setCurrentSpeed(value);
+ textField.setText(""+getCurrentSpeed());
+ }
+
+ public static void mouseEvent() {
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ int width = scaledResolution.getScaledWidth();
+ int height = scaledResolution.getScaledHeight();
+ int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
+ int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1;
+
+ int topY = height/4;
+
+ slider.mouseInput(mouseX, mouseY);
+
+ if(!Mouse.getEventButtonState() && Mouse.getEventButton() == -1 && textFieldClicked) {
+ textField.mouseClickMove(mouseX-2, topY+10, 0, 0);
+ }
+
+ if(Mouse.getEventButton() != -1) {
+ textFieldClicked = false;
+ }
+
+ if(mouseX > width/2+52 && mouseX < width/2+100 && mouseY > topY && mouseY < topY+20) {
+ if(Mouse.getEventButtonState()) {
+ textField.mouseClicked(mouseX, mouseY, Mouse.getEventButton());
+ textFieldClicked = true;
+ }
+ }
+
+ if(Mouse.getEventButtonState()) {
+ int numIcons = 3;
+ int iconsLeft = width/2 - (numIcons*25 - 5)/2 ;
+
+ for(int i=0; i<numIcons; i++) {
+ if(mouseX > iconsLeft+i*25 && mouseX < iconsLeft+i*25+20 && mouseY > topY+25 && mouseY < topY+45) {
+ if(i != selectedIndex) {
+ selectedIndex = i;
+ slider.setValue(getCurrentSpeed());
+ textField.setText(""+getCurrentSpeed());
+ }
+ return;
+ }
+ //Minecraft.getMinecraft().fontRendererObj.drawString("\u2710", iconsLeft+i*25+15, topY+40, 0xffffff, false);
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
index a17c9ec9..090b3b59 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
@@ -114,7 +114,7 @@ public class SBInfo {
Minecraft.getMinecraft().theWorld != null &&
locraw == null &&
(currentTime - joinedWorld) > 1000 &&
- (currentTime - lastLocRaw) > 10000) {
+ (currentTime - lastLocRaw) > 15000) {
lastLocRaw = System.currentTimeMillis();
NotEnoughUpdates.INSTANCE.sendChatMessage("/locraw");
}
diff --git a/src/main/resources/assets/notenoughupdates/ah_search_overlay.png b/src/main/resources/assets/notenoughupdates/ah_search_overlay.png
new file mode 100644
index 00000000..3e21edda
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/ah_search_overlay.png
Binary files differ