aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorMoulberry <james.jenour@student.scotch.wa.edu.au>2020-07-26 12:12:25 +1000
committerMoulberry <james.jenour@student.scotch.wa.edu.au>2020-07-26 12:12:25 +1000
commitf0293a74282cece3aa8a2a328559889d6e187209 (patch)
treee4bb3d101b8b7e70a58f521a41a44071bb6cc0fa /src/main/java/io
parent16b89f752b83aa91f1697238d785eb97a4f01f61 (diff)
downloadNotEnoughUpdates-f0293a74282cece3aa8a2a328559889d6e187209.tar.gz
NotEnoughUpdates-f0293a74282cece3aa8a2a328559889d6e187209.tar.bz2
NotEnoughUpdates-f0293a74282cece3aa8a2a328559889d6e187209.zip
1.11.7
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/GuiEnchantColour.java222
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/ItemRarityHalo.java251
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java19
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java166
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java20
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java20
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java17
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java49
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryEffectRenderer.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java53
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/Options.java29
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java1253
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/Panorama.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java37
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java472
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/questing/SBScoreboardData.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java127
20 files changed, 2446 insertions, 322 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java b/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java
index 4328eaf4..58eaab72 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java
@@ -48,6 +48,14 @@ public class CustomItems {
"incursions on the server, some of which I, a player on this Minecraft",
"anarchy server in Minecraft, have participated in. One of this server's",
"most infamous Minecraft players on the oldest Minecraft");
+ public static JsonObject LEOCTHL = create("LEOCTHL", "dragon_egg", "--- Stats below may not be entirely accurate ---",
+ "17 legendary dragon pets",
+ "24 epic dragon pets",
+ "18 epic golem pets",
+ "12 legendary golem pets",
+ "39 legendary phoenix pets",
+ "",
+ "get flexed");
/**
* SHAAAAAAAAAAAAAAAAAAME
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/GuiEnchantColour.java b/src/main/java/io/github/moulberry/notenoughupdates/GuiEnchantColour.java
new file mode 100644
index 00000000..98b08fd8
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/GuiEnchantColour.java
@@ -0,0 +1,222 @@
+package io.github.moulberry.notenoughupdates;
+
+import com.google.common.base.Splitter;
+import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.opengl.GL11;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class GuiEnchantColour extends GuiScreen {
+
+ public static final ResourceLocation custom_ench_colour = new ResourceLocation("notenoughupdates:custom_ench_colour.png");
+
+ private int guiLeft;
+ private int guiTop;
+ private final int xSize = 176;
+ private int ySize = 0;
+
+ private List<String> getEnchantColours() {
+ return NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value;
+ }
+
+ public static final Splitter splitter = Splitter.on(":").limit(4);
+
+ private HashMap<Integer, String> comparators = new HashMap<>();
+ private List<GuiElementTextField[]> guiElementTextFields = new ArrayList<>();
+
+ @Override
+ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
+ List<String> enchantColours = getEnchantColours();
+
+ ySize = 53+25*enchantColours.size();
+ guiLeft = (width-xSize)/2;
+ guiTop = (height-ySize)/2;
+
+ NotEnoughUpdates.INSTANCE.manager.loadConfig();
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour);
+ Utils.drawTexturedRect(guiLeft, guiTop, xSize, 21, 0, 1, 0, 21/78f, GL11.GL_NEAREST);
+ Utils.drawTexturedRect(guiLeft, guiTop+ySize-32, xSize, 32, 0, 1, 46/78f, 1, GL11.GL_NEAREST);
+
+ fontRendererObj.drawString("Ench Name", guiLeft+10, guiTop+7, 4210752);
+ fontRendererObj.drawString("CMP", guiLeft+71, guiTop+7, 4210752);
+ fontRendererObj.drawString("LVL", guiLeft+96, guiTop+7, 4210752);
+ fontRendererObj.drawString("COL", guiLeft+121, guiTop+7, 4210752);
+ fontRendererObj.drawString("DEL", guiLeft+146, guiTop+7, 4210752);
+
+ Utils.drawStringCentered("Add Ench Colour", fontRendererObj, guiLeft+xSize/2, guiTop+ySize-20, false, 4210752);
+
+ int yIndex = 0;
+ for(String str : enchantColours) {
+ Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour);
+ GlStateManager.color(1, 1, 1, 1);
+ Utils.drawTexturedRect(guiLeft, guiTop+21+yIndex*25, xSize, 25, 0, 1, 21/78f, 46/78f, GL11.GL_NEAREST);
+
+ List<String> colourOps = splitter.splitToList(str);
+ String enchantName = getColourOpIndex(colourOps, 0);
+ String comparator = getColourOpIndex(colourOps, 1);
+ String comparison = getColourOpIndex(colourOps, 2);
+ String colourCode = getColourOpIndex(colourOps, 3);
+
+ if(colourCode.length() > 1) colourCode = String.valueOf(colourCode.toLowerCase().charAt(0));
+ if(comparator.length() > 1) comparator = String.valueOf(comparator.toLowerCase().charAt(0));
+
+ Utils.drawStringCentered(comparator, fontRendererObj, guiLeft+81, guiTop+33+25*yIndex, false, 4210752);
+
+ if(guiElementTextFields.size() <= yIndex) {
+ guiElementTextFields.add(new GuiElementTextField[3]);
+ }
+ if(guiElementTextFields.get(yIndex)[0] == null) {
+ guiElementTextFields.get(yIndex)[0] = new GuiElementTextField(enchantName, GuiElementTextField.SCALE_TEXT);
+ guiElementTextFields.get(yIndex)[0].setSize(56, 20);
+ }
+ if(guiElementTextFields.get(yIndex)[1] == null) {
+ guiElementTextFields.get(yIndex)[1] = new GuiElementTextField(comparison,
+ GuiElementTextField.SCALE_TEXT|GuiElementTextField.NUM_ONLY|GuiElementTextField.NO_SPACE);
+ guiElementTextFields.get(yIndex)[1].setSize(20, 20);
+ }
+ if(guiElementTextFields.get(yIndex)[2] == null) {
+ guiElementTextFields.get(yIndex)[2] = new GuiElementTextField(colourCode, GuiElementTextField.SCALE_TEXT);
+ guiElementTextFields.get(yIndex)[2].setSize(20, 20);
+ }
+ guiElementTextFields.get(yIndex)[0].setText(enchantName);
+ guiElementTextFields.get(yIndex)[1].setText(comparison);
+ comparators.put(yIndex, comparator);
+ guiElementTextFields.get(yIndex)[2].setText(colourCode);
+
+ guiElementTextFields.get(yIndex)[0].render(guiLeft+10, guiTop+23+25*yIndex);
+ guiElementTextFields.get(yIndex)[1].render(guiLeft+96, guiTop+23+25*yIndex);
+ guiElementTextFields.get(yIndex)[2].render(guiLeft+121, guiTop+23+25*yIndex);
+
+ yIndex++;
+ }
+ }
+
+ @Override
+ protected void keyTyped(char typedChar, int keyCode) throws IOException {
+ super.keyTyped(typedChar, keyCode);
+ for(int yIndex=0; yIndex<guiElementTextFields.size(); yIndex++) {
+ for(int i=0; i<3; i++) {
+ guiElementTextFields.get(yIndex)[i].keyTyped(typedChar, keyCode);
+ if(guiElementTextFields.get(yIndex)[i].getFocus()) {
+ int addOffset = 0;
+ if(keyCode == Keyboard.KEY_UP) {
+ addOffset -= 1;
+ } else if(keyCode == Keyboard.KEY_DOWN) {
+ addOffset += 1;
+ }
+
+ NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.remove(yIndex);
+ if(yIndex+addOffset < 0) {
+ addOffset = -yIndex;
+ } else if(yIndex+addOffset > NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.size()) {
+ addOffset = NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.size()-yIndex;
+ }
+ System.out.println(addOffset);
+ NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.add(yIndex+addOffset,
+ getEnchantOpString(guiElementTextFields.get(yIndex), comparators.get(yIndex)));
+ NotEnoughUpdates.INSTANCE.manager.saveConfig();
+ if(addOffset != 0) {
+ GuiElementTextField[] guiElementTextFieldArray = guiElementTextFields.remove(yIndex);
+ guiElementTextFields.add(yIndex+addOffset, guiElementTextFieldArray);
+ }
+ return;
+ }
+ }
+ }
+ }
+
+ public String getEnchantOpString(GuiElementTextField[] tfs, String comparator) {
+ StringBuilder enchantOp = new StringBuilder();
+ enchantOp.append(tfs[0].getText());
+ enchantOp.append(":");
+ enchantOp.append(comparator);
+ enchantOp.append(":");
+ enchantOp.append(tfs[1].getText());
+ enchantOp.append(":");
+ enchantOp.append(tfs[2].getText());
+ return enchantOp.toString();
+ }
+
+ @Override
+ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
+ super.mouseClicked(mouseX, mouseY, mouseButton);
+ for(int yIndex=0; yIndex<guiElementTextFields.size(); yIndex++) {
+ for(int i=0; i<3; i++) {
+ int x = guiLeft+10;
+ if(i == 1) x+=86;
+ else if(i == 2) x+=111;
+
+ if(mouseX > x && mouseX < x+guiElementTextFields.get(yIndex)[i].getWidth()) {
+ if(mouseY > guiTop+23+25*yIndex && mouseY < guiTop+23+25*yIndex+20) {
+ guiElementTextFields.get(yIndex)[i].mouseClicked(mouseX, mouseY, mouseButton);
+ if(mouseButton == 1) {
+ NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.remove(yIndex);
+ NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.add(yIndex,
+ getEnchantOpString(guiElementTextFields.get(yIndex), comparators.get(yIndex)));
+ NotEnoughUpdates.INSTANCE.manager.saveConfig();
+ }
+ continue;
+ }
+ }
+ guiElementTextFields.get(yIndex)[i].otherComponentClick();
+ }
+ comparators.computeIfAbsent(yIndex, k->">");
+ if(mouseY > guiTop+23+25*yIndex && mouseY < guiTop+23+25*yIndex+20) {
+ if(mouseX > guiLeft+71 && mouseX < guiLeft+71+20) {
+ switch (comparators.get(yIndex)) {
+ case ">":
+ comparators.put(yIndex, "="); break;
+ case "=":
+ comparators.put(yIndex, "<"); break;
+ default:
+ comparators.put(yIndex, ">"); break;
+ }
+ NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.remove(yIndex);
+ NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.add(yIndex,
+ getEnchantOpString(guiElementTextFields.get(yIndex), comparators.get(yIndex)));
+ NotEnoughUpdates.INSTANCE.manager.saveConfig();
+ } else if(mouseX > guiLeft+146 && mouseX < guiLeft+146+20) {
+ NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.remove(yIndex);
+ guiElementTextFields.remove(yIndex);
+ comparators.remove(yIndex);
+ NotEnoughUpdates.INSTANCE.manager.saveConfig();
+ }
+ }
+ }
+ if(mouseX >= guiLeft+42 && mouseX <= guiLeft+42+88) {
+ if(mouseY >= guiTop+ySize-30 && mouseY <= guiTop+ySize-10) {
+ NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.add("[a-zA-Z ]+:>:5:9");
+ NotEnoughUpdates.INSTANCE.manager.saveConfig();
+ }
+ }
+ }
+
+ public static String getColourOpIndex(List<String> colourOps, int index) {
+ if(colourOps.size() > index) {
+ return colourOps.get(index);
+ } else {
+ switch(index) {
+ case 0:
+ return "[a-zA-Z ]+";
+ case 1:
+ return ">";
+ case 2:
+ return "5";
+ case 3:
+ return "9";
+ }
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemRarityHalo.java b/src/main/java/io/github/moulberry/notenoughupdates/ItemRarityHalo.java
new file mode 100644
index 00000000..2c70ec1e
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/ItemRarityHalo.java
@@ -0,0 +1,251 @@
+package io.github.moulberry.notenoughupdates;
+
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.*;
+import net.minecraft.client.renderer.entity.RenderItem;
+import net.minecraft.client.renderer.texture.TextureUtil;
+import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
+import net.minecraft.client.shader.Framebuffer;
+import net.minecraft.client.shader.Shader;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.Matrix4f;
+import org.lwjgl.BufferUtils;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL14;
+import org.lwjgl.opengl.GL30;
+import org.lwjgl.opengl.GL45;
+
+import java.awt.*;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+import java.util.HashMap;
+
+public class ItemRarityHalo {
+
+ public static Framebuffer itemFramebuffer1 = null;
+ public static Framebuffer itemFramebuffer2 = null;
+ public static HashMap<ItemStack, Integer> itemHaloTexMap = new HashMap<>();
+ public static Matrix4f projectionMatrix = null;
+
+ public static Shader colourShader = null;
+ public static Shader blurShaderHorz = null;
+ public static Shader blurShaderVert = null;
+
+ private static int oldScaledResolution = 0;
+
+ public static void onItemRender(ItemStack stack, int x, int y) {
+ if(x == 0 && y == 0) return;
+
+ if(!OpenGlHelper.isFramebufferEnabled() || !OpenGlHelper.areShadersSupported()) return;
+ NotEnoughUpdates neu = NotEnoughUpdates.INSTANCE;
+ if(!neu.isOnSkyblock()) return;
+ if(neu.manager.config.itemHighlightOpacity.value <= 1) return;
+ if(neu.manager.getInternalNameForItem(stack) == null) return;
+
+ ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
+ int size = 16*scaledresolution.getScaleFactor();
+
+ if(projectionMatrix == null) {
+ projectionMatrix = Utils.createProjectionMatrix(size, size);
+ }
+
+ itemFramebuffer1 = checkFramebufferSizes(itemFramebuffer1, size, size);
+ itemFramebuffer2 = checkFramebufferSizes(itemFramebuffer2, size, size);
+
+ try {
+ if(colourShader == null) {
+ colourShader = new Shader(new NEUResourceManager(Minecraft.getMinecraft().getResourceManager()),
+ "setrgbtoalpha", itemFramebuffer1, itemFramebuffer2);
+ upload(colourShader, size, size);
+ }
+
+ if(blurShaderHorz == null) {
+ blurShaderHorz = new Shader(new NEUResourceManager(Minecraft.getMinecraft().getResourceManager()),
+ "blur", itemFramebuffer2, itemFramebuffer1);
+ blurShaderHorz.getShaderManager().getShaderUniform("BlurDir").set(1, 0);
+ blurShaderHorz.getShaderManager().getShaderUniform("Radius").set(5f);
+ blurShaderHorz.getShaderManager().getShaderUniform("AlphaMult").set(2f);
+ upload(blurShaderHorz, size, size);
+ }
+
+ if(blurShaderVert == null) {
+ blurShaderVert = new Shader(new NEUResourceManager(Minecraft.getMinecraft().getResourceManager()),
+ "blur", itemFramebuffer1, itemFramebuffer2);
+ blurShaderVert.getShaderManager().getShaderUniform("BlurDir").set(0, 1);
+ blurShaderVert.getShaderManager().getShaderUniform("Radius").set(5f);
+ blurShaderVert.getShaderManager().getShaderUniform("AlphaMult").set(2f);
+ upload(blurShaderVert, size, size);
+ }
+ } catch(Exception e) { return; }
+
+ if(oldScaledResolution != scaledresolution.getScaleFactor()) {
+ resetItemHaloCache();
+ oldScaledResolution = scaledresolution.getScaleFactor();
+ }
+
+ int currentBuffer = GL11.glGetInteger(GL30.GL_FRAMEBUFFER_BINDING);
+ IntBuffer currentViewport = BufferUtils.createIntBuffer(16);
+ GL11.glGetInteger(GL11.GL_VIEWPORT, currentViewport);
+ try {
+ if(!itemHaloTexMap.containsKey(stack)) {
+ int texture1 = TextureUtil.glGenTextures();
+ int texture2 = TextureUtil.glGenTextures();
+
+ GlStateManager.bindTexture(texture1);
+ GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, size, size, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, ((ByteBuffer)null));
+ itemFramebuffer1.bindFramebuffer(false);
+ OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, 3553, texture1, 0);
+
+ GlStateManager.bindTexture(texture2);
+ GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, size, size, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, ((ByteBuffer)null));
+ itemFramebuffer2.bindFramebuffer(false);
+ OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, 3553, texture2, 0);
+
+ itemFramebuffer1.framebufferClear();
+ itemFramebuffer2.framebufferClear();
+
+ GlStateManager.pushMatrix(); {
+ GlStateManager.matrixMode(5889);
+ GlStateManager.loadIdentity();
+ GlStateManager.ortho(0.0D, size, size, 0.0D, 1000.0D, 3000.0D);
+ GlStateManager.matrixMode(5888);
+ GlStateManager.loadIdentity();
+ GlStateManager.translate(0.0F, 0.0F, -2000.0F);
+
+ GL11.glScalef(scaledresolution.getScaleFactor(), scaledresolution.getScaleFactor(), 1);
+
+ itemFramebuffer1.bindFramebuffer(true);
+
+ RenderItem itemRender = Minecraft.getMinecraft().getRenderItem();
+ RenderHelper.enableGUIStandardItemLighting();
+ float zLevel = itemRender.zLevel;
+ itemRender.zLevel = -145; //Negates the z-offset of the below method.
+ itemRender.renderItemAndEffectIntoGUI(stack, 0, 0);
+ itemRender.zLevel = zLevel;
+ RenderHelper.disableStandardItemLighting();
+ } GlStateManager.popMatrix();
+
+ GlStateManager.pushMatrix(); {
+ GL45.glTextureBarrier(); GL11.glFlush(); GL11.glFinish();
+ executeShader(colourShader);
+ //GL45.glTextureBarrier(); GL11.glFlush(); GL11.glFinish();
+ //executeShader(blurShaderHorz);
+ //GL45.glTextureBarrier(); GL11.glFlush(); GL11.glFinish();
+ //executeShader(blurShaderVert);
+ //GL45.glTextureBarrier(); GL11.glFlush(); GL11.glFinish();
+ } GlStateManager.popMatrix();
+
+ GlStateManager.matrixMode(5889);
+ GlStateManager.loadIdentity();
+ GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
+ GlStateManager.matrixMode(5888);
+
+ OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, currentBuffer);
+ GlStateManager.viewport(currentViewport.get(), currentViewport.get(), currentViewport.get(), currentViewport.get());
+
+ //TextureUtil.deleteTexture(texture1);
+ itemHaloTexMap.put(stack, texture2);
+ }
+
+ OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, currentBuffer);
+ GlStateManager.viewport(currentViewport.get(), currentViewport.get(), currentViewport.get(), currentViewport.get());
+
+ GlStateManager.bindTexture(itemHaloTexMap.get(stack));
+ Color color = Utils.getPrimaryColour(stack.getDisplayName());
+ GlStateManager.color(color.getRed()/255f, color.getGreen()/255f, color.getBlue()/255f,
+ NotEnoughUpdates.INSTANCE.manager.config.itemHighlightOpacity.value.floatValue()/255f);
+ Utils.drawTexturedRect(x, y, 16, 16,
+ 0, 1, 1, 0, GL11.GL_NEAREST);
+ GlStateManager.bindTexture(0);
+ } catch(Exception e) {
+ e.printStackTrace();
+ OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, currentBuffer);
+ GlStateManager.viewport(currentViewport.get(), currentViewport.get(), currentViewport.get(), currentViewport.get());
+ }
+ }
+
+ private static Framebuffer checkFramebufferSizes(Framebuffer framebuffer, int width, int height) {
+ if(framebuffer == null || framebuffer.framebufferWidth != width || framebuffer.framebufferHeight != height) {
+ if(framebuffer == null) {
+ framebuffer = new Framebuffer(width, height, true);
+ } else {
+ framebuffer.createBindFramebuffer(width, height);
+ }
+ framebuffer.setFramebufferFilter(GL11.GL_NEAREST);
+ }
+ return framebuffer;
+ }
+
+ public static void resetItemHaloCache() {
+ ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
+ int size = 16*scaledresolution.getScaleFactor();
+
+ for(int tex : itemHaloTexMap.values()) {
+ TextureUtil.deleteTexture(tex);
+ }
+ itemHaloTexMap.clear();
+
+ if(NotEnoughUpdates.INSTANCE.isOnSkyblock()) {
+ projectionMatrix = Utils.createProjectionMatrix(size, size);
+ upload(colourShader, size, size);
+ upload(blurShaderHorz, size, size);
+ upload(blurShaderVert, size, size);
+ }
+ }
+
+ private static void upload(Shader shader, int width, int height) {
+ if(shader == null) return;
+ shader.getShaderManager().getShaderUniformOrDefault("ProjMat").set(projectionMatrix);
+ shader.getShaderManager().getShaderUniformOrDefault("InSize").set(width, height);
+ shader.getShaderManager().getShaderUniformOrDefault("OutSize").set(width, height);
+ shader.getShaderManager().getShaderUniformOrDefault("ScreenSize").set((float)width, (float)height);
+ }
+
+ private static void executeShader(Shader shader) {
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+ GlStateManager.disableBlend();
+ GlStateManager.disableDepth();
+ GlStateManager.disableAlpha();
+ GlStateManager.disableFog();
+ GlStateManager.disableLighting();
+ GlStateManager.disableColorMaterial();
+ GlStateManager.enableTexture2D();
+ GlStateManager.bindTexture(0);
+
+ float f = (float)shader.framebufferOut.framebufferTextureWidth;
+ float f1 = (float)shader.framebufferOut.framebufferTextureHeight;
+ GlStateManager.viewport(0, 0, (int)f, (int)f1);
+
+ shader.getShaderManager().useShader();
+ shader.getShaderManager().addSamplerTexture("DiffuseSampler", shader.framebufferIn);
+
+ shader.framebufferOut.framebufferClear();
+ shader.framebufferOut.bindFramebuffer(false);
+
+ GlStateManager.depthMask(false);
+
+ GlStateManager.enableAlpha();
+ GlStateManager.enableBlend();
+ GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
+
+ Tessellator tessellator = Tessellator.getInstance();
+ WorldRenderer worldrenderer = tessellator.getWorldRenderer();
+ worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
+ worldrenderer.pos(0.0D, (double)f1, 500.0D).color(255, 255, 255, 255).endVertex();
+ worldrenderer.pos((double)f, (double)f1, 500.0D).color(255, 255, 255, 255).endVertex();
+ worldrenderer.pos((double)f, 0.0D, 500.0D).color(255, 255, 255, 255).endVertex();
+ worldrenderer.pos(0.0D, 0.0D, 500.0D).color(255, 255, 255, 255).endVertex();
+ tessellator.draw();
+
+ GlStateManager.depthMask(true);
+
+ shader.getShaderManager().endShader();
+
+ shader.framebufferOut.unbindFramebuffer();
+ shader.framebufferIn.unbindFramebufferTexture();
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
index b879c383..680094af 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
@@ -23,6 +23,8 @@ import java.io.*;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.*;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
import java.util.zip.GZIPInputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -226,24 +228,29 @@ public class NEUManager {
/**
* Downloads and sets auctionPricesJson from the URL specified by AUCTIONS_PRICE_URL.
*/
+ private ExecutorService es = Executors.newCachedThreadPool();
public void updatePrices() {
if(System.currentTimeMillis() - auctionLastUpdate > 1000*60*120) { //2 hours
craftCost.clear();
System.out.println("[NEU] UPDATING PRICE INFORMATION");
auctionLastUpdate = System.currentTimeMillis();
- try(Reader inReader = new InputStreamReader(new GZIPInputStream(new URL(AUCTIONS_PRICE_URL).openStream()))) {
- auctionPricesJson = gson.fromJson(inReader, JsonObject.class);
- } catch (IOException e) {
- e.printStackTrace();
- }
+ es.submit(() -> {
+ try(Reader inReader = new InputStreamReader(new GZIPInputStream(new URL(AUCTIONS_PRICE_URL).openStream()))) {
+ auctionPricesJson = gson.fromJson(inReader, JsonObject.class);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ });
}
}
public boolean hasAuctionInfo(String internalname) {
+ if(auctionPricesJson == null) return false;
return auctionPricesJson.has("item_data") && auctionPricesJson.get("item_data").getAsJsonObject().has(internalname);
}
public boolean hasBazaarInfo(String internalname) {
+ if(auctionPricesJson == null) return false;
return auctionPricesJson.has("bazaar") && auctionPricesJson.get("bazaar").getAsJsonObject().has(internalname);
}
@@ -276,7 +283,7 @@ public class NEUManager {
if(info == null || !info.has("price")) {
return 0;
}
- if(!auctionPricesJson.has("ench_prices") || !auctionPricesJson.has("ench_maximums")) {
+ if(auctionPricesJson == null || !auctionPricesJson.has("ench_prices") || !auctionPricesJson.has("ench_maximums")) {
return 0;
}
JsonObject ench_prices = auctionPricesJson.getAsJsonObject("ench_prices");
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index 25b27cc5..7db8875d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -1053,7 +1053,7 @@ public class NEUOverlay extends Gui {
} else if(getSortMode() == SORT_MODE_MOB) {
return internalname.matches(mobRegex);
} else if(getSortMode() == SORT_MODE_PET) {
- return internalname.matches(petRegex);
+ return internalname.matches(petRegex) && item.get("displayname").getAsString().contains("[");
} else if(getSortMode() == SORT_MODE_TOOL) {
return checkItemType(item.get("lore").getAsJsonArray(),
"SWORD", "BOW", "AXE", "PICKAXE", "FISHING ROD", "WAND", "SHOVEL", "HOE") >= 0;
@@ -1099,6 +1099,9 @@ public class NEUOverlay extends Gui {
case "thirtyvirus":
searchedItems.add(manager.getItemInformation().get("SPIKED_BAIT"));
break;
+ case "leocthl":