aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java315
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java113
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java37
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java31
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonBlocks.java261
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/DungeonMap.java)26
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java409
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/GuiDungeonMapEditor.java)12
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayer.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRender.java19
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderFish.java125
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderList.java16
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTileEntitySpecialRenderer.java29
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinVboRenderList.java20
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/Options.java31
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java6
18 files changed, 929 insertions, 545 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java b/src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java
deleted file mode 100644
index f0b92c6a..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java
+++ /dev/null
@@ -1,315 +0,0 @@
-package io.github.moulberry.notenoughupdates;
-
-import io.github.moulberry.notenoughupdates.questing.SBInfo;
-import io.github.moulberry.notenoughupdates.util.SpecialColour;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.*;
-import net.minecraft.client.renderer.texture.*;
-import net.minecraft.client.resources.IResourceManager;
-import net.minecraft.client.resources.IResourceManagerReloadListener;
-import net.minecraft.client.shader.Framebuffer;
-import net.minecraft.util.ResourceLocation;
-import org.lwjgl.BufferUtils;
-import org.lwjgl.opengl.*;
-
-import java.nio.IntBuffer;
-import java.util.HashMap;
-import java.util.Map;
-
-public class DungeonBlocks implements IResourceManagerReloadListener {
-
- //public static Framebuffer framebuffer = null;
- private static int textureId = -1;
- private static IntBuffer intbuffer = null;
- private static HashMap<String, Integer> modified = new HashMap<>();
-
- @Override
- public void onResourceManagerReload(IResourceManager resourceManager) {
- reset();
- }
-
- public static boolean textureExists() {
- return textureId != -1 && isInDungeons();
- }
-
- public static void bindTextureIfExists() {
- if(textureExists()) {
- GlStateManager.bindTexture(textureId);
- }
- }
-
- public static boolean isInDungeons() {
- return !NotEnoughUpdates.INSTANCE.manager.config.disableDungeonBlocks.value &&
- (NotEnoughUpdates.INSTANCE.manager.config.dungeonBlocksEverywhere.value ||
- (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("dungeon")));
- }
-
- public static void reset() {
- textureId = -1;
- for(int tex : modified.values()) {
- GlStateManager.deleteTexture(tex);
- }
- modified.clear();
- }
-
- public static int getModifiedTexture(ResourceLocation location, int colour) {
- if(!isInDungeons()) {
- return -1;
- }
-
- if(((colour >> 24) & 0xFF) < 50) {
- return -1;
- }
-
- String id = location.getResourceDomain()+":"+location.getResourcePath();
- if(modified.containsKey(id)) {
- return modified.get(id);
- }
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(location);
- int mipmapLevels = GL11.glGetTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL);
- int w = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
- int h = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);
-
- if(intbuffer == null || intbuffer.capacity() < w*h) intbuffer = BufferUtils.createIntBuffer(w*h);
-
- int textureId = TextureUtil.glGenTextures();
- GlStateManager.bindTexture(textureId);
-
- if (mipmapLevels >= 0) {
- GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, mipmapLevels);
- GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MIN_LOD, 0.0F);
- GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, (float)mipmapLevels);
- GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0.0F);
- }
-
- for (int i = 0; i <= mipmapLevels; ++i) {
- GL11.glTexImage2D(GL11.GL_TEXTURE_2D, i, GL11.GL_RGBA, w >> i, h >> i, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, ((IntBuffer)null));
- }
-
- GlStateManager.bindTexture(textureId);
-
- GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
- GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
-
- for (int level = 0; level <= mipmapLevels; level++) {
- int w2 = w >> level;
- int h2 = h >> level;
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(location);
- GL11.glGetTexImage(GL11.GL_TEXTURE_2D, level, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, intbuffer);
-
- for(int x=0; x<w2; x++) {
- for(int y=0; y<h2; y++) {
- int index = x+y*w2;
-
- int newCol = colour;
- float newAlpha = ((newCol >> 24) & 0xFF)/255f;
- float newRed = ((newCol >> 16) & 0xFF)/255f;
- float newGreen = ((newCol >> 8) & 0xFF)/255f;
- float newBlue = (newCol & 0xFF)/255f;
-
- int oldCol = intbuffer.get(index);
- int oldAlpha = (oldCol >> 24) & 0xFF;
- float oldRed = ((oldCol >> 16) & 0xFF)/255f;
- float oldGreen = ((oldCol >> 8) & 0xFF)/255f;
- float oldBlue = (oldCol & 0xFF)/255f;
-
- int r = (int)((newRed*newAlpha + oldRed*(1-newAlpha))*255);
- int g = (int)((newGreen*newAlpha + oldGreen*(1-newAlpha))*255);
- int b = (int)((newBlue*newAlpha + oldBlue*(1-newAlpha))*255);
-
- intbuffer.put(index, oldAlpha << 24 | r << 16 | g << 8 | b);
- }
- }
-
- GlStateManager.bindTexture(textureId);
- GL11.glTexImage2D(GL11.GL_TEXTURE_2D, level, GL11.GL_RGBA, w2, h2,
- 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, intbuffer);
- }
-
- modified.put(id, textureId);
- return textureId;
- }
-
- public static void tick() {
- if(!isInDungeons()) {
- return;
- }
-
- if(textureId == -1) {
- int locationBlocksId = Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture).getGlTextureId();
-
- GlStateManager.bindTexture(locationBlocksId);
- int mipmapLevels = GL11.glGetTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL);
- int w = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
- int h = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);
-
- if(intbuffer == null || intbuffer.capacity() < w*h) intbuffer = BufferUtils.createIntBuffer(w*h);
-
- if(textureId == -1) {
- textureId = TextureUtil.glGenTextures();
- GlStateManager.bindTexture(textureId);
-
- if (mipmapLevels >= 0) {
- GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, mipmapLevels);
- GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MIN_LOD, 0.0F);
- GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, (float)mipmapLevels);
- GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0.0F);
- }
-
- for (int i = 0; i <= mipmapLevels; ++i) {
- GL11.glTexImage2D(GL11.GL_TEXTURE_2D, i, GL11.GL_RGBA, w >> i, h >> i, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, ((IntBuffer)null));
- }
- }
- GlStateManager.bindTexture(textureId);
-
- GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
- GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
-
- HashMap<TextureAtlasSprite, Integer> spriteMap = new HashMap<>();
- spriteMap.put(Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/stonebrick_cracked"),
- SpecialColour.specialToSimpleRGB(NotEnoughUpdates.INSTANCE.manager.config.dungCrackedColour.value));
- spriteMap.put(Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/dispenser_front_horizontal"),
- SpecialColour.specialToSimpleRGB(NotEnoughUpdates.INSTANCE.manager.config.dungDispenserColour.value));
- spriteMap.put(Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/lever"),
- SpecialColour.specialToSimpleRGB(NotEnoughUpdates.INSTANCE.manager.config.dungLeverColour.value));
- spriteMap.put(Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/trip_wire"),
- SpecialColour.specialToSimpleRGB(NotEnoughUpdates.INSTANCE.manager.config.dungTripWireColour.value));
-
- for (int level = 0; level <= mipmapLevels; level++) {
- int w2 = w >> level;
- int h2 = h >> level;
-
- GlStateManager.bindTexture(locationBlocksId);
- GL11.glGetTexImage(GL11.GL_TEXTURE_2D, level, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, intbuffer);
-
- for(Map.Entry<TextureAtlasSprite, Integer> entry : spriteMap.entrySet()) {
- if(((entry.getValue() >> 24) & 0xFF) < 50) continue;
-
- TextureAtlasSprite tas = entry.getKey();
- for(int x=(int)(w2*tas.getMinU()); x<w2*tas.getMaxU(); x++) {
- for(int y=(int)(h2*tas.getMinV()); y<h2*tas.getMaxV(); y++) {
- int index = x+y*w2;
-
- int newCol = entry.getValue();
-
- intbuffer.put(index, newCol);
- }
- }
- }
-
- GlStateManager.bindTexture(textureId);
- GL11.glTexImage2D(GL11.GL_TEXTURE_2D, level, GL11.GL_RGBA, w2, h2,
- 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, intbuffer);
- }
- }
- /*if(framebuffer == null || true) {
- Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
- int w = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
- int h = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);
-
- framebuffer = checkFramebufferSizes(framebuffer, w, h);
-
- try {
- int locationBlocksId = Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture).getGlTextureId();
-
- //framebuffer2.bindFramebufferTexture();
- //GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, w, h, 0, GL11.GL_RGBA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, ((ByteBuffer)null));
-
- //textureId = GlStateManager.generateTexture();
- //GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, w, h, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, ((ByteBuffer)null));
-
- GL11.glPushMatrix();
-
- GlStateManager.matrixMode(5889);
- GlStateManager.loadIdentity();
- GlStateManager.ortho(0.0D, w, h, 0.0D, 1000.0D, 3000.0D);
- GlStateManager.matrixMode(5888);
- GlStateManager.loadIdentity();
- GlStateManager.translate(0.0F, 0.0F, -2000.0F);
-
- framebuffer.bindFramebufferTexture();
- if (Minecraft.getMinecraft().gameSettings.mipmapLevels >= 0) {
- GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, Minecraft.getMinecraft().gameSettings.mipmapLevels);
- GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MIN_LOD, 0.0F);
- GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, (float)Minecraft.getMinecraft().gameSettings.mipmapLevels);
- GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0.0F);
- }
-
- for (int i = 0; i <= Minecraft.getMinecraft().gameSettings.mipmapLevels; ++i) {
- GL11.glTexImage2D(GL11.GL_TEXTURE_2D, i, GL11.GL_RGBA, w >> i, h >> i,
- 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, ((IntBuffer)null));
- }
-
- //framebuffer.framebufferClear();
- framebuffer.bindFramebuffer(true);
- GlStateManager.clearColor(1, 1, 1, 0);
- GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT);
- GL11.glClearColor(1, 1, 1, 0);
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
- GlStateManager.color(1, 1, 1, 1);
- Utils.drawTexturedRect(0, 0, w, h, 0, 1, 1, 0, GL11.GL_LINEAR);
-
- framebuffer.bindFramebufferTexture();
- GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, Minecraft.getMinecraft().gameSettings.mipmapLevels);
- GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MIN_LOD, 0.0F);
- GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, (float)Minecraft.getMinecraft().gameSettings.mipmapLevels);
- GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0.0F);
- GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
-
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- GlStateManager.matrixMode(5889);
- GlStateManager.loadIdentity();
- GlStateManager.ortho(0.0D, scaledResolution.getScaledWidth_double(), scaledResolution.getScaledHeight_double(),
- 0.0D, 1000.0D, 3000.0D);
- GlStateManager.matrixMode(5888);
- GlStateManager.loadIdentity();
- GlStateManager.translate(0.0F, 0.0F, -2000.0F);
-
- GL11.glPopMatrix();
-
- Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(true);
-
-
- /*framebuffer.bindFramebufferTexture();
- if(Keyboard.isKeyDown(Keyboard.KEY_B)) Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
- Utils.drawTexturedRect(0, 0, w, h, GL11.GL_NEAREST);*/
-
- /*GlStateManager.bindTexture(textureId);
- GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
- GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
- GlStateManager.enableBlend();
- GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
-
- //GlStateManager.enableTexture2D();
- //GlStateManager.enableBlend();
- //GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
-
-
- //GlStateManager.disableBlend();
-
- Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(true);
- } catch(Exception e) {
- e.printStackTrace();
- }
- }*/
- }
-
- 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, false);
- framebuffer.framebufferColor[0] = 1f;
- framebuffer.framebufferColor[1] = 0f;
- framebuffer.framebufferColor[2] = 0f;
- framebuffer.framebufferColor[3] = 0;
- } else {
- framebuffer.createBindFramebuffer(width, height);
- }
- framebuffer.setFramebufferFilter(GL11.GL_NEAREST);
- }
- return framebuffer;
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index 3c9f0190..f67b09ed 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -6,6 +6,8 @@ import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.auction.APIManager;
import io.github.moulberry.notenoughupdates.auction.CustomAHGui;
import io.github.moulberry.notenoughupdates.cosmetics.CapeManager;
+import io.github.moulberry.notenoughupdates.dungeons.DungeonBlocks;
+import io.github.moulberry.notenoughupdates.dungeons.DungeonWin;
import io.github.moulberry.notenoughupdates.gamemodes.SBGamemodes;
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
@@ -38,7 +40,6 @@ import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
-import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.text.WordUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
@@ -120,6 +121,9 @@ public class NEUEventListener {
}
}
+ private long notificationDisplayMillis = 0;
+ private List<String> notificationLines = null;
+
/**
* 1)Will send the cached message from #sendChatMessage when at least 200ms has passed since the last message.
* This is used in order to prevent the mod spamming messages.
@@ -134,21 +138,20 @@ public class NEUEventListener {
if(event.phase != TickEvent.Phase.START) return;
boolean longUpdate = false;
- boolean veryLongUpdate = false;
long currentTime = System.currentTimeMillis();
if(currentTime - lastLongUpdate > 1000) {
longUpdate = true;
lastLongUpdate = currentTime;
}
- if(longUpdate && currentTime - lastVeryLongUpdate > 10000) {
- veryLongUpdate = true;
- lastVeryLongUpdate = currentTime;
- }
- if(veryLongUpdate) {
- DungeonBlocks.reset();
+ if(!NotEnoughUpdates.INSTANCE.manager.config.slowDungeonBlocks.value) {
+ DungeonBlocks.tick();
}
+ DungeonWin.tick();
if(longUpdate) {
- DungeonBlocks.tick();
+ if(NotEnoughUpdates.INSTANCE.manager.config.slowDungeonBlocks.value) {
+ DungeonBlocks.tick();
+ }
+
neu.updateSkyblockScoreboard();
CapeManager.getInstance().tick();
@@ -177,6 +180,18 @@ public class NEUEventListener {
displayUpdateMessageIfOutOfDate();
}
+ long maxMemoryMB = Runtime.getRuntime().maxMemory()/1024L/1024L;
+ if(maxMemoryMB > 4100) {
+ notificationDisplayMillis = System.currentTimeMillis();
+ notificationLines = new ArrayList<>();
+ notificationLines.add(EnumChatFormatting.DARK_RED+"Too much memory allocated!");
+ notificationLines.add(String.format(EnumChatFormatting.DARK_GRAY+"NEU has detected %03dMB of memory allocated to Minecraft!", maxMemoryMB));
+ notificationLines.add(EnumChatFormatting.DARK_GRAY+"It is recommended to allocated between 2-4GB of memory");
+ notificationLines.add(EnumChatFormatting.DARK_GRAY+"More than 4GB WILL cause FPS issues, EVEN if you have 16GB+ available");
+ notificationLines.add("");
+ notificationLines.add(EnumChatFormatting.DARK_GRAY+"For more information, visit #ram-info in discord.gg/spr6ESn");
+ }
+
if(!neu.manager.config.loadedModBefore.value) {
neu.manager.config.loadedModBefore.value = true;
try { neu.manager.saveConfig(); } catch(IOException e) {}
@@ -203,7 +218,7 @@ public class NEUEventListener {
}
if(longUpdate && neu.hasSkyblockScoreboard()) {
if(neu.manager.getCurrentProfile() == null || neu.manager.getCurrentProfile().length() == 0) {
- ProfileViewer.Profile profile = neu.profileViewer.getProfile(Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", ""),
+ ProfileViewer.Profile profile = NotEnoughUpdates.profileViewer.getProfile(Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", ""),
callback->{});
if(profile != null) {
String latest = profile.getLatestProfile();
@@ -295,6 +310,44 @@ public class NEUEventListener {
Minecraft.getMinecraft().currentScreen instanceof GuiContainer && neu.overlay.isUsingMobsFilter()) {
event.setCanceled(true);
}
+ long timeRemaining = 15000 - (System.currentTimeMillis() - notificationDisplayMillis);
+ if(event.type == RenderGameOverlayEvent.ElementType.ALL) {
+ DungeonWin.render(event.partialTicks);
+ }
+ if(event.type == RenderGameOverlayEvent.ElementType.ALL &&
+ timeRemaining > 0 && notificationLines != null && notificationLines.size() > 0) {
+ int width = 0;
+ int height = notificationLines.size()*10+10;
+
+ for(String line : notificationLines) {
+ int len = Minecraft.getMinecraft().fontRendererObj.getStringWidth(line) + 8;
+ if(len > width) {
+ width = len;
+ }
+ }
+
+ ScaledResolution sr = Utils.pushGuiScale(2);
+
+ int midX = sr.getScaledWidth()/2;
+ int topY = sr.getScaledHeight()*3/4-height/2;
+ Gui.drawRect(midX-width/2, sr.getScaledHeight()*3/4-height/2,
+ midX+width/2, sr.getScaledHeight()*3/4+height/2, 0xFF3C3C3C);
+ Gui.drawRect(midX-width/2+2, sr.getScaledHeight()*3/4-height/2+2,
+ midX+width/2-2, sr.getScaledHeight()*3/4+height/2-2, 0xFFC8C8C8);
+
+ Minecraft.getMinecraft().fontRendererObj.drawString((timeRemaining/1000)+"s", midX-width/2+3,
+ topY+3, 0xFF000000, false);
+
+ Utils.drawStringCentered(notificationLines.get(0), Minecraft.getMinecraft().fontRendererObj,
+ midX, topY+4+5, false, -1);
+ for(int i=1; i<notificationLines.size(); i++) {
+ String line = notificationLines.get(i);
+ Utils.drawStringCentered(line, Minecraft.getMinecraft().fontRendererObj,
+ midX, topY+4+5+2+i*10, false, -1);
+ }
+
+ Utils.pushGuiScale(-1);
+ }
}
/**
@@ -447,6 +500,8 @@ public class NEUEventListener {
*/
@SubscribeEvent(priority = EventPriority.LOW)
public void onGuiChat(ClientChatReceivedEvent e) {
+ DungeonWin.onChatMessage(e);
+
String r = null;
String unformatted = Utils.cleanColour(e.message.getUnformattedText());
if(unformatted.startsWith("You are playing on profile: ")) {
@@ -1368,36 +1423,32 @@ public class NEUEventListener {
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionInfo.get("clean_sales").getAsFloat())+" sales/day");
}
}
-
} else if(hasBazaarPrice) {
+ int stackMultiplier = 1;
+ int shiftStackMultiplier = event.itemStack.stackSize > 1 ? event.itemStack.stackSize : 64;
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- int bazaarBuyPrice = (int)bazaarInfo.get("avg_buy").getAsFloat()*64;
- event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Buy (Stack): "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarBuyPrice)+" coins");
- int bazaarSellPrice = (int)bazaarInfo.get("avg_sell").getAsFloat()*64;
- event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Sell (Stack): "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarSellPrice)+" coins");
- if(neu.manager.config.advancedPriceInfo.value) {
- int bazaarInstantBuyPrice = (int)bazaarInfo.get("curr_buy").getAsFloat()*64;
- event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Buy (Stack): "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantBuyPrice)+" coins");
- int bazaarInstantSellPrice = (int)bazaarInfo.get("curr_sell").getAsFloat()*64;
- event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Sell (Stack): "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantSellPrice)+" coins");
- }
+ stackMultiplier = shiftStackMultiplier;
} else {
- event.toolTip.add(EnumChatFormatting.DARK_GRAY.toString()+"[SHIFT show stack]");
- int bazaarBuyPrice = (int)bazaarInfo.get("avg_buy").getAsFloat();
+ event.toolTip.add(EnumChatFormatting.DARK_GRAY.toString()+"[SHIFT show x"+shiftStackMultiplier+"]");
+ }
+ if(bazaarInfo.has("avg_buy")) {
+ int bazaarBuyPrice = (int)bazaarInfo.get("avg_buy").getAsFloat()*stackMultiplier;
event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Buy: "+
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarBuyPrice)+" coins");
- int bazaarSellPrice = (int)bazaarInfo.get("avg_sell").getAsFloat();
+ }
+ if(bazaarInfo.has("avg_sell")) {
+ int bazaarSellPrice = (int)bazaarInfo.get("avg_sell").getAsFloat()*stackMultiplier;
event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Sell: "+
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarSellPrice)+" coins");
- if(neu.manager.config.advancedPriceInfo.value) {
- int bazaarInstantBuyPrice = (int)bazaarInfo.get("curr_buy").getAsFloat();
+ }
+ if(neu.manager.config.advancedPriceInfo.value) {
+ if(bazaarInfo.has("curr_buy")) {
+ int bazaarInstantBuyPrice = (int)bazaarInfo.get("curr_buy").getAsFloat()*stackMultiplier;
event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Buy: "+
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantBuyPrice)+" coins");
- int bazaarInstantSellPrice = (int)bazaarInfo.get("curr_sell").getAsFloat();
+ }
+ if(bazaarInfo.has("curr_sell")) {
+ int bazaarInstantSellPrice = (int)bazaarInfo.get("curr_sell").getAsFloat()*stackMultiplier;
event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Sell: "+
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantSellPrice)+" coins");
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index b2742bf9..73381955 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -2033,34 +2033,31 @@ public class NEUOverlay extends Gui {
}
} else if(hasBazaarPrice) {
+ int stackMultiplier = 1;
+ int shiftStackMultiplier = 64;
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- int bazaarBuyPrice = (int)bazaarInfo.get("avg_buy").getAsFloat()*64;
- text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Buy (Stack): "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarBuyPrice)+" coins");
- int bazaarSellPrice = (int)bazaarInfo.get("avg_sell").getAsFloat()*64;
- text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Sell (Stack): "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarSellPrice)+" coins");
- if(manager.config.advancedPriceInfo.value) {
- int bazaarInstantBuyPrice = (int)bazaarInfo.get("curr_buy").getAsFloat()*64;
- text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Buy (Stack): "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantBuyPrice)+" coins");
- int bazaarInstantSellPrice = (int)bazaarInfo.get("curr_sell").getAsFloat()*64;
- text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Sell (Stack): "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantSellPrice)+" coins");
- }
+ stackMultiplier = shiftStackMultiplier;
} else {
- text.add(EnumChatFormatting.DARK_GRAY.toString()+"[SHIFT show stack]");
- int bazaarBuyPrice = (int)bazaarInfo.get("avg_buy").getAsFloat();
+ text.add(EnumChatFormatting.DARK_GRAY.toString()+"[SHIFT show x"+shiftStackMultiplier+"]");
+ }
+ if(bazaarInfo.has("avg_buy")) {
+ int bazaarBuyPrice = (int)bazaarInfo.get("avg_buy").getAsFloat()*stackMultiplier;
text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Buy: "+
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarBuyPrice)+" coins");
- int bazaarSellPrice = (int)bazaarInfo.get("avg_sell").getAsFloat();
+ }
+ if(bazaarInfo.has("avg_sell")) {
+ int bazaarSellPrice = (int)bazaarInfo.get("avg_sell").getAsFloat()*stackMultiplier;
text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Sell: "+
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarSellPrice)+" coins");
- if(manager.config.advancedPriceInfo.value) {
- int bazaarInstantBuyPrice = (int)bazaarInfo.get("curr_buy").getAsFloat();
+ }
+ if(manager.config.advancedPriceInfo.value) {
+ if(bazaarInfo.has("curr_buy")) {
+ int bazaarInstantBuyPrice = (int)bazaarInfo.get("curr_buy").getAsFloat()*stackMultiplier;
text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Buy: "+
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantBuyPrice)+" coins");
- int bazaarInstantSellPrice = (int)bazaarInfo.get("curr_sell").getAsFloat();
+ }
+ if(bazaarInfo.has("curr_sell")) {
+ int bazaarInstantSellPrice = (int)bazaarInfo.get("curr_sell").getAsFloat()*stackMultiplier;
text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Sell: "+