aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorNopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com>2023-03-14 02:30:28 +1100
committerGitHub <noreply@github.com>2023-03-13 16:30:28 +0100
commitd249bbdc8e99bfdab81aa6b215e70c4f21def91e (patch)
tree01f9e57b9e2b46dd9bd345569cb882cc8db974e4 /src/main
parent1bd7d5b87d62045a53ff6f3ea1b66cf71266610f (diff)
downloadNotEnoughUpdates-d249bbdc8e99bfdab81aa6b215e70c4f21def91e.tar.gz
NotEnoughUpdates-d249bbdc8e99bfdab81aa6b215e70c4f21def91e.tar.bz2
NotEnoughUpdates-d249bbdc8e99bfdab81aa6b215e70c4f21def91e.zip
Added option to disable cit while in the storage overlay for fps (#656)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java11
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinOptifineCustomItems.java41
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java9
-rw-r--r--src/main/resources/mixins.notenoughupdates.json1
5 files changed, 62 insertions, 5 deletions
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 bef07399..22dd8a15 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java
@@ -345,7 +345,10 @@ public class StorageManager {
return stack;
}
+ public boolean isStorageOpen = false;
+
public boolean shouldRenderStorageOverlay(String containerName) {
+ isStorageOpen = false;
if (!NotEnoughUpdates.INSTANCE.config.storageGUI.enableStorageGUI3) {
shouldRenderStorageOverlayCached = false;
return false;
@@ -363,10 +366,12 @@ public class StorageManager {
if (getCurrentWindowId() != -1 && getCurrentPageId() != -1) {
shouldRenderStorageOverlayCached = true;
+ isStorageOpen = true;
return true;
}
shouldRenderStorageOverlayCached = containerName != null && containerName.trim().startsWith("Storage");
+ isStorageOpen = shouldRenderStorageOverlayCached;
return shouldRenderStorageOverlayCached;
}
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 ff1d8687..774b935d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java
@@ -56,7 +56,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
-import net.minecraftforge.client.ClientCommandHandler;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -1613,9 +1612,10 @@ public class StorageOverlay extends GuiElement {
break;
case 9:
tooltipToDisplay = createTooltip(
- "Open Full Settings",
- 0,
- "Click To Open"
+ "Disable optifine CIT",
+ !NotEnoughUpdates.INSTANCE.config.storageGUI.disableCIT ? 0 : 1,
+ "CIT Enabled",
+ "CIT Disabled"
);
break;
}
@@ -2029,7 +2029,8 @@ public class StorageOverlay extends GuiElement {
!NotEnoughUpdates.INSTANCE.config.storageGUI.showEnchantGlint;
break;
case 9:
- ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/neu storage gui");
+ NotEnoughUpdates.INSTANCE.config.storageGUI.disableCIT =
+ !NotEnoughUpdates.INSTANCE.config.storageGUI.disableCIT;
break;
}
dirty = true;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinOptifineCustomItems.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinOptifineCustomItems.java
new file mode 100644
index 00000000..965bf185
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinOptifineCustomItems.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.mixins;
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.inventory.GuiChest;
+import net.minecraft.item.ItemStack;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Pseudo;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+@Pseudo
+@Mixin(targets = "net.optifine.CustomItems", remap = false)
+public class MixinOptifineCustomItems {
+ @Inject(method = "getCustomItemProperties", at = @At(value = "HEAD"), cancellable = true)
+ private static void getCustomItemProperties(ItemStack itemStack, int type, CallbackInfoReturnable<?> cir) {
+ if (NotEnoughUpdates.INSTANCE.config.storageGUI.disableCIT && StorageManager.getInstance().isStorageOpen &&
+ Minecraft.getMinecraft().currentScreen instanceof GuiChest) cir.setReturnValue(null);
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java
index 131ac669..c8fba1fb 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java
@@ -183,6 +183,15 @@ public class StorageGUI {
@ConfigAccordionId(id = 1)
public int cancelScrollKey = 0;
+ @Expose
+ @ConfigOption(
+ name = "Disable Optifine CIT",
+ desc = "Disables Optifine custom items to improve performance"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
+ public boolean disableCIT = false;
+
@ConfigOption(
name = "Inventory Backpacks",
desc = "",
diff --git a/src/main/resources/mixins.notenoughupdates.json b/src/main/resources/mixins.notenoughupdates.json
index 279d5cef..16b473fc 100644
--- a/src/main/resources/mixins.notenoughupdates.json
+++ b/src/main/resources/mixins.notenoughupdates.json
@@ -37,6 +37,7 @@
"MixinMinecraft",
"MixinMouseHelper",
"MixinNetHandlerPlayClient",
+ "MixinOptifineCustomItems",
"MixinOFDynamicLights",
"MixinPlayerControllerMP",
"MixinRender",