diff options
| author | unknown <james.jenour@protonmail.com> | 2020-07-05 07:17:21 +1000 |
|---|---|---|
| committer | unknown <james.jenour@protonmail.com> | 2020-07-05 07:17:21 +1000 |
| commit | 009ed0ef14d3a5fd75be17ed2c90688202e69c85 (patch) | |
| tree | a419b25440e6944f2cfff7f0f7279deea011b407 /src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java | |
| parent | bd6f658c6c53d160c40bc3b5fdead7b7b3dd20c4 (diff) | |
| download | notenoughupdates-009ed0ef14d3a5fd75be17ed2c90688202e69c85.tar.gz notenoughupdates-009ed0ef14d3a5fd75be17ed2c90688202e69c85.tar.bz2 notenoughupdates-009ed0ef14d3a5fd75be17ed2c90688202e69c85.zip | |
1.9
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java index 1c21e342..707e392b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java @@ -5,7 +5,7 @@ import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.NEUManager; import io.github.moulberry.notenoughupdates.NEUOverlay; import io.github.moulberry.notenoughupdates.NEUResourceManager; -import io.github.moulberry.notenoughupdates.Utils; +import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; @@ -14,12 +14,10 @@ import net.minecraft.client.shader.Shader; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.Matrix4f; -import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import java.awt.*; -import java.text.NumberFormat; import java.util.*; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; @@ -37,6 +35,9 @@ public class CollectionLogInfoPane extends ScrollableInfoPane { private int buttonHover = -1; + private int previousAcquiredCount = 0; + private int previousScroll = 0; + private static final int FILTER_ALL = 0; private static final int FILTER_WEAPON = 1; private static final int FILTER_ARMOR = 2; @@ -243,6 +244,12 @@ public class CollectionLogInfoPane extends ScrollableInfoPane { return projMatrix; } + public int getCurrentAcquiredCount() { + if(getAcquiredItems() == null) return 0; + if(!getAcquiredItems().containsKey(manager.currentProfile)) return 0; + return getAcquiredItems().get(manager.currentProfile).size(); + } + private void renderCollectionLog(Color fg, int width, int height, int left, int right, int top, int bottom) { ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft()); @@ -261,8 +268,14 @@ public class CollectionLogInfoPane extends ScrollableInfoPane { scaledresolution.getScaleFactor()); itemFramebufferGrayscale = checkFramebufferSizes(itemFramebufferGrayscale, width, height, scaledresolution.getScaleFactor()); - renderItemsToImage(itemFramebuffer, fg, left+5, right, top+1, bottom); - renderItemBGToImage(itemBGFramebuffer, fg, left+5, right, top+1, bottom); + + if(!manager.config.cacheRenderedItempane.value || previousAcquiredCount != getCurrentAcquiredCount() || + previousScroll != scrollHeight.getValue()) { + renderItemsToImage(itemFramebuffer, fg, left+5, right, top+1, bottom); + renderItemBGToImage(itemBGFramebuffer, fg, left+5, right, top+1, bottom); + } + previousAcquiredCount = getCurrentAcquiredCount(); + previousScroll = scrollHeight.getValue(); Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(true); renderFromImage(itemBGFramebuffer, width, height, left, right, top, bottom); |
