aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorBuildTools <james.jenour@protonmail.com>2021-02-01 05:29:17 +0800
committerBuildTools <james.jenour@protonmail.com>2021-02-01 05:29:17 +0800
commit5ea3130efceca3148334a613471cec7f22acdf8c (patch)
tree7266507b4b4319719ffe78ee95582d6756329916 /src/main/java/io
parent3290259e39e9816fd92afa85710de01a6ddfa3b9 (diff)
downloadNotEnoughUpdates-5ea3130efceca3148334a613471cec7f22acdf8c.tar.gz
NotEnoughUpdates-5ea3130efceca3148334a613471cec7f22acdf8c.tar.bz2
NotEnoughUpdates-5ea3130efceca3148334a613471cec7f22acdf8c.zip
PRE13.3
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java123
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorDraggableList.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java268
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/ConfigProcessor.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/infopanes/InfoPane.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesTextures.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinPlayerControllerMP.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java22
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingOverlay.java28
15 files changed, 430 insertions, 65 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index 8a842558..9d619c78 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -4,6 +4,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.auction.CustomAHGui;
+import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.cosmetics.CapeManager;
import io.github.moulberry.notenoughupdates.dungeons.DungeonBlocks;
@@ -212,6 +213,7 @@ public class NEUEventListener {
MiningStuff.tick();
ProfileApiSyncer.getInstance().tick();
DamageCommas.tick();
+ BackgroundBlur.tick();
for(TextOverlay overlay : textOverlays) {
overlay.tick();
}
@@ -322,8 +324,6 @@ public class NEUEventListener {
}
}
-
-
/*if(longUpdate && neu.hasSkyblockScoreboard()) {
if(neu.manager.getCurrentProfile() == null || neu.manager.getCurrentProfile().length() == 0) {
ProfileViewer.Profile profile = NotEnoughUpdates.profileViewer.getProfile(Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", ""),
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index 592ed628..7a43235a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -1729,7 +1729,8 @@ public class NEUOverlay extends Gui {
//Atomic reference used so that below lambda doesn't complain about non-effectively-final variable
AtomicReference<JsonObject> tooltipToDisplay = new AtomicReference<>(null);
if(itemPaneOffsetFactor.getValue() < 1) {
- BackgroundBlur.renderBlurredBackground(width, height,
+ BackgroundBlur.renderBlurredBackground(NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor,
+ width, height,
leftSide+getBoxPadding()-5, getBoxPadding()-5,
paneWidth-getBoxPadding()*2+10, height-getBoxPadding()*2+10);
Gui.drawRect(leftSide+getBoxPadding()-5, getBoxPadding()-5,
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java b/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java
index 85b442a9..756a3a0e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java
@@ -1,5 +1,6 @@
package io.github.moulberry.notenoughupdates.core;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
@@ -18,8 +19,17 @@ import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL30;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
public class BackgroundBlur {
+ private static HashMap<Integer, Framebuffer> blurOutput = new HashMap<>();
+ private static HashMap<Integer, Long> lastBlurUse = new HashMap<>();
+ private static HashSet<Integer> requestedBlurs = new HashSet<>();
+
private static int fogColour = 0;
private static boolean registered = false;
public static void registerListener() {
@@ -29,10 +39,9 @@ public class BackgroundBlur {
}
}
- private boolean shouldBlur = true;
+ private static boolean shouldBlur = true;
- @SubscribeEvent
- public void onTick(TickEvent.ClientTickEvent event) {
+ public static void tick() {
if(Minecraft.getMinecraft().theWorld != null) {
shouldBlur = true;
}
@@ -42,7 +51,38 @@ public class BackgroundBlur {
public void onScreenRender(RenderGameOverlayEvent.Pre event) {
if(shouldBlur && event.type == RenderGameOverlayEvent.ElementType.ALL) {
shouldBlur = false;
- blurBackground();
+
+ long currentTime = System.currentTimeMillis();
+
+ for(int blur : requestedBlurs) {
+ lastBlurUse.put(blur, currentTime);
+
+ int width = Minecraft.getMinecraft().displayWidth;
+ int height = Minecraft.getMinecraft().displayHeight;
+
+ Framebuffer output = blurOutput.computeIfAbsent(blur, k -> {
+ Framebuffer fb = new Framebuffer(width, height, false);
+ fb.setFramebufferFilter(GL11.GL_NEAREST);
+ return fb;
+ });
+
+ output.framebufferWidth = output.framebufferTextureWidth = width;
+ output.framebufferHeight = output.framebufferTextureHeight = height;
+
+ blurBackground(output, blur);
+ }
+
+ Set<Integer> remove = new HashSet<>();
+ for(Map.Entry<Integer, Long> entry : lastBlurUse.entrySet()) {
+ if(currentTime - entry.getValue() > 30*1000) {
+ remove.add(entry.getKey());
+ }
+ }
+ remove.remove(NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor);
+
+ blurOutput.keySet().removeAll(remove);
+
+ requestedBlurs.clear();
}
}
@@ -55,9 +95,8 @@ public class BackgroundBlur {
}
private static Shader blurShaderHorz = null;
- private static Framebuffer blurOutputHorz = null;
private static Shader blurShaderVert = null;
- private static Framebuffer blurOutputVert = null;
+ private static Framebuffer blurOutputHorz = null;
/**
* Creates a projection matrix that projects from our coordinate space [0->width; 0->height] to OpenGL coordinate
@@ -80,7 +119,7 @@ public class BackgroundBlur {
}
private static double lastBgBlurFactor = -1;
- private static void blurBackground() {
+ private static void blurBackground(Framebuffer output, int blurFactor) {
if(!OpenGlHelper.isFramebufferEnabled() || !OpenGlHelper.areShadersSupported()) return;
int width = Minecraft.getMinecraft().displayWidth;
@@ -97,11 +136,7 @@ public class BackgroundBlur {
blurOutputHorz = new Framebuffer(width, height, false);
blurOutputHorz.setFramebufferFilter(GL11.GL_NEAREST);
}
- if(blurOutputVert == null) {
- blurOutputVert = new Framebuffer(width, height, false);
- blurOutputVert.setFramebufferFilter(GL11.GL_NEAREST);
- }
- if(blurOutputHorz == null || blurOutputVert == null) {
+ if(blurOutputHorz == null || output == null) {
return;
}
if(blurOutputHorz.framebufferWidth != width || blurOutputHorz.framebufferHeight != height) {
@@ -109,44 +144,38 @@ public class BackgroundBlur {
blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height));
Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
}
- if(blurOutputVert.framebufferWidth != width || blurOutputVert.framebufferHeight != height) {
- blurOutputVert.createBindFramebuffer(width, height);
- blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height));
- Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
- }
- if(blurShaderHorz == null) {
- try {
- blurShaderHorz = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur",
- blurOutputVert, blurOutputHorz);
- blurShaderHorz.getShaderManager().getShaderUniform("BlurDir").set(1, 0);
- blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height));
- } catch(Exception e) { }
- }
- if(blurShaderVert == null) {
- try {
- blurShaderVert = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur",
- blurOutputHorz, blurOutputVert);
- blurShaderVert.getShaderManager().getShaderUniform("BlurDir").set(0, 1);
- blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height));
- } catch(Exception e) { }
- }
+ /*if(blurShaderHorz == null) {
+
+ }*/
+ try {
+ blurShaderHorz = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur",
+ Minecraft.getMinecraft().getFramebuffer(), blurOutputHorz);
+ blurShaderHorz.getShaderManager().getShaderUniform("BlurDir").set(1, 0);
+ blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height));
+ } catch(Exception e) { }
+ try {
+ blurShaderVert = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur",
+ blurOutputHorz, output);
+ blurShaderVert.getShaderManager().getShaderUniform("BlurDir").set(0, 1);
+ blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height));
+ } catch(Exception e) { }
if(blurShaderHorz != null && blurShaderVert != null) {
if(blurShaderHorz.getShaderManager().getShaderUniform("Radius") == null) {
//Corrupted shader?
return;
}
- if(15 != lastBgBlurFactor) {
- blurShaderHorz.getShaderManager().getShaderUniform("Radius").set((float)15);
- blurShaderVert.getShaderManager().getShaderUniform("Radius").set((float)15);
- lastBgBlurFactor = 15;
+ if(blurFactor != lastBgBlurFactor) {
+ blurShaderHorz.getShaderManager().getShaderUniform("Radius").set((float)blurFactor);
+ blurShaderVert.getShaderManager().getShaderUniform("Radius").set((float)blurFactor);
+ lastBgBlurFactor = blurFactor;
}
GL11.glPushMatrix();
- GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, Minecraft.getMinecraft().getFramebuffer().framebufferObject);
+ /*GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, Minecraft.getMinecraft().getFramebuffer().framebufferObject);
GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, blurOutputVert.framebufferObject);
GL30.glBlitFramebuffer(0, 0, width, height,
0, 0, width, height,
- GL11.GL_COLOR_BUFFER_BIT, GL11.GL_NEAREST);
+ GL11.GL_COLOR_BUFFER_BIT, GL11.GL_NEAREST);*/
blurShaderHorz.loadShader(0);
blurShaderVert.loadShader(0);
@@ -161,10 +190,18 @@ public class BackgroundBlur {
* Renders a subsection of the blurred framebuffer on to the corresponding section of the screen.
* Essentially, this method will "blur" the background inside the bounds specified by [x->x+blurWidth, y->y+blurHeight]
*/
- public static void renderBlurredBackground(int screenWidth, int screenHeight,
+ public static void renderBlurredBackground(int blurStrength, int screenWidth, int screenHeight,
int x, int y, int blurWidth, int blurHeight) {
+ requestedBlurs.add(blurStrength);
+
if(!OpenGlHelper.isFramebufferEnabled() || !OpenGlHelper.areShadersSupported()) return;
- if(blurOutputVert == null) return;
+
+ if(blurOutput.isEmpty()) return;
+
+ Framebuffer fb = blurOutput.get(blurStrength);
+ if(fb == null) {
+ fb = blurOutput.values().iterator().next();
+ }
float uMin = x/(float)screenWidth;
float uMax = (x+blurWidth)/(float)screenWidth;
@@ -173,10 +210,10 @@ public class BackgroundBlur {
GlStateManager.depthMask(false);
Gui.drawRect(x, y, x+blurWidth, y+blurHeight, fogColour);
- blurOutputVert.bindFramebufferTexture();
+ fb.bindFramebufferTexture();
GlStateManager.color(1f, 1f, 1f, 1f);
RenderUtils.drawTexturedRect(x, y, blurWidth, blurHeight, uMin, uMax, vMin, vMax);
- blurOutputVert.unbindFramebufferTexture();
+ fb.unbindFramebufferTexture();
GlStateManager.depthMask(true);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorDraggableList.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorDraggableList.java
new file mode 100644
index 00000000..8689bda8
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorDraggableList.java
@@ -0,0 +1,14 @@
+package io.github.moulberry.notenoughupdates.core.config.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface ConfigEditorDraggableList {
+
+ String[] exampleText();
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java
index 7ca8ddf2..f10b63f1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java
@@ -17,13 +17,13 @@ public abstract class GuiOptionEditor {
}
public void render(int x, int y, int width) {
+ int height = getHeight();
+
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
- RenderUtils.drawFloatingRectDark(x, y, width, HEIGHT, true);
+ RenderUtils.drawFloatingRectDark(x, y, width, height, true);
TextRenderUtils.drawStringCenteredScaledMaxWidth(option.name,
fr, x+width/6, y+13, true, width/3-10, 0xc0c0c0);
- int height = getHeight();
-
int maxLines = 5;
float scale = 1;
int lineCount = fr.listFormattedStringToWidth(option.desc, width*2/3-10).size();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java
new file mode 100644
index 00000000..cd26b03d
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java
@@ -0,0 +1,268 @@
+package io.github.moulberry.notenoughupdates.core.config.gui;
+
+import io.github.moulberry.notenoughupdates.core.config.Config;
+import io.github.moulberry.notenoughupdates.core.config.struct.ConfigProcessor;
+import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils;
+import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.button_tex;
+
+public class GuiOptionEditorDraggableList extends GuiOptionEditor {
+
+ private static final ResourceLocation DELETE = new ResourceLocation("notenoughupdates:core/delete.png");
+
+ private String[] exampleText;
+ private List<Integer> activeText;
+ private int currentDragging = -1;
+ private int dragStartIndex = -1;
+
+ private long trashHoverTime = -1;
+
+ private int dragOffsetX = -1;
+ private int dragOffsetY = -1;
+
+ private boolean dropdownOpen = false;
+
+ public GuiOptionEditorDraggableList(ConfigProcessor.ProcessedOption option, String[] exampleText) {
+ super(option);
+
+ this.exampleText = exampleText;
+ this.activeText = (List<Integer>) option.get();
+ }
+
+ @Override
+ public int getHeight() {
+ int height = super.getHeight() + 13;
+
+ for(int strIndex : activeText) {
+ height += 10;
+ }
+
+ return height;
+ }
+
+ @Override
+ public void render(int x, int y, int width) {
+ super.render(x, y, width);
+
+ int height = getHeight();
+
+ GlStateManager.color(1, 1, 1, 1);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(button_tex);
+ RenderUtils.drawTexturedRect(x+width/6-24, y+45-7-14, 48, 16);
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth("Add", Minecraft.getMinecraft().fontRendererObj,
+ x+width/6, y+45-7-6,
+ false, 44, 0xFF303030);
+
+ long currentTime = System.currentTimeMillis();
+ if(trashHoverTime < 0) {
+ float greenBlue = LerpUtils.clampZeroOne((currentTime + trashHoverTime)/250f);
+ GlStateManager.color(1, greenBlue, greenBlue, 1);
+ } else {
+ float greenBlue = LerpUtils.clampZeroOne((250 + trashHoverTime - currentTime)/250f);
+ GlStateManager.color(1, greenBlue, greenBlue, 1);
+ }
+ Minecraft.getMinecraft().getTextureManager().bindTexture(DELETE);
+ Utils.drawTexturedRect(x+width/6+27, y+45-7-13, 11, 14, GL11.GL_NEAREST);
+
+ Gui.drawRect(x+5, y+45, x+width-5, y+height-5, 0xffdddddd);
+ Gui.drawRect(x+6, y+46, x+width-6, y+height-6, 0xff000000);
+
+ int i = 0;
+ int yOff=0;
+ for(int strIndex : activeText) {
+ String str = exampleText[strIndex];
+
+ if(i++ != dragStartIndex) {
+ Utils.drawStringScaledMaxWidth("\u2261 "+str+EnumChatFormatting.RESET, Minecraft.getMinecraft().fontRendererObj,
+ x+10, y+50+yOff, true, width-20, 0xffffffff);
+ }
+
+ yOff += 10;
+ }
+ }
+
+ @Override
+ public void renderOverlay(int x, int y, int width) {
+ super.renderOverlay(x, y, width);
+
+ if(dropdownOpen) {
+ List<Integer> remaining = new ArrayList<>();
+ for(int i=0; i<exampleText.length; i++) {
+ remaining.add(i);
+ }
+ remaining.removeAll(activeText);
+
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ int dropdownWidth = Math.min(width/2-10, 150);
+ int left = dragOffsetX;
+ int top = dragOffsetY;
+
+ int dropdownHeight = -1 + 12*remaining.size();
+
+ int main = 0xff202026;
+ int outline = 0xff404046;
+ Gui.drawRect(left, top, left+1, top+dropdownHeight, outline); //Left
+ Gui.drawRect(left+1, top, left+dropdownWidth, top+1, outline); //Top
+ Gui.drawRect(left+dropdownWidth-1, top+1, left+dropdownWidth, top+dropdownHeight, outline); //Right
+ Gui.drawRect(left+1, top+dropdownHeight-1, left+dropdownWidth-1, top+dropdownHeight, outline); //Bottom
+ Gui.drawRect(left+1, top+1, left+dropdownWidth-1, top+dropdownHeight-1, main); //Middle
+
+ int dropdownY = -1;
+ for(int strIndex : remaining) {
+ String str = exampleText[strIndex];
+ if(str.isEmpty()) {
+ str = "<NONE>";
+ }
+ TextRenderUtils.drawStringScaledMaxWidth(str, fr, left+3, top+3+dropdownY, false, dropdownWidth-6, 0xffa0a0a0);
+ dropdownY += 12;
+ }
+ } else if(currentDragging >= 0) {
+ int opacity = 0x80;
+ long currentTime = System.currentTimeMillis();
+ if(trashHoverTime < 0) {
+ float greenBlue = LerpUtils.clampZeroOne((currentTime + trashHoverTime)/250f);
+ opacity = (int)(opacity * greenBlue);
+ } else {
+ float greenBlue = LerpUtils.clampZeroOne((250 + trashHoverTime - currentTime)/250f);
+ opacity = (int)(opacity * greenBlue);
+ }
+
+ if(opacity < 20) return;
+
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ int mouseX = Mouse.getX() * scaledResolution.getScaledWidth() / Minecraft.getMinecraft().displayWidth;
+ int mouseY = scaledResolution.getScaledHeight() - Mouse.getY() * scaledResolution.getScaledHeight() / Minecraft.getMinecraft().displayHeight - 1;
+
+ String str = exampleText[currentDragging];
+
+ GlStateManager.enableBlend();
+ Utils.drawStringScaledMaxWidth("\u2261 "+str+EnumChatFormatting.RESET, Minecraft.getMinecraft().fontRendererObj,
+ dragOffsetX + mouseX, dragOffsetY + mouseY, true, width-20, 0xffffff | (opacity << 24));
+ }
+ }
+
+ @Override
+ public boolean mouseInput(int x, int y, int width, int mouseX, int mouseY) {
+ if(!Mouse.getEventButtonState() && !dropdownOpen &&
+ dragStartIndex >= 0 && Mouse.getEventButton() == 0 &&
+ mouseX >= x+width/6+27-3 && mouseX <= x+width/6+27+11+3 &&
+ mouseY >= y+45-7-13-3 && mouseY <= y+45-7-13+14+3) {
+ activeText.remove(dragStartIndex);
+ currentDragging = -1;
+ dragStartIndex = -1;
+ return false;
+ }
+
+ if(!Mouse.isButtonDown(0) || dropdownOpen) {
+ currentDragging = -1;
+ dragStartIndex = -1;
+ if(trashHoverTime > 0) trashHoverTime = -System.currentTimeMillis();
+ } else if(currentDragging >= 0 &&
+ mouseX >= x+width/6+27-3 && mouseX <= x+width/6+27+11+3 &&
+ mouseY >= y+45-7-13-3 && mouseY <= y+45-7-13+14+3) {
+ if(trashHoverTime < 0) trashHoverTime = System.currentTimeMillis();
+ } else {
+ if(trashHoverTime > 0) trashHoverTime = -System.currentTimeMillis();
+ }
+
+ if(Mouse.getEventButtonState()) {
+ int height = getHeight();
+
+ if(dropdownOpen) {
+ List<Integer> remaining = new ArrayList<>();
+ for(int i=0; i<exampleText.length; i++) {
+ remaining.add(i);
+ }
+ remaining.removeAll(activeText);
+
+ int dropdownWidth = Math.min(width/2-10, 150);
+ int left = dragOffsetX;
+ int top = dragOffsetY;
+
+ int dropdownHeight = -1 + 12*remaining.size();
+
+ if(mouseX > left && mouseX < left+dropdownWidth &&
+ mouseY > top && mouseY < top + dropdownHeight) {
+ int dropdownY = -1;
+ for(int strIndex : remaining) {
+ if(mouseY < top+dropdownY+12) {
+ activeText.add(0, strIndex);
+ if(remaining.size() == 1) dropdownOpen = false;
+ return true;
+ }
+
+ dropdownY += 12;
+ }
+ }
+
+ dropdownOpen = false;
+ return true;
+ }
+
+ if(activeText.size() < exampleText.length &&
+ mouseX > x+width/6-24 && mouseX < x+width/6+24 &&
+ mouseY > y+45-7-14 && mouseY < y+45-7+2) {
+ dropdownOpen = !dropdownOpen;
+ dragOffsetX = mouseX;
+ dragOffsetY = mouseY;
+ return true;
+ }
+
+ if(Mouse.getEventButton() == 0 &&
+ mouseX > x+5 && mouseX < x+width-5 &&
+ mouseY > y+45 && mouseY < y+height-6) {
+ int yOff=0;
+ int i = 0;
+ for(int strIndex : activeText) {
+ if(mouseY < y+50+yOff+10) {
+ dragOffsetX = x+10 - mouseX;
+ dragOffsetY = y+50+yOff - mouseY;
+
+ currentDragging = strIndex;
+ dragStartIndex = i;
+ break;
+ }
+ yOff += 10;
+ i++;
+ }
+ }
+ } else if(Mouse.getEventButton() == -1 && currentDragging >= 0) {
+ int yOff=0;
+ int i = 0;
+ for(int strIndex : activeText) {
+ if(dragOffsetY + mouseY + 4 < y+50+yOff+10) {
+ activeText.remove(dragStartIndex);
+ activeText.add(i, currentDragging);
+
+ dragStartIndex = i;
+ break;
+ }
+ yOff += 10;
+ i++;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean keyboardInput() {
+ return false;
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java
index a3e36919..9ca6b85b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java
@@ -46,7 +46,6 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor {
TextRenderUtils.drawStringScaledMaxWidth(selectedString, fr, left+3, top+3, false,
dropdownWidth-16, 0xffa0a0a0);
- //fr.drawString(selectedString, left+3, top+3, 0xff404040);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/ConfigProcessor.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/ConfigProcessor.java
index 513e32bb..2f2e1fdb 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/ConfigProcessor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/ConfigProcessor.java
@@ -8,6 +8,7 @@ import io.github.moulberry.notenoughupdates.core.config.Config;
import java.lang.reflect.Field;
import java.util.LinkedHashMap;
+import java.util.List;
public class ConfigProcessor {
@@ -115,6 +116,12 @@ public class ConfigProcessor {
editor = new GuiOptionEditorDropdown(option, configEditorAnnotation.values(), (int)option.get(), true);
}
}
+ if(optionType.isAssignableFrom(List.class)) {
+ if(optionField.isAnnotationPresent(ConfigEditorDraggableList.class)) {
+ ConfigEditorDraggableList configEditorAnnotation = optionField.getAnnotation(ConfigEditorDraggableList.class);
+ editor = new GuiOptionEditorDraggableList(option, configEditorAnnotation.exampleText());
+ }
+ }
if(optionType.isAssignableFrom(String.class)) {
if(optionField.isAnnotationPresent(ConfigEditorDropdown.class)) {
ConfigEditorDropdown configEditorAnnotation = optionField.getAnnotation(ConfigEditorDropdown.class);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java
index 0cc34fa4..b3aa8c97 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java
@@ -23,7 +23,7 @@ public class RenderUtils {
if(OpenGlHelper.isFramebufferEnabled()) {
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- BackgroundBlur.renderBlurredBackground(scaledResolution.getScaledWidth(),
+ BackgroundBlur.renderBlurredBackground(15, scaledResolution.getScaledWidth(),
scaledResolution.getScaledHeight(), x, y, width, height);
} else {
alpha = 0xff000000;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
index 16ce5875..47d3a461 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
@@ -500,7 +500,8 @@ public class DungeonMap {
if(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur > 0.1) {
GlStateManager.translate(-centerX+mapSizeX/2, -centerY+mapSizeY/2, 0);
- BackgroundBlur.renderBlurredBackground(scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(),
+ BackgroundBlur.renderBlurredBackground(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur,
+ scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(),
centerX-mapSizeX/2, centerY-mapSizeY/2, mapSizeX, mapSizeY);
GlStateManager.translate(centerX-mapSizeX/2, centerY-mapSizeY/2, 0);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/InfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/InfoPane.java
index a0657ecc..e9f246fa 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/InfoPane.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/InfoPane.java
@@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.infopanes;
import io.github.moulberry.notenoughupdates.NEUManager;
import io.github.moulberry.notenoughupdates.NEUOverlay;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
@@ -38,7 +39,8 @@ public abstract class InfoPane extends Gui {
int boxLeft = leftSide + overlay.getBoxPadding() - 5;
int boxRight = rightSide - overlay.getBoxPadding() + 5;
- BackgroundBlur.renderBlurredBackground(width, height,
+ BackgroundBlur.renderBlurredBackground(NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor,
+ width, height,
boxLeft, overlay.getBoxPadding()-5,
boxRight-boxLeft, height-overlay.getBoxPadding()*2+10);
drawRect(boxLeft, overlay.getBoxPadding() - 5, boxRight,
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesTextures.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesTextures.java
index 856a9d86..2fa8d5be 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesTextures.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesTextures.java
@@ -226,7 +226,14 @@ public class DwarvenMinesTextures {
public static void tick() {
time = System.currentTimeMillis();
- lastRetextureCheck.entrySet().removeIf((checks) -> time - checks.getValue() > 30*1000);
+ Set<ChunkCoordIntPair> remove = new HashSet<>();
+ for(Map.Entry<ChunkCoordIntPair, Long> entry : lastRetextureCheck.entrySet()) {
+ if(time - entry.getValue() > 30*1000) {
+ remove.add(entry.getKey());
+ }
+ }
+ lastRetextureCheck.keySet().removeAll(remove);
+ loadedChunkData.keySet().removeAll(remove);
/*if(Minecraft.getMinecraft().theWorld == null) return;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinPlayerControllerMP.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinPlayerControllerMP.java
index a1565b07..69444c45 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinPlayerControllerMP.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinPlayerControllerMP.java
@@ -18,7 +18,6 @@ public class MixinPlayerControllerMP {
@Inject(method="clickBlock", at=@At("HEAD"), cancellable = true)
public void clickBlock(BlockPos loc, EnumFacing face, CallbackInfoReturnable<Boolean> cir) {
ItemCooldowns.blockClicked(loc);
- //DwarvenMinesTextures.blockClicked(loc);
if(MiningStuff.blockClicked(loc)) {
cir.setReturnValue(false);
}
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 2e7afe97..19b9b7b0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -15,6 +15,8 @@ import net.minecraft.client.Minecraft;
import net.minecraftforge.client.ClientCommandHandler;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
public class NEUConfig extends Config {
@@ -632,6 +634,24 @@ public class NEUConfig extends Config {
public int line6 = 0;
}
+ public static class SkillOverlays {
+ @Expose
+ @ConfigOption(
+ name = "Farming Text",
+ desc = ""
+ )
+ @ConfigEditorDraggableList(
+ exampleText = {"\u00a7bCounter: \u00a7e37,547,860",
+ "\u00a7bCrops/m: \u00a7e38.29",
+ "\u00a7bFarm: \u00a7e12\u00a77 [\u00a7e|||||||||||||||||\u00a78||||||||\u00a77] \u00a7e67%",
+ "\u00a7bCurrent XP: \u00a7e6,734",
+ "\u00a7bRemaining XP: \u00a7e3,265",
+ "\u00a7bXP/h: \u00a7e238,129",
+ "\u00a7bYaw: \u00a7e68.25\u00a7l\u1D52"}
+ )
+ public List<Integer> priceInfoAuc = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6));
+ }
+
public static class DungeonProfit {
@Expose
@ConfigOption(
@@ -1303,7 +1323,7 @@ public class NEUConfig extends Config {
arr.add("/enderchest:Ender Chest:ENDER_CHEST");
arr.add("/wardrobe:Wardrobe:LEATHER_CHESTPLATE");
arr.add("/pets:Pets:BONE");
- arr.add("/neuah:NEU Auction House:GOLD_BLOCK");
+ arr.add("neuah:NEU Auction House:GOLD_BLOCK");
arr.add("/bz:Bazaar:GOLD_BARDING");
return arr;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingOverlay.java
index b391628d..8b334a93 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingOverlay.java
@@ -12,6 +12,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.text.NumberFormat;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.LinkedList;
import java.util.function.Supplier;
@@ -135,19 +136,21 @@ public class FarmingOverlay extends TextOverlay {
if(counter < 0) {
overlayStrings = null;
} else {
+ HashMap<Integer, String> lineMap = new HashMap<>();
+
overlayStrings = new ArrayList<>();
int counterInterp = (int)interp(counter, counterLast);
NumberFormat format = NumberFormat.getIntegerInstance();
- overlayStrings.add(EnumChatFormatting.AQUA+"Counter: "+EnumChatFormatting.YELLOW+format.format(counterInterp));
+ lineMap.put(0, EnumChatFormatting.AQUA+"Counter: "+EnumChatFormatting.YELLOW+format.format(counterInterp));
if(cropsPerSecondLast == cropsPerSecond && cropsPerSecond <= 0) {
- overlayStrings.add(EnumChatFormatting.AQUA+"Crops/m: "+EnumChatFormatting.YELLOW+"N/A");
+ lineMap.put(1, EnumChatFormatting.AQUA+"Crops/m: "+EnumChatFormatting.YELLOW+"N/A");
} else {
float cpsInterp = interp(cropsPerSecond, cropsPerSecondLast);
- overlayStrings.add(EnumChatFormatting.AQUA+"Crops/m: "+EnumChatFormatting.YELLOW+
+ lineMap.put(1, EnumChatFormatting.AQUA+"Crops/m: "+EnumChatFormatting.YELLOW+
String.format("%.2f", cpsInterp*60));
}
@@ -190,17 +193,17 @@ public class FarmingOverlay extends TextOverlay {
remaining = (int)interp(remaining, (int)(skillInfoLast.currentXpMax - skillInfoLast.currentXp));
}
- overlayStrings.add(levelStr.toString());
- overlayStrings.add(EnumChatFormatting.AQUA+"Current XP: " + EnumChatFormatting.YELLOW+ format.format(current));
- overlayStrings.add(EnumChatFormatting.AQUA+"Remaining XP: " + EnumChatFormatting.YELLOW+ format.format(remaining));
+ lineMap.put(2, levelStr.toString());
+ lineMap.put(3, EnumChatFormatting.AQUA+"Current XP: " + EnumChatFormatting.YELLOW+ format.format(current));
+ lineMap.put(4, EnumChatFormatting.AQUA+"Remaining XP: " + EnumChatFormatting.YELLOW+ format.format(remaining));
}
if(xpGainHourLast == xpGainHour && xpGainHour <= 0) {
- overlayStrings.add(EnumChatFormatting.AQUA+"XP/h: "+EnumChatFormatting.YELLOW+"N/A");
+ lineMap.put(5, EnumChatFormatting.AQUA+"XP/h: "+EnumChatFormatting.YELLOW+"N/A");
} else {
float xpInterp = interp(xpGainHour, xpGainHourLast);
- overlayStrings.add(EnumChatFormatting.AQUA+"XP/h: "+EnumChatFormatting.YELLOW+
+ lineMap.put(5, EnumChatFormatting.AQUA+"XP/h: "+EnumChatFormatting.YELLOW+
format.format(xpInterp)+(isFarming ? "" : EnumChatFormatting.RED + " (PAUSED)"));
}
@@ -209,8 +212,15 @@ public class FarmingOverlay extends TextOverlay {
if(yaw < 0) yaw += 360;
if(yaw > 180) yaw -= 360;
- overlayStrings.add(EnumChatFormatting.AQUA+"Yaw: "+EnumChatFormatting.YELLOW+
+ lineMap.put(6, EnumChatFormatting.AQUA+"Yaw: "+EnumChatFormatting.YELLOW+
String.format("%.2f", yaw)+EnumChatFormatting.BOLD+"\u1D52");
+
+ /*for(int strIndex : NotEnoughUpdates.INSTANCE.config) {
+ if(lineMap.containsKey(strIndex)) {
+ overlayStrings.add(lineMap.get(strIndex));
+ }
+ }*/
+ if(overlayStrings != null && overlayStrings.isEmpty()) overlayStrings = null;
}
}