aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMoulberry <james.jenour@student.scotch.wa.edu.au>2020-08-29 02:32:19 +1000
committerMoulberry <james.jenour@student.scotch.wa.edu.au>2020-08-29 02:32:19 +1000
commita5f669c4ec0692efd0e532d23156ea260718c0ee (patch)
treea1383731d8f645f90afaf3a413767c0944305909 /src
parent3cb08dc571907bdf216ee628c1f8608067a03441 (diff)
downloadNotEnoughUpdates-a5f669c4ec0692efd0e532d23156ea260718c0ee.tar.gz
NotEnoughUpdates-a5f669c4ec0692efd0e532d23156ea260718c0ee.tar.bz2
NotEnoughUpdates-a5f669c4ec0692efd0e532d23156ea260718c0ee.zip
1.2.3
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java74
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java29
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/TradeWindow.java265
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java22
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeNode.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java38
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java17
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java108
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java5
-rw-r--r--src/main/resources/assets/notenoughupdates/capes/mcworld.pngbin0 -> 291014 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/custom_trade.pngbin0 -> 9338 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/mcworld_cape.frag129
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/mcworld_cape.vert12
15 files changed, 658 insertions, 62 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index 820c14b1..84094642 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -516,7 +516,8 @@ public class NEUEventListener {
@SubscribeEvent
public void onGuiScreenDrawPre(GuiScreenEvent.DrawScreenEvent.Pre event) {
- if(event.gui instanceof CustomAHGui || neu.manager.auctionManager.customAH.isRenderOverAuctionView()) {
+ if(TradeWindow.tradeWindowActive() ||
+ event.gui instanceof CustomAHGui || neu.manager.auctionManager.customAH.isRenderOverAuctionView()) {
event.setCanceled(true);
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
@@ -527,11 +528,19 @@ public class NEUEventListener {
Utils.drawGradientRect(0, 0, width, height, -1072689136, -804253680);
if(event.mouseX < width*neu.overlay.getWidthMult()/3 || event.mouseX > width-width*neu.overlay.getWidthMult()/3) {
- neu.manager.auctionManager.customAH.drawScreen(event.mouseX, event.mouseY);
+ if(event.gui instanceof CustomAHGui || neu.manager.auctionManager.customAH.isRenderOverAuctionView()) {
+ neu.manager.auctionManager.customAH.drawScreen(event.mouseX, event.mouseY);
+ } else {
+ TradeWindow.render(event.mouseX, event.mouseY);
+ }
neu.overlay.render(event.mouseX, event.mouseY, false);
} else {
neu.overlay.render(event.mouseX, event.mouseY, false);
- neu.manager.auctionManager.customAH.drawScreen(event.mouseX, event.mouseY);
+ if(event.gui instanceof CustomAHGui || neu.manager.auctionManager.customAH.isRenderOverAuctionView()) {
+ neu.manager.auctionManager.customAH.drawScreen(event.mouseX, event.mouseY);
+ } else {
+ TradeWindow.render(event.mouseX, event.mouseY);
+ }
}
}
}
@@ -556,7 +565,8 @@ public class NEUEventListener {
*/
@SubscribeEvent
public void onGuiScreenDrawPost(GuiScreenEvent.DrawScreenEvent.Post event) {
- if(!(event.gui instanceof CustomAHGui || neu.manager.auctionManager.customAH.isRenderOverAuctionView())) {
+ if(!(TradeWindow.tradeWindowActive() || event.gui instanceof CustomAHGui ||
+ neu.manager.auctionManager.customAH.isRenderOverAuctionView())) {
if(shouldRenderOverlay(event.gui) && neu.isOnSkyblock()) {
if(!focusInv) {
GL11.glTranslatef(0, 0, 300);
@@ -607,14 +617,25 @@ public class NEUEventListener {
ItemStack item = lower.getStackInSlot(11+i);
String internal = neu.manager.getInternalNameForItem(item);
if(internal != null) {
- float worthBIN = neu.manager.auctionManager.getLowestBin(internal);
- float worthAUC = -1;
- JsonObject aucInfo = neu.manager.auctionManager.getItemAuctionInfo(internal);
- if(aucInfo != null) {
- worthAUC = aucInfo.get("price").getAsFloat();
+ float bazaarPrice = -1;
+ JsonObject bazaarInfo = neu.manager.auctionManager.getBazaarInfo(internal);
+ if(bazaarInfo != null && bazaarInfo.has("avg_sell")) {
+ bazaarPrice = bazaarInfo.get("avg_sell").getAsFloat();
}
- if(worthAUC == -1) worthAUC = neu.manager.auctionManager.getCraftCost(internal).craftCost;
+ float worthBIN = -1;
+ float worthAUC = -1;
+
+ if(bazaarPrice > 0) {
+ worthBIN = bazaarPrice;
+ worthAUC = bazaarPrice;
+ } else {
+ worthBIN = neu.manager.auctionManager.getLowestBin(internal);
+ JsonObject aucInfo = neu.manager.auctionManager.getItemAuctionInfo(internal);
+ if(aucInfo != null) {
+ worthAUC = aucInfo.get("price").getAsFloat();
+ }
+ }
if(worthAUC <= 0 && worthBIN <= 0) {
missing = true;
@@ -714,9 +735,15 @@ public class NEUEventListener {
if(!event.isCanceled()) {
Utils.scrollTooltip(Mouse.getEventDWheel());
}
- if(event.gui instanceof CustomAHGui || neu.manager.auctionManager.customAH.isRenderOverAuctionView()) {
+ if(TradeWindow.tradeWindowActive() || event.gui instanceof CustomAHGui ||
+ neu.manager.auctionManager.customAH.isRenderOverAuctionView()) {
event.setCanceled(true);
- neu.manager.auctionManager.customAH.handleMouseInput();
+ if(event.gui instanceof CustomAHGui ||
+ neu.manager.auctionManager.customAH.isRenderOverAuctionView()) {
+ neu.manager.auctionManager.customAH.handleMouseInput();
+ } else {
+ TradeWindow.handleMouseInput();
+ }
neu.overlay.mouseInput();
return;
}
@@ -739,12 +766,23 @@ public class NEUEventListener {
*/
@SubscribeEvent
public void onGuiScreenKeyboard(GuiScreenEvent.KeyboardInputEvent.Pre event) {
- if(event.gui instanceof CustomAHGui || neu.manager.auctionManager.customAH.isRenderOverAuctionView()) {
- if(neu.manager.auctionManager.customAH.keyboardInput()) {
- event.setCanceled(true);
- Minecraft.getMinecraft().dispatchKeypresses();
- } else if(neu.overlay.keyboardInput(focusInv)) {
- event.setCanceled(true);
+ if(TradeWindow.tradeWindowActive() || event.gui instanceof CustomAHGui ||
+ neu.manager.auctionManager.customAH.isRenderOverAuctionView()) {
+ if(event.gui instanceof CustomAHGui ||
+ neu.manager.auctionManager.customAH.isRenderOverAuctionView()) {
+ if(neu.manager.auctionManager.customAH.keyboardInput()) {
+ event.setCanceled(true);
+ Minecraft.getMinecraft().dispatchKeypresses();
+ } else if(neu.overlay.keyboardInput(focusInv)) {
+ event.setCanceled(true);
+ }
+ } else {
+ if(TradeWindow.keyboardInput()) {
+ event.setCanceled(true);
+ Minecraft.getMinecraft().dispatchKeypresses();
+ } else if(neu.overlay.keyboardInput(focusInv)) {
+ event.setCanceled(true);
+ }
}
return;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 5a02e109..597beca2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -35,6 +35,7 @@ import net.minecraft.util.*;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry;
+import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
@@ -344,7 +345,6 @@ public class NotEnoughUpdates {
float bankBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "banking.balance"), -1);
float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "coin_purse"), 0);
-
EnumChatFormatting moneyPrefix = (bankBalance+purseBalance)>10*1000*1000?
((bankBalance+purseBalance)>50*1000*1000?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED;
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
@@ -352,7 +352,16 @@ public class NotEnoughUpdates {
(bankBalance == -1 ? EnumChatFormatting.YELLOW+"Disabled" : moneyPrefix+
(isMe?"4.8b":Utils.shortNumberFormat(bankBalance, 0)))));
- overallScore += Math.min(2, (bankBalance+purseBalance)/(50f*1000*1000));
+ long networth = profile.getNetWorth(null);
+ if(networth > 0) {
+ EnumChatFormatting moneyPrefix2 = networth>50*1000*1000?
+ (networth>200*1000*1000?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED;
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
+ g+"Networth : "+moneyPrefix2+Utils.shortNumberFormat(networth, 0)));
+ }
+ if(networth == -1) networth = (long)(bankBalance+purseBalance);
+
+ overallScore += Math.min(2, networth/(100f*1000*1000));
String activePet = Utils.getElementAsString(Utils.getElement(profile.getPetsInfo(null), "active_pet.type"),
"None Active");
@@ -420,7 +429,8 @@ public class NotEnoughUpdates {
SimpleCommand.ProcessCommandRunnable viewProfileRunnable = new SimpleCommand.ProcessCommandRunnable() {
public void processCommand(ICommandSender sender, String[] args) {
- if(new File(Minecraft.getMinecraft().mcDataDir, "optionsof.txt").exists()) {
+ if(Loader.isModLoaded("optifine") &&
+ new File(Minecraft.getMinecraft().mcDataDir, "optionsof.txt").exists()) {
try(InputStream in = new FileInputStream(new File(Minecraft.getMinecraft().mcDataDir, "optionsof.txt"))) {
BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
@@ -453,8 +463,13 @@ public class NotEnoughUpdates {
"Too many arguments. Usage: /neuprofile [name]"));
} else {
profileViewer.getProfileByName(args[0], profile -> {
- if (profile != null) profile.resetCache();
- openGui = new GuiProfileViewer(profile);
+ if(profile == null) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED +
+ "Invalid player name/api key. Maybe api is down? Try /api new."));
+ } else {
+ profile.resetCache();
+ openGui = new GuiProfileViewer(profile);
+ }
});
}
}
@@ -480,7 +495,7 @@ public class NotEnoughUpdates {
SimpleCommand viewProfileShortCommand = new SimpleCommand("pv", new SimpleCommand.ProcessCommandRunnable() {
@Override
public void processCommand(ICommandSender sender, String[] args) {
- if(!hasSkyblockScoreboard()) {
+ if(!isOnSkyblock()) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("/pv " + StringUtils.join(args, " "));
} else {
viewProfileRunnable.processCommand(sender, args);
@@ -506,7 +521,7 @@ public class NotEnoughUpdates {
SimpleCommand viewProfileShort2Command = new SimpleCommand("vp", new SimpleCommand.ProcessCommandRunnable() {
@Override
public void processCommand(ICommandSender sender, String[] args) {
- if(!hasSkyblockScoreboard()) {
+ if(!isOnSkyblock()) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("/vp " + StringUtils.join(args, " "));
} else {
viewProfileRunnable.processCommand(sender, args);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/TradeWindow.java b/src/main/java/io/github/moulberry/notenoughupdates/TradeWindow.java
new file mode 100644
index 00000000..b95acc09
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/TradeWindow.java
@@ -0,0 +1,265 @@
+package io.github.moulberry.notenoughupdates;
+
+import io.github.moulberry.notenoughupdates.util.TexLoc;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.gui.inventory.GuiChest;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.gui.inventory.GuiEditSign;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.inventory.ContainerChest;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntitySign;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.ChatComponentTranslation;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+import java.util.List;
+
+public class TradeWindow {
+
+ private static ResourceLocation location = new ResourceLocation("notenoughupdates", "custom_trade.png");
+
+ private static final int xSize = 176;
+ private static final int ySize = 204;
+ private static int guiLeft;
+ private static int guiTop;
+
+ public static boolean tradeWindowActive() {
+ if(Keyboard.isKeyDown(Keyboard.KEY_J)) return false;
+
+ GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen;
+ if(guiScreen instanceof GuiChest) {
+ GuiChest eventGui = (GuiChest) guiScreen;
+ ContainerChest cc = (ContainerChest) eventGui.inventorySlots;
+ String containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText();
+ if(containerName.trim().startsWith("You ")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static TexLoc tl = new TexLoc(0, 0, Keyboard.KEY_M);
+
+ public static void render(int mouseX, int mouseY) {
+ if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) return;
+
+ GuiContainer chest = ((GuiContainer)Minecraft.getMinecraft().currentScreen);
+ ContainerChest cc = (ContainerChest) chest.inventorySlots;
+ String containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText();
+
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+
+ guiLeft = (scaledResolution.getScaledWidth()-xSize)/2;
+ guiTop = (scaledResolution.getScaledHeight()-ySize)/2;
+
+ List<String> tooltipToDisplay = null;
+ tl.handleKeyboardInput();
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(location);
+ Utils.drawTexturedRect(guiLeft, guiTop, xSize, ySize, 0, 176/256f, 0, 204/256f, GL11.GL_NEAREST);
+
+ Utils.drawTexturedRect(guiLeft+42, guiTop+92, 40, 14,
+ 0, 40/256f, ySize/256f, (ySize+14)/256f, GL11.GL_NEAREST);
+ Utils.drawStringCentered("Confirm", Minecraft.getMinecraft().fontRendererObj, guiLeft+64, guiTop+96,
+ false, 4210752);
+
+ Utils.drawStringF(new ChatComponentTranslation("container.inventory").getUnformattedText(),
+ Minecraft.getMinecraft().fontRendererObj, guiLeft+8, guiTop+111, false, 4210752);
+ Utils.drawStringF("You", Minecraft.getMinecraft().fontRendererObj, guiLeft+8,
+ guiTop+5, false, 4210752);
+ String[] split = containerName.split(" ");
+ if(split.length >= 1) {
+ Utils.drawStringF(split[split.length-1], Minecraft.getMinecraft().fontRendererObj, guiLeft+109,
+ guiTop+5, false, 4210752);
+ }
+
+ int index=0;
+ for(ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) {
+ int x = 8+18*(index % 9);
+ int y = 104+18*(index / 9);
+ if(index < 9) y = 180;
+
+ Utils.drawItemStack(stack, guiLeft+x, guiTop+y);
+
+ if(mouseX > guiLeft+x-1 && mouseX < guiLeft+x+18) {
+ if(mouseY > guiTop+y-1 && mouseY < guiTop+y+18) {
+ if(stack != null) tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer, true);
+
+ GlStateManager.disableLighting();
+ GlStateManager.disableDepth();
+ GlStateManager.colorMask(true, true, true, false);
+ Utils.drawGradientRect(guiLeft+x, guiTop+y,
+ guiLeft+x + 16, guiTop+y + 16, -2130706433, -2130706433);
+ GlStateManager.colorMask(true, true, true, true);
+ GlStateManager.enableLighting();
+ GlStateManager.enableDepth();
+ }
+ }
+
+ index++;
+ }
+
+ for(int i=0; i<16; i++) {
+ int x = i % 4;
+ int y = i / 4;
+ int containerIndex = y*9+x;
+
+ ItemStack stack = chest.inventorySlots.getInventory().get(containerIndex);
+
+ Utils.drawItemStack(stack, guiLeft+10+x*18, guiTop+15+y*18);
+
+ if(mouseX > guiLeft+10+x*18-1 && mouseX < guiLeft+10+x*18+18) {
+ if(mouseY > guiTop+15+y*18-1 && mouseY < guiTop+15+y*18+18) {
+ if(stack != null) tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer, true);
+
+ GlStateManager.disableLighting();
+ GlStateManager.disableDepth();
+ GlStateManager.colorMask(true, true, true, false);
+ Utils.drawGradientRect(guiLeft+10+x*18, guiTop+15+y*18,
+ guiLeft+10+x*18 + 16, guiTop+15+y*18 + 16, -2130706433, -2130706433);
+ GlStateManager.colorMask(true, true, true, true);
+ GlStateManager.enableLighting();
+ GlStateManager.enableDepth();
+ }
+ }
+ }
+
+ ItemStack bidStack = chest.inventorySlots.getInventory().get(36);
+ if(bidStack != null) {
+ Utils.drawItemStack(bidStack, guiLeft+10, guiTop+90);
+ if(mouseX > guiLeft+10-1 && mouseX < guiLeft+10+18) {
+ if(mouseY > guiTop+90-1 && mouseY < guiTop+90+18) {
+ tooltipToDisplay = bidStack.getTooltip(Minecraft.getMinecraft().thePlayer, true);
+ }
+ }
+ }
+
+ ItemStack confirmStack = chest.inventorySlots.getInventory().get(39);
+ if(confirmStack != null) {
+ if(mouseX > guiLeft+42 && mouseX < guiLeft+42+40) {
+ if (mouseY > guiTop+92 && mouseY < guiTop+92+14) {
+ tooltipToDisplay = confirmStack.getTooltip(Minecraft.getMinecraft().thePlayer, true);
+ }
+ }
+ }
+
+ for(int i=0; i<16; i++) {
+ int x = i % 4;
+ int y = i / 4;
+ int containerIndex = y*9+x+5;
+
+ ItemStack stack = chest.inventorySlots.getInventory().get(containerIndex);
+
+ Utils.drawItemStack(stack, guiLeft+96+x*18, guiTop+15+y*18);
+
+ if(mouseX > guiLeft+96+x*18-1 && mouseX < guiLeft+96+x*18+18) {
+ if(mouseY > guiTop+15+y*18-1 && mouseY < guiTop+15+y*18+18) {
+ if(stack != null) tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer, true);
+
+ GlStateManager.disableLighting();
+ GlStateManager.disableDepth();
+ GlStateManager.colorMask(true, true, true, false);
+ Utils.drawGradientRect(guiLeft+96+x*18, guiTop+15+y*18,
+ guiLeft+96+x*18 + 16, guiTop+15+y*18 + 16, -2130706433, -2130706433);
+ GlStateManager.colorMask(true, true, true, true);
+ GlStateManager.enableLighting();
+ GlStateManager.enableDepth();
+ }
+ }
+ }
+
+ if(tooltipToDisplay != null) {
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(),
+ -1, Minecraft.getMinecraft().fontRendererObj);
+ }
+ }
+
+ public static void handleMouseInput() {
+ if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) return;
+
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ int width = scaledResolution.getScaledWidth();
+ int height = scaledResolution.getScaledHeight();
+
+ int mouseX = Mouse.getEventX() * width / Minecraft.getMinecraft().displayWidth;
+ int mouseY = height - Mouse.getEventY() * height / Minecraft.getMinecraft().displayHeight - 1;
+
+ GuiContainer chest = ((GuiContainer)Minecraft.getMinecraft().currentScreen);
+
+ if(Mouse.getEventButtonState() && Mouse.isButtonDown(0)) {
+ int index=0;
+ for(ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) {
+ if(stack == null) {
+ index++;
+ continue;
+ }
+
+ int x = 8+18*(index % 9);
+ int y = 104+18*(index / 9);
+ if(index < 9) y = 180;
+
+ if(mouseX > guiLeft+x && mouseX < guiLeft+x+16) {
+ if(mouseY > guiTop+y && mouseY < guiTop+y+16) {
+ Slot slot = chest.inventorySlots.getSlotFromInventory(Minecraft.getMinecraft().thePlayer.inventory, index);
+ Minecraft.getMinecraft().playerController.windowClick(
+ chest.inventorySlots.windowId,
+ slot.slotNumber, 2, 3, Minecraft.getMinecraft().thePlayer);
+ return;
+ }
+ }
+
+ index++;
+ }
+
+ for(int i=0; i<16; i++) {
+ int x = i % 4;
+ int y = i / 4;
+ int containerIndex = y*9+x;
+
+ if(mouseX > guiLeft+10+x*18-1 && mouseX < guiLeft+10+x*18+18) {
+ if(mouseY > guiTop+15+y*18-1 && mouseY < guiTop+15+y*18+18) {
+ Minecraft.getMinecraft().playerController.windowClick(
+ chest.inventorySlots.windowId,
+ containerIndex, 2, 3, Minecraft.getMinecraft().thePlayer);
+ return;
+ }
+ }
+ }
+
+ if(mouseX > guiLeft+10-1 && mouseX < guiLeft+10+18) {
+ if(mouseY > guiTop+90-1 && mouseY < guiTop+90+18) {
+ Minecraft.getMinecraft().playerController.windowClick(
+ chest.inventorySlots.windowId,
+ 36, 2, 3, Minecraft.getMinecraft().thePlayer);
+ return;
+ }
+ }
+
+ if(mouseX > guiLeft+42 && mouseX < guiLeft+42+40) {
+ if (mouseY > guiTop+92 && mouseY < guiTop+92+14) {
+ Minecraft.getMinecraft().playerController.windowClick(
+ chest.inventorySlots.windowId,
+ 39, 2, 3, Minecraft.getMinecraft().thePlayer);
+ return;
+ }
+ }
+ }
+ }
+
+ public static boolean keyboardInput() {
+ return Keyboard.getEventKey() != Keyboard.KEY_ESCAPE;
+ }
+
+
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
index 14ebdf26..dadcbd3f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
@@ -37,7 +37,7 @@ public class APIManager {
private HashSet<String> playerBidsNotified = new HashSet<>();
private HashSet<String> playerBidsFinishedNotified = new HashSet<>();
- private HashMap<String, TreeMap<Integer, String>> internalnameToLowestBIN = new HashMap<>();
+ private HashMap<String, TreeMap<Integer, Set<String>>> internalnameToLowestBIN = new HashMap<>();
private LinkedList<Integer> pagesToDownload = null;
@@ -218,7 +218,7 @@ public class APIManager {
}
public int getLowestBin(String internalname) {
- TreeMap<Integer, String> lowestBIN = internalnameToLowestBIN.get(internalname);
+ TreeMap<Integer, Set<String>> lowestBIN = internalnameToLowestBIN.get(internalname);
if(lowestBIN == null || lowestBIN.isEmpty()) return -1;
return lowestBIN.firstKey();
}
@@ -294,8 +294,13 @@ public class APIManager {
for(HashSet<String> aucids : internalnameToAucIdMap.values()) {
aucids.removeAll(toRemove);
}
- for(TreeMap<Integer, String> lowestBINs : internalnameToLowestBIN.values()) {
- lowestBINs.values().removeAll(toRemove);
+ for(TreeMap<Integer, Set<String>> lowestBINs : internalnameToLowestBIN.values()) {
+ Set<Integer> toRemoveSet = new HashSet<>();
+ for(Map.Entry<Integer, Set<String>> entry : lowestBINs.entrySet()) {
+ entry.getValue().removeAll(toRemove);
+ if(entry.getValue().isEmpty()) toRemoveSet.add(entry.getKey());
+ }
+ lowestBINs.keySet().removeAll(toRemoveSet);
}
}
@@ -494,10 +499,11 @@ public class APIManager {
}
if(bin) {
- TreeMap<Integer, String> lowestBINs = internalnameToLowestBIN.computeIfAbsent(internalname, k -> new TreeMap<>());
+ TreeMap<Integer, Set<String>> lowestBINs = internalnameToLowestBIN.computeIfAbsent(internalname, k -> new TreeMap<>());
int count = item_tag.getInteger("Count");
- lowestBINs.put(starting_bid/(count>0?count:1), auctionUuid);
- if(lowestBINs.size() > 5) {
+ int price = starting_bid/(count>0?count:1);
+ lowestBINs.computeIfAbsent(price, k -> new HashSet<>()).add(auctionUuid);
+ if(lowestBINs.size() > 10) {
lowestBINs.keySet().remove(lowestBINs.lastKey());
}
}
@@ -696,7 +702,7 @@ public class APIManager {
JsonObject auctionInfo = getItemAuctionInfo(internalname);
JsonObject bazaarInfo = getBazaarInfo(internalname);
- if(bazaarInfo != null) {
+ if(bazaarInfo != null && bazaarInfo.get("curr_buy") != null) {
float bazaarInstantBuyPrice = bazaarInfo.get("curr_buy").getAsFloat();
ci.craftCost = bazaarInstantBuyPrice;
}
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 728e692a..98907029 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java
@@ -32,8 +32,8 @@ public class CapeManager {
private boolean allAvailable = false;
private HashSet<String> availableCapes = new HashSet<>();
- private String[] capes = new String[]{"patreon1", "patreon2", "fade", "contrib", "nullzee", "gravy", "space" };
- public Boolean[] specialCapes = new Boolean[]{ true, true, false, true, true, true, false };
+ private String[] capes = new String[]{"patreon1", "patreon2", "fade", "contrib", "nullzee", "gravy", "space", "mcworld" };
+ public Boolean[] specialCapes = new Boolean[]{ true, true, false, true, true, true, false, false };
public static CapeManager getInstance() {
return INSTANCE;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeNode.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeNode.java
index 1f1876af..bfd33e48 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeNode.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeNode.java
@@ -160,8 +160,6 @@ public class CapeNode {
}
public void resolve(CapeNode other, float targetDist, float strength, boolean opt) {
- if(other == null || Keyboard.isKeyDown(Keyboard.KEY_H)) return;
-
double dX = position.x - other.position.x;
double dY = position.y - other.position.y;
double dZ = position.z - other.position.z;
@@ -209,7 +207,7 @@ public class CapeNode {
NEUCape.Offset o = new NEUCape.Offset(d, 1);
CapeNode neighbor = getNeighbor(o);
if(neighbor != null) {
- if(!Keyboard.isKeyDown(Keyboard.KEY_H))resolve(neighbor, 1f*NEUCape.targetDist*(d.yOff==0?horzDistMult:1f), 0.5f*7.5f, opt);
+ resolve(neighbor, 1f*NEUCape.targetDist*(d.yOff==0?horzDistMult:1f), 0.5f*7.5f, opt);
}
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java
index f9c4995e..6712f34f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java
@@ -64,8 +64,6 @@ public class GuiCosmetics extends GuiScreen {
public static final ResourceLocation cosmetics_fg = new ResourceLocation("notenoughupdates:cosmetics_fg.png");
public static final ResourceLocation pv_elements = new ResourceLocation("notenoughupdates:pv_elements.png");
- private static final NumberFormat numberFormat = NumberFormat.getInstance(Locale.US);
-
private CosmeticsPage currentPage = CosmeticsPage.CAPES;
private int sizeX;
private int sizeY;</