From 18255a0e473092d0f389507a19944a7ddfc8078d Mon Sep 17 00:00:00 2001 From: NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> Date: Wed, 14 Sep 2022 22:30:25 +1000 Subject: Added chat message to let players turn on the storage gui if they accidentally turned it off (#273) * Added a chat message to turn the storage gui back on after turning it off in said storage gui * remove the skyclient mixin * map on by default --- .../notenoughupdates/commands/Commands.java | 2 ++ .../commands/dev/EnableStorageCommand.java | 39 ++++++++++++++++++++++ .../notenoughupdates/miscgui/StorageOverlay.java | 14 ++++++++ .../mixins/MixinSkyclientCosmetics.java | 39 ---------------------- .../options/seperateSections/DungeonMapConfig.java | 2 +- 5 files changed, 56 insertions(+), 40 deletions(-) create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/commands/dev/EnableStorageCommand.java delete mode 100644 src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinSkyclientCosmetics.java (limited to 'src/main/java/io') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java index fcb2aaf9..62981a30 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java @@ -23,6 +23,7 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.commands.dev.DevTestCommand; import io.github.moulberry.notenoughupdates.commands.dev.DiagCommand; import io.github.moulberry.notenoughupdates.commands.dev.DungeonWinTestCommand; +import io.github.moulberry.notenoughupdates.commands.dev.EnableStorageCommand; import io.github.moulberry.notenoughupdates.commands.dev.NullzeeSphereCommand; import io.github.moulberry.notenoughupdates.commands.dev.PackDevCommand; import io.github.moulberry.notenoughupdates.commands.dev.ReloadRepoCommand; @@ -74,6 +75,7 @@ public class Commands { ClientCommandHandler.instance.registerCommand(new DiagCommand()); ClientCommandHandler.instance.registerCommand(new ReloadRepoCommand()); ClientCommandHandler.instance.registerCommand(new ResetRepoCommand()); + ClientCommandHandler.instance.registerCommand(new EnableStorageCommand()); // Profile Commands ClientCommandHandler.instance.registerCommand(new PeekCommand()); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/EnableStorageCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/EnableStorageCommand.java new file mode 100644 index 00000000..3415b030 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/EnableStorageCommand.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2022 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 . + */ + +package io.github.moulberry.notenoughupdates.commands.dev; + +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.commands.ClientCommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; + +public class EnableStorageCommand extends ClientCommandBase { + + public EnableStorageCommand() { + super("neuenablestorage"); + } + + @Override + public void processCommand(ICommandSender sender, String[] args) throws CommandException { + NotEnoughUpdates.INSTANCE.config.storageGUI.enableStorageGUI3 = true; + NotEnoughUpdates.INSTANCE.saveConfig(); + } + +} 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 27fea377..8878c284 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -45,13 +45,17 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.shader.Framebuffer; +import net.minecraft.event.ClickEvent; +import net.minecraft.event.HoverEvent; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.ClientCommandHandler; import org.lwjgl.input.Keyboard; @@ -1966,6 +1970,16 @@ public class StorageOverlay extends GuiElement { switch (buttonIndex) { case 0: NotEnoughUpdates.INSTANCE.config.storageGUI.enableStorageGUI3 = false; + ChatComponentText storageMessage = new ChatComponentText( + EnumChatFormatting.YELLOW + "[NEU] " + EnumChatFormatting.YELLOW + + "You just disabled the custom storage gui, did you mean to do that? If not click this message to turn it back on."); + storageMessage.setChatStyle(Utils.createClickStyle(ClickEvent.Action.RUN_COMMAND, "/neuenablestorage")); + storageMessage.setChatStyle(storageMessage.getChatStyle().setChatHoverEvent( + new HoverEvent(HoverEvent.Action.SHOW_TEXT, + new ChatComponentText(EnumChatFormatting.YELLOW + "Click to enable the custom storage gui.")))); + ChatComponentText storageChatMessage = new ChatComponentText(""); + storageChatMessage.appendSibling(storageMessage); + Minecraft.getMinecraft().thePlayer.addChatMessage(storageChatMessage); break; case 1: int size = diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinSkyclientCosmetics.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinSkyclientCosmetics.java deleted file mode 100644 index 32c9f418..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinSkyclientCosmetics.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2022 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 . - */ - -package io.github.moulberry.notenoughupdates.mixins; - -import net.minecraftforge.event.world.WorldEvent; -import org.spongepowered.asm.mixin.Dynamic; -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.CallbackInfo; - -@Pseudo -@Mixin(targets = "co.skyclient.scc.SkyclientCosmetics") -public class MixinSkyclientCosmetics { - - @Dynamic - @Inject(method = "onWorldLoad", at = @At("HEAD"), cancellable = true, remap = false) - public void onWorldLoad(WorldEvent.Load event, CallbackInfo ci) { - ci.cancel(); - } -} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/DungeonMapConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/DungeonMapConfig.java index 4397c02e..8e211bd6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/DungeonMapConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/DungeonMapConfig.java @@ -73,7 +73,7 @@ public class DungeonMapConfig { name = "Show Dungeon Map", desc = "Show/hide the NEU dungeon map" ) - public boolean dmEnable = false; + public boolean dmEnable = true; @Expose @ConfigOption( -- cgit