diff options
author | DoKM <mcazzyman@gmail.com> | 2021-08-04 11:29:08 +0200 |
---|---|---|
committer | DoKM <mcazzyman@gmail.com> | 2021-08-04 11:29:08 +0200 |
commit | c4dc513754fa99c424a86768226fcbcdfa4bc8ce (patch) | |
tree | 2402f5809c8d0fbfcc4add8402b6189d826473ae /src/main/java/io | |
parent | 3ccbd6bb51f781d8c18d0389e5d8e79391b7c56c (diff) | |
download | NotEnoughUpdates-c4dc513754fa99c424a86768226fcbcdfa4bc8ce.tar.gz NotEnoughUpdates-c4dc513754fa99c424a86768226fcbcdfa4bc8ce.tar.bz2 NotEnoughUpdates-c4dc513754fa99c424a86768226fcbcdfa4bc8ce.zip |
Fix fastrender check and add fast render warning to storage overlay
Diffstat (limited to 'src/main/java/io')
3 files changed, 37 insertions, 30 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 3b78c2c9..7c807cf4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -609,21 +609,10 @@ public class NotEnoughUpdates { SimpleCommand.ProcessCommandRunnable viewProfileRunnable = new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { - if(Loader.isModLoaded("optifine") && - new File(Minecraft.getMinecraft().mcDataDir, "optionsof.txt").exists()) { - try(InputStream in = new FileInputStream(new File(Minecraft.getMinecraft().mcDataDir, "optionsof.txt"))) { - BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); - - String line; - while((line = reader.readLine()) != null) { - if(line.contains("ofFastRender:true")) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "Some parts of the profile viewer do not work with OF Fast Render. Go to Video > Performance to disable it.")); - break; - } - } - } catch(Exception e) { - } + if(!OpenGlHelper.isFramebufferEnabled()) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + + "Some parts of the profile viewer do not work with OF Fast Render. Go to Video > Performance to disable it.")); + } if (config.apiKey.apiKey == null || config.apiKey.apiKey.trim().isEmpty()) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + @@ -1046,21 +1035,10 @@ public class NotEnoughUpdates { SimpleCommand cosmeticsCommand = new SimpleCommand("neucosmetics", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { - if(Loader.isModLoaded("optifine") && - new File(Minecraft.getMinecraft().mcDataDir, "optionsof.txt").exists()) { - try(InputStream in = new FileInputStream(new File(Minecraft.getMinecraft().mcDataDir, "optionsof.txt"))) { - BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); - - String line; - while((line = reader.readLine()) != null) { - if(line.contains("ofFastRender:true")) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "NEU cosmetics do not work with OF Fast Render. Go to Video > Performance to disable it.")); - return; - } - } - } catch(Exception e) { - } + if(!OpenGlHelper.isFramebufferEnabled()) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + + "NEU cosmetics do not work with OF Fast Render. Go to Video > Performance to disable it.")); + } openGui = new GuiCosmetics(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java index 3253f08a..03e6b98e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java @@ -444,7 +444,10 @@ public class StorageManager { } } else { StorageOverlay.getInstance().clearSearch(); + return; } + StorageOverlay.getInstance().fastRenderCheck(); + } public void closeWindowPacket(S2EPacketCloseWindow packet) { 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..352c000d 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; @@ -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); @@ -1957,4 +1966,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", + "\u00a77Options -> 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; + } + } |