aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorBuildTools <james.jenour@protonmail.com>2021-01-13 10:17:56 +0800
committerBuildTools <james.jenour@protonmail.com>2021-01-13 10:17:56 +0800
commitc9cc530adfb39085fe4b0f9a60e0ca6e4bbb8eb9 (patch)
treedb49b22c6e50775f6c49e5172f71dc662b657598 /src/main/java/io
parentcfa0aa0c9a24aa739d3254b24ef4bf0bea7087a6 (diff)
downloadNotEnoughUpdates-c9cc530adfb39085fe4b0f9a60e0ca6e4bbb8eb9.tar.gz
NotEnoughUpdates-c9cc530adfb39085fe4b0f9a60e0ca6e4bbb8eb9.tar.bz2
NotEnoughUpdates-c9cc530adfb39085fe4b0f9a60e0ca6e4bbb8eb9.zip
2.0 PRE6
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java106
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java34
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/util/GuiElementSlider.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java30
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java93
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java39
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/infopanes/InfoPane.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java442
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java160
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java56
15 files changed, 665 insertions, 328 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index 7b08ddf4..1111a580 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -146,6 +146,8 @@ public class NEUEventListener {
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
if(event.phase != TickEvent.Phase.START) return;
+ if(Minecraft.getMinecraft().theWorld == null) return;
+ if(Minecraft.getMinecraft().thePlayer == null) return;
boolean longUpdate = false;
long currentTime = System.currentTimeMillis();
@@ -159,6 +161,13 @@ public class NEUEventListener {
DungeonWin.tick();
if(longUpdate) {
NotEnoughUpdates.INSTANCE.overlay.redrawItems();
+ CapeManager.onTickSlow();
+
+ for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) {
+ NotEnoughUpdates.profileViewer.putNameUuid(player.getName(), player.getUniqueID().toString().replace("-", ""));
+ }
+ NotEnoughUpdates.profileViewer.putNameUuid(Minecraft.getMinecraft().thePlayer.getName(),
+ Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", ""));
if(neu.config.dungeonBlock.slowDungeonBlocks) {
DungeonBlocks.tick();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index 69cda23a..edaa8335 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger;
import io.github.moulberry.notenoughupdates.infopanes.*;
@@ -440,6 +441,7 @@ public class NEUOverlay extends Gui {
}
}
+ GlStateManager.enableDepth();
float itemScale = bigItemSize/(float)ITEM_SIZE*extraScale;
GlStateManager.pushMatrix();
GlStateManager.scale(itemScale, itemScale, 1);
@@ -1575,93 +1577,6 @@ public class NEUOverlay extends Gui {
return projMatrix;
}
- /**
- * Renders whatever is currently in the Minecraft framebuffer to our two framebuffers, applying a horizontal
- * and vertical blur separately in order to significantly save computation time.
- * This is only possible if framebuffers are supported by the system, so this method will exit prematurely
- * if framebuffers are not available. (Apple machines, for example, have poor framebuffer support).
- */
- private double lastBgBlurFactor = 5;
- private void blurBackground() {
- int width = Minecraft.getMinecraft().displayWidth;
- int height = Minecraft.getMinecraft().displayHeight;
-
- if(NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor <= 0 || !OpenGlHelper.isFramebufferEnabled()) return;
-
- if(blurOutputHorz == null) {
- 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.framebufferWidth != width || blurOutputHorz.framebufferHeight != height) {
- blurOutputHorz.createBindFramebuffer(width, height);
- 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", Minecraft.getMinecraft().getFramebuffer(), 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 && blurShaderVert != null) {
- if(NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor != lastBgBlurFactor) {
- if(blurShaderHorz.getShaderManager().getShaderUniform("Radius") == null) {
- return;
- }
- lastBgBlurFactor = Math.max(0, Math.min(50, NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor));
- blurShaderHorz.getShaderManager().getShaderUniform("Radius").set((float)lastBgBlurFactor);
- blurShaderVert.getShaderManager().getShaderUniform("Radius").set((float)lastBgBlurFactor);
- }
- GL11.glPushMatrix();
- blurShaderHorz.loadShader(0);
- blurShaderVert.loadShader(0);
- GlStateManager.enableDepth();
- GL11.glPopMatrix();
-
- Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
- }
- }
-
- /**
- * 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 void renderBlurredBackground(int width, int height, int x, int y, int blurWidth, int blurHeight) {
- if(NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor <= 0 || !OpenGlHelper.isFramebufferEnabled()) return;
-
- float uMin = x/(float)width;
- float uMax = (x+blurWidth)/(float)width;
- float vMin = y/(float)height;
- float vMax = (y+blurHeight)/(float)height;
-
- blurOutputVert.bindFramebufferTexture();
- GlStateManager.color(1f, 1f, 1f, 1f);
- //Utils.setScreen(width*f, height*f, f);
- Utils.drawTexturedRect(x, y, blurWidth, blurHeight, uMin, uMax, vMax, vMin);
- //Utils.setScreen(width, height, f);
- blurOutputVert.unbindFramebufferTexture();
- }
-
public void updateGuiGroupSize() {
Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.itemlist.paneGuiScale);
int width = Utils.peekGuiScale().getScaledWidth();
@@ -1728,8 +1643,6 @@ public class NEUOverlay extends Gui {
redrawItems = true;
}
- blurBackground();
-
yaw++;
yaw %= 360;
@@ -1799,9 +1712,12 @@ 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) {
- renderBlurredBackground(width, height,
+ BackgroundBlur.renderBlurredBackground(width, height,
leftSide+getBoxPadding()-5, getBoxPadding()-5,
paneWidth-getBoxPadding()*2+10, height-getBoxPadding()*2+10);
+ Gui.drawRect(leftSide+getBoxPadding()-5, getBoxPadding()-5,
+ leftSide+getBoxPadding()-5+paneWidth-getBoxPadding()*2+10,
+ getBoxPadding()-5+height-getBoxPadding()*2+10, 0xc8101010);
drawRect(leftSide+getBoxPadding()-5, getBoxPadding()-5,
leftSide+paneWidth-getBoxPadding()+5, height-getBoxPadding()+5, bg.getRGB());
@@ -1951,16 +1867,16 @@ public class NEUOverlay extends Gui {
int selectedX = Math.min(selectedItemGroupX, width-getBoxPadding()-18*selectedItemGroup.size());
+ GlStateManager.enableDepth();
GlStateManager.depthFunc(GL11.GL_LESS);
-
- drawRect(selectedX-1+2, selectedItemGroupY+17+2,
- selectedX-1+18*selectedItemGroup.size()+2, selectedItemGroupY+35+2, 0xa0000000);
drawRect(selectedX, selectedItemGroupY+18,
selectedX-2+18*selectedItemGroup.size(), selectedItemGroupY+34, fgCustomOpacity.getRGB());
- drawRect(selectedX, selectedItemGroupY+18,
- selectedX-1+18*selectedItemGroup.size(), selectedItemGroupY+35, new Color(30, 30, 30).getRGB());
drawRect(selectedX-1, selectedItemGroupY+17,
selectedX-2+18*selectedItemGroup.size(), selectedItemGroupY+34, new Color(180, 180, 180).getRGB());
+ drawRect(selectedX, selectedItemGroupY+18,
+ selectedX-1+18*selectedItemGroup.size(), selectedItemGroupY+35, new Color(30, 30, 30).getRGB());
+ drawRect(selectedX-1+2, selectedItemGroupY+17+2,
+ selectedX-1+18*selectedItemGroup.size()+2, selectedItemGroupY+35+2, 0xa0000000);
GlStateManager.depthFunc(GL11.GL_LEQUAL);
GL11.glTranslatef(0, 0, 10);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 897db723..d5e6b927 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -595,6 +595,28 @@ public class NotEnoughUpdates {
}
};
+
+ SimpleCommand joinDungeonCommand = new SimpleCommand("join", new SimpleCommand.ProcessCommandRunnable() {
+ @Override
+ public void processCommand(ICommandSender sender, String[] args) {
+ if (!hasSkyblockScoreboard()) {
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/join " + StringUtils.join(args, " "));
+ } else {
+ if(args.length != 1) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.RED+"Example Usage: /join f7 or /join 7"));
+ } else {
+ String cmd = "/joindungeon catacombs " + args[0].charAt(args[0].length()-1);
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.YELLOW+"Running command: "+cmd));
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.YELLOW+"The dungeon should start soon. If it doesn't, make sure you have a party of 5 people"));
+ Minecraft.getMinecraft().thePlayer.sendChatMessage(cmd);
+ }
+ }
+ }
+ });
+
SimpleCommand viewProfileCommand = new SimpleCommand("neuprofile", viewProfileRunnable, new SimpleCommand.TabCompleteRunnable() {
@Override
public List<String> tabComplete(ICommandSender sender, String[] args, BlockPos pos) {
@@ -638,14 +660,11 @@ public class NotEnoughUpdates {
}
});
- SimpleCommand viewProfileShort2Command = new SimpleCommand("vp", new SimpleCommand.ProcessCommandRunnable() {
+ SimpleCommand viewCataCommand = new SimpleCommand("cata", new SimpleCommand.ProcessCommandRunnable() {
@Override
public void processCommand(ICommandSender sender, String[] args) {
- if(!isOnSkyblock()) {
- Minecraft.getMinecraft().thePlayer.sendChatMessage("/vp " + StringUtils.join(args, " "));
- } else {
- viewProfileRunnable.processCommand(sender, args);
- }
+ GuiProfileViewer.currentPage = GuiProfileViewer.ProfileViewerPage.DUNG;
+ viewProfileRunnable.processCommand(sender, args);
}
}, new SimpleCommand.TabCompleteRunnable() {
@Override
@@ -889,9 +908,10 @@ public class NotEnoughUpdates {
ClientCommandHandler.instance.registerCommand(resetRepoCommand);
ClientCommandHandler.instance.registerCommand(reloadRepoCommand);
ClientCommandHandler.instance.registerCommand(itemRenameCommand);
+ ClientCommandHandler.instance.registerCommand(joinDungeonCommand);
ClientCommandHandler.instance.registerCommand(viewProfileCommand);
ClientCommandHandler.instance.registerCommand(viewProfileShortCommand);
- ClientCommandHandler.instance.registerCommand(viewProfileShort2Command);
+ ClientCommandHandler.instance.registerCommand(viewCataCommand);
ClientCommandHandler.instance.registerCommand(peekCommand);
ClientCommandHandler.instance.registerCommand(tutorialCommand);
ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand);
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 30d056b4..85b442a9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java
@@ -14,6 +14,7 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
+import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL30;
@@ -23,6 +24,7 @@ public class BackgroundBlur {
private static boolean registered = false;
public static void registerListener() {
if(!registered) {
+ registered = true;
MinecraftForge.EVENT_BUS.register(new BackgroundBlur());
}
}
@@ -79,7 +81,7 @@ public class BackgroundBlur {
private static double lastBgBlurFactor = -1;
private static void blurBackground() {
- if(!OpenGlHelper.isFramebufferEnabled()) return;
+ if(!OpenGlHelper.isFramebufferEnabled() || !OpenGlHelper.areShadersSupported()) return;
int width = Minecraft.getMinecraft().displayWidth;
int height = Minecraft.getMinecraft().displayHeight;
@@ -161,7 +163,7 @@ public class BackgroundBlur {
*/
public static void renderBlurredBackground(int screenWidth, int screenHeight,
int x, int y, int blurWidth, int blurHeight) {
- if(!OpenGlHelper.isFramebufferEnabled()) return;
+ if(!OpenGlHelper.isFramebufferEnabled() || !OpenGlHelper.areShadersSupported()) return;
if(blurOutputVert == null) return;
float uMin = x/(float)screenWidth;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/GuiElementSlider.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/GuiElementSlider.java
index 4cffb479..cedf368b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/util/GuiElementSlider.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/GuiElementSlider.java
@@ -112,7 +112,6 @@ public class GuiElementSlider extends GuiElement {
return true;
}
-
return false;
}
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 6f2ab3f1..712ac09a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java
@@ -44,8 +44,8 @@ public class CapeManager {
private HashSet<String> availableCapes = new HashSet<>();
private String[] capes = new String[]{"patreon1", "patreon2", "fade", "contrib", "nullzee",
- "gravy", "space", "mcworld", "lava", "packshq", "mbstaff", "thebakery", "negative", "void" };
- public Boolean[] specialCapes = new Boolean[]{ true, true, false, true, true, true, false, false, false, true, true, true, false, false };
+ "gravy", "space", "mcworld", "lava", "packshq", "mbstaff", "thebakery", "negative", "void", "ironmoon", "krusty" };
+ public Boolean[] specialCapes = new Boolean[]{ true, true, false, true, true, true, false, false, false, true, true, true, false, false, true, true };
public static CapeManager getInstance() {
return INSTANCE;
@@ -215,16 +215,9 @@ public class CapeManager {
}
}
- @SubscribeEvent
- public void onTick(TickEvent.ClientTickEvent event) {
- if (event.phase != TickEvent.Phase.END) return;
+ public static void onTickSlow() {
if(Minecraft.getMinecraft().theWorld == null) return;
- String clientUuid = null;
- if(Minecraft.getMinecraft().thePlayer != null) {
- clientUuid = Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", "");
- }
-
if(playerMap == null) {
playerMap = HashBiMap.create(Minecraft.getMinecraft().theWorld.playerEntities.size());
}
@@ -232,11 +225,26 @@ public class CapeManager {
for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) {
String uuid = player.getUniqueID().toString().replace("-", "");
contains.add(uuid);
- if(!playerMap.containsValue(player)) {
+ if(!playerMap.containsValue(player) && !playerMap.containsKey(uuid)) {
playerMap.put(uuid, player);
}
}
playerMap.keySet().retainAll(contains);
+ }
+
+ @SubscribeEvent
+ public void onTick(TickEvent.ClientTickEvent event) {
+ if (event.phase != TickEvent.Phase.END) return;
+ if(Minecraft.getMinecraft().theWorld == null) return;
+
+ if(playerMap == null) {
+ return;
+ }
+
+ String clientUuid = null;
+ if(Minecraft.getMinecraft().thePlayer != null) {
+ clientUuid = Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", "");
+ }
boolean hasLocalCape = localCape != null && localCape.getRight() != null && !localCape.getRight().equals("null");
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 bbb5fd31..ce59b7c6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
@@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.dungeons;
import com.google.common.collect.Iterables;
import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
import io.github.moulberry.notenoughupdates.util.NEUResourceManager;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
@@ -494,7 +495,7 @@ public class DungeonMap {
if(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur > 0.1) {
GlStateManager.translate(-centerX+mapSizeX/2, -centerY+mapSizeY/2, 0);
- renderBlurredBackground(scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(),
+ BackgroundBlur.renderBlurredBackground(scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(),
centerX-mapSizeX/2, centerY-mapSizeY/2, mapSizeX, mapSizeY);
GlStateManager.translate(centerX-mapSizeX/2, centerY-mapSizeY/2, 0);
}
@@ -1347,17 +1348,6 @@ public class DungeonMap {
this.colourMap = colourMap;
}
- @SubscribeEvent(priority=EventPriority.HIGH)
- public void onRenderOverlayPre(RenderGameOverlayEvent.Pre event) {
- if(event.type == RenderGameOverlayEvent.ElementType.ALL &&
- NotEnoughUpdates.INSTANCE.config.dungeonMap.dmEnable &&
- NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur > 0.1) {
- blurBackground();
- GlStateManager.enableBlend();
- GlStateManager.enableTexture2D();
- }
- }
-
@SubscribeEvent
public void onWorldChange(WorldEvent.Load event) {
colourMap = null;
@@ -1534,83 +1524,4 @@ public class DungeonMap {
return projMatrix;
}
- private double lastBgBlurFactor = -1;
- private void blurBackground() {
- if(!OpenGlHelper.isFramebufferEnabled()) return;
-
- int width = Minecraft.getMinecraft().displayWidth;
- int height = Minecraft.getMinecraft().displayHeight;
-
- if(blurOutputHorz == null) {
- 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.framebufferWidth != width || blurOutputHorz.framebufferHeight != height) {
- blurOutputHorz.createBindFramebuffer(width, height);
- 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",
- Minecraft.getMinecraft().getFramebuffer(), 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 && blurShaderVert != null) {
- float blur = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur;
- blur = Math.max(0, Math.min(50, blur));
- if(blur != lastBgBlurFactor) {
- blurShaderHorz.getShaderManager().getShaderUniform("Radius").set(blur);
- blurShaderVert.getShaderManager().getShaderUniform("Radius").set(blur);
- lastBgBlurFactor = blur;
- }
- GL11.glPushMatrix();
- blurShaderHorz.loadShader(0);
- blurShaderVert.loadShader(0);
- GlStateManager.enableDepth();
- GL11.glPopMatrix();
- Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
- }
- }
-
- /**
- * 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 void renderBlurredBackground(int width, int height, int x, int y, int blurWidth, int blurHeight) {
- if(!OpenGlHelper.isFramebufferEnabled()) return;
-
- if(blurOutputVert == null) return;
-
- float uMin = x/(float)width;
- float uMax = (x+blurWidth)/(float)width;
- float vMin = (height-y)/(float)height;
- float vMax = (height-y-blurHeight)/(float)height;
-
- blurOutputVert.bindFramebufferTexture();
- GlStateManager.color(1f, 1f, 1f, 1f);
- Utils.drawTexturedRectNoBlend(x, y, blurWidth, blurHeight, uMin, uMax, vMin, vMax, GL11.GL_LINEAR);
- blurOutputVert.unbindFramebufferTexture();
- }
-
}
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 e962f793..5677bf9e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java
@@ -177,9 +177,42 @@ public class GuiDungeonMapEditor extends GuiScreen {
//buttons.add(new Button(29, 52, 86+19, "XLarge", options.dmRoomSize));
//buttons.add(new Button(30, 52, 56, "XLarge", options.dmBorderSize));
- xField.setText(String.valueOf(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCenterX));
- yField.setText(String.valueOf(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCenterY));
- blurField.setText(String.valueOf(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur));
+ {
+ double val = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCenterX;
+ String strVal;
+ if(val % 1 == 0) {
+ strVal = Integer.toString((int)val);
+ } else {
+ strVal = Double.toString(val);
+ strVal = strVal.replaceAll("(\\.\\d\\d\\d)(?:\\d)+", "$1");
+ strVal = strVal.replaceAll("0+$", "");
+ }
+ xField.setText(strVal);
+ }
+ {
+ double val = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCenterY;
+ String strVal;
+ if(val % 1 == 0) {
+ strVal = Integer.toString((int)val);
+ } else {
+ strVal = Double.toString(val);
+ strVal = strVal.replaceAll("(\\.\\d\\d\\d)(?:\\d)+", "$1");
+ strVal = strVal.replaceAll("0+$", "");
+ }
+ yField.setText(strVal);
+ }
+ {
+ double val = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur;
+ String strVal;
+ if(val % 1 == 0) {
+ strVal = Integer.toString((int)val);
+ } else {
+ strVal = Double.toString(val);
+ strVal = strVal.replaceAll("(\\.\\d\\d\\d)(?:\\d)+", "$1");
+ strVal = strVal.replaceAll("0+$", "");
+ }
+ blurField.setText(strVal);
+ }
}
@Override
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 76b500f5..a0657ecc 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.core.BackgroundBlur;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
@@ -37,7 +38,7 @@ public abstract class InfoPane extends Gui {
int boxLeft = leftSide + overlay.getBoxPadding() - 5;
int boxRight = rightSide - overlay.getBoxPadding() + 5;
- overlay.renderBlurredBackground(width, height,
+ BackgroundBlur.renderBlurredBackground(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/EnchantingSolvers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java
index 79dc2bba..eed1ec60 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java
@@ -467,7 +467,7 @@ public class EnchantingSolvers {
for (int index2 = 0; index2 < lower.getSizeInventory(); index2++) {
ItemStack stack2 = lower.getStackInSlot(index2);
if(stack2 != null && stack2.getDisplayName().equals(stack.getDisplayName()) &