aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java59
1 files changed, 43 insertions, 16 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java
index 5d841885..d80a5daf 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java
@@ -1,6 +1,7 @@
package io.github.moulberry.notenoughupdates.miscgui;
import com.google.common.collect.Lists;
+import io.github.moulberry.notenoughupdates.NEUEventListener;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.*;
import io.github.moulberry.notenoughupdates.core.config.KeybindHelper;
@@ -28,6 +29,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
+
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -36,6 +38,7 @@ import org.lwjgl.util.vector.Vector2f;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.awt.*;
+
import java.util.*;
import java.util.List;
@@ -92,6 +95,8 @@ public class StorageOverlay extends GuiElement {
private int guiLeft;
private int guiTop;
+ private boolean fastRender = false;
+
private int loadCircleIndex = 0;
private int rollIndex = 0;
private int loadCircleRotation = 0;
@@ -120,12 +125,12 @@ public class StorageOverlay extends GuiElement {
private LerpingInteger scroll = new LerpingInteger(0, 200);
private int getMaximumScroll() {
- synchronized(StorageManager.getInstance().storageConfig.displayToStorageIdMap) {
+ synchronized(StorageManager.getInstance().storageConfig.displayToStorageIdMapRender) {
int maxH = 0;
for(int i=0; i<3; i++) {
- int lastDisplayId = StorageManager.getInstance().storageConfig.displayToStorageIdMap.size()-1;
+ int lastDisplayId = StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.size()-1;
int coords = (int)Math.ceil(lastDisplayId/3f)*3+1+i;
int h = getPageCoords(coords).y+scroll.getValue()-getStorageViewSize()-14;
@@ -300,8 +305,8 @@ public class StorageOverlay extends GuiElement {
int startY = getPageCoords(0).y;
if(OpenGlHelper.isFramebufferEnabled()) {
int h;
- synchronized(StorageManager.getInstance().storageConfig.displayToStorageIdMap) {
- int lastDisplayId = StorageManager.getInstance().storageConfig.displayToStorageIdMap.size()-1;
+ synchronized(StorageManager.getInstance().storageConfig.displayToStorageIdMapRender) {
+ int lastDisplayId = StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.size()-1;
int coords = (int)Math.ceil(lastDisplayId/3f)*3+3;
h = getPageCoords(coords).y+scroll.getValue();
@@ -358,7 +363,7 @@ public class StorageOverlay extends GuiElement {
if(doItemRender) {
enchantGlintRenderLocations.clear();
- for(Map.Entry<Integer, Integer> entry : StorageManager.getInstance().storageConfig.displayToStorageIdMap.entrySet()) {
+ for(Map.Entry<Integer, Integer> entry : StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.entrySet()) {
int displayId = entry.getKey();
int storageId = entry.getValue();
@@ -578,7 +583,7 @@ public class StorageOverlay extends GuiElement {
}
GlScissorStack.push(0, guiTop+3, width, guiTop+3+storageViewSize, scaledResolution);
- for(Map.Entry<Integer, Integer> entry : StorageManager.getInstance().storageConfig.displayToStorageIdMap.entrySet()) {
+ for(Map.Entry<Integer, Integer> entry : StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.entrySet()) {
int displayId = entry.getKey();
int storageId = entry.getValue();
@@ -589,14 +594,14 @@ public class StorageOverlay extends GuiElement {
if(coords.y-11 > 3+storageViewSize || coords.y+90 < 3) continue;
StorageManager.StoragePage page = StorageManager.getInstance().getPage(storageId, false);
-
+
if(editingNameId == storageId) {
int len = fontRendererObj.getStringWidth(renameStorageField.getTextDisplay())+10;
renameStorageField.setSize(len, 12);
renameStorageField.render(storageX, storageY-13);
} else {
String pageTitle;
- if(page.customTitle != null && !page.customTitle.isEmpty()) {
+ if(page != null && page.customTitle != null && !page.customTitle.isEmpty()) {
pageTitle = Utils.chromaStringByColourCode(page.customTitle);
} else if(entry.getValue() < 9) {
pageTitle = "Ender Chest Page " + (entry.getValue() + 1);
@@ -948,6 +953,10 @@ public class StorageOverlay extends GuiElement {
}
GlScissorStack.pop(scaledResolution);
+ if(fastRender){
+ fontRendererObj.drawString("Fast render does not work with Storage overlay.", sizeX/2-fontRendererObj.getStringWidth("Fast render does not work with Storage overlay.")/2, -10, 0xFFFF0000);
+ }
+
//Inventory Text
fontRendererObj.drawString("Inventory", 180, storageViewSize+6, textColour);
searchBar.setCustomTextColour(searchTextColour);
@@ -1418,10 +1427,10 @@ public class StorageOverlay extends GuiElement {
for(int j=i; j<i+3; j++) {
if(NotEnoughUpdates.INSTANCE.config.storageGUI.masonryMode && displayId%3 != j%3) continue;
- if(!StorageManager.getInstance().storageConfig.displayToStorageIdMap.containsKey(j)) {
+ if(!StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.containsKey(j)) {
continue;
}
- int storageId = StorageManager.getInstance().storageConfig.displayToStorageIdMap.get(j);
+ int storageId = StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.get(j);
StorageManager.StoragePage page = StorageManager.getInstance().getPage(storageId, false);
if(page == null || page.rows <= 0) {
maxRows = Math.max(maxRows, 3);
@@ -1534,13 +1543,14 @@ public class StorageOverlay extends GuiElement {
if(mouseX > guiLeft+181 && mouseX < guiLeft+181+162 &&
mouseY > guiTop+storageViewSize+18 && mouseY < guiTop+storageViewSize+94) {
+ if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
+ dirty = true;
return false;
}
if(mouseY > guiTop+3 && mouseY < guiTop+storageViewSize+3) {
int currentPage = StorageManager.getInstance().getCurrentPageId();
-
- for(Map.Entry<Integer, Integer> entry : StorageManager.getInstance().storageConfig.displayToStorageIdMap.entrySet()) {
+ for(Map.Entry<Integer, Integer> entry : StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.entrySet()) {
IntPair pageCoords = getPageCoords(entry.getKey());
if(pageCoords.y > storageViewSize+3 || pageCoords.y+90 < 3) continue;
@@ -1695,7 +1705,7 @@ public class StorageOverlay extends GuiElement {
} else if(Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
for(int i=0; i<9; i++) {
int storageId = i;
- int displayId = StorageManager.getInstance().getDisplayIdForStorageId(i);
+ int displayId = StorageManager.getInstance().getDisplayIdForStorageIdRender(i);
StorageManager.StoragePage page = StorageManager.getInstance().getPage(storageId, false);
if(page != null) {
@@ -1712,7 +1722,7 @@ public class StorageOverlay extends GuiElement {
}
for(int i=0; i<18; i++) {
int storageId = i+StorageManager.MAX_ENDER_CHEST_PAGES;
- int displayId = StorageManager.getInstance().getDisplayIdForStorageId(i);
+ int displayId = StorageManager.getInstance().getDisplayIdForStorageIdRender(i);
StorageManager.StoragePage page = StorageManager.getInstance().getPage(storageId, false);
if(page != null) {
@@ -1795,7 +1805,7 @@ public class StorageOverlay extends GuiElement {
}
} else {
int currentPage = StorageManager.getInstance().getCurrentPageId();
- int displayId = StorageManager.getInstance().getDisplayIdForStorageId(currentPage);
+ int displayId = StorageManager.getInstance().getDisplayIdForStorageIdRender(currentPage);
if(displayId >= 0) {
IntPair pageCoords = getPageCoords(displayId);
@@ -1845,7 +1855,7 @@ public class StorageOverlay extends GuiElement {
if(Keyboard.getEventKeyState()) {
if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotLocking &&
- KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.slotLocking.slotLockKey)) {
+ KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.slotLocking.slotLockKey) && !searchBar.getFocus()) {
if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) return true;
GuiContainer container = (GuiContainer) Minecraft.getMinecraft().currentScreen;
@@ -1957,4 +1967,21 @@ public class StorageOverlay extends GuiElement {
GlStateManager.bindTexture(0);
}
+ public void fastRenderCheck(){
+ if(!OpenGlHelper.isFramebufferEnabled()) {
+ this.fastRender = true;
+ NEUEventListener.displayNotification(Lists.newArrayList(
+ "\u00a74Fast Render Warning",
+ "\u00a77Due to the way fast render works, it's not compatible with NEU.",
+ "\u00a77Please disable fast render in your options under",
+ "\u00a77ESC > Options > Video Settings > Performance > Fast Render",
+ "\u00a77This can't be fixed.",
+ "\u00a77",
+ "\u00a77Press X on your keyboard to close this notifcation"), true, true);
+ return;
+ }
+
+ this.fastRender = false;
+ }
+
}