diff options
Diffstat (limited to 'src/main/java/io')
4 files changed, 61 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 = "", |