aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-02-06 22:35:27 +0100
committernea <nea@nea.moe>2023-02-06 22:35:27 +0100
commitdc355f2989b03551744aaa5d6fe7a5b11ff69990 (patch)
tree64e3789e7bd0e41fb0ea430ce95c9735d3ae20bf /src
parentfaee1d0a6e1cdab67fba2a496fed440616d9e812 (diff)
downloadNotEnoughUpdates-dc355f2989b03551744aaa5d6fe7a5b11ff69990.tar.gz
NotEnoughUpdates-dc355f2989b03551744aaa5d6fe7a5b11ff69990.tar.bz2
NotEnoughUpdates-dc355f2989b03551744aaa5d6fe7a5b11ff69990.zip
Finish up
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/ClientCommandBase.java46
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java37
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/EntityViewerCommand.java100
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/ScreenCommand.java45
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.kt1
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/ScreenOpenCommands.kt52
7 files changed, 52 insertions, 232 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 935a4638..35bb40bf 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -25,7 +25,6 @@ import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.autosubscribe.AutoLoad;
import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
-import io.github.moulberry.notenoughupdates.commands.Commands;
import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager;
import io.github.moulberry.notenoughupdates.listener.ChatListener;
@@ -159,7 +158,6 @@ public class NotEnoughUpdates {
public Navigation navigation = new Navigation(this);
public GuiScreen openGui = null;
public long lastOpenedGui = 0;
- public Commands commands;
public boolean packDevEnabled = false;
public Color[][] colourMap = null;
public AutoUpdater autoUpdater = new AutoUpdater(this);
@@ -283,7 +281,6 @@ public class NotEnoughUpdates {
}
BrigadierRoot.INSTANCE.updateHooks();
- this.commands = new Commands();
BackgroundBlur.registerListener();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/ClientCommandBase.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/ClientCommandBase.java
deleted file mode 100644
index e0ae7a1a..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/ClientCommandBase.java
+++ /dev/null
@@ -1,46 +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 <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands;
-
-import net.minecraft.command.CommandBase;
-import net.minecraft.command.ICommandSender;
-
-public abstract class ClientCommandBase extends CommandBase {
- private final String name;
-
- protected ClientCommandBase(String name) {
- this.name = name;
- }
-
- @Override
- public String getCommandName() {
- return name;
- }
-
- @Override
- public String getCommandUsage(ICommandSender sender) {
- return "/" + name;
- }
-
- @Override
- public boolean canCommandSenderUseCommand(ICommandSender sender) {
- return true;
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java
deleted file mode 100644
index 459b6b83..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java
+++ /dev/null
@@ -1,37 +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 <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands;
-
-import io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour;
-import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor;
-import io.github.moulberry.notenoughupdates.miscgui.NEUOverlayPlacements;
-import net.minecraftforge.client.ClientCommandHandler;
-
-public class Commands {
- public Commands() {
-
- // Profile Commands
-
- // Misc Commands
- ClientCommandHandler.instance.registerCommand(new ScreenCommand("neubuttons", GuiInvButtonEditor::new));
- ClientCommandHandler.instance.registerCommand(new ScreenCommand("neuec", GuiEnchantColour::new));
- ClientCommandHandler.instance.registerCommand(new ScreenCommand("neuoverlay", NEUOverlayPlacements::new));
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/EntityViewerCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/EntityViewerCommand.java
deleted file mode 100644
index e3738661..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/EntityViewerCommand.java
+++ /dev/null
@@ -1,100 +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 <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands;
-
-import com.google.common.collect.Lists;
-import io.github.moulberry.notenoughupdates.miscfeatures.entityviewer.EntityViewer;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.event.ClickEvent;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.ChatStyle;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.ResourceLocation;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.fml.common.gameevent.TickEvent;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedDeque;
-
-public class EntityViewerCommand extends ClientCommandBase {
- public EntityViewerCommand() {
- super("neushowentity");
- MinecraftForge.EVENT_BUS.register(this);
- }
-
- @Override
- public List<String> getCommandAliases() {
- return Lists.newArrayList("neuentityviewer");
- }
-
- @Override
- public String getCommandUsage(ICommandSender sender) {
- return EnumChatFormatting.RED + "Use /neushowentity list";
- }
-
- public void showUsage(ICommandSender sender) {
- sender.addChatMessage(new ChatComponentText(getCommandUsage(sender)));
- }
-
- private final Queue<EntityViewer> queuedGUIS = new ConcurrentLinkedDeque<>();
-
- @SubscribeEvent
- public void onTick(TickEvent event) {
- if (Minecraft.getMinecraft().currentScreen == null) {
- EntityViewer poll = queuedGUIS.poll();
- if (poll == null) return;
- Minecraft.getMinecraft().displayGuiScreen(poll);
- }
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] strings) throws CommandException {
- if (strings.length == 0) {
- showUsage(sender);
- return;
- }
- if (strings[0].equals("list")) {
- for (String label : EntityViewer.validEntities.keySet()) {
- sender.addChatMessage(new ChatComponentText(EnumChatFormatting.BLUE + " " + label)
- .setChatStyle(new ChatStyle().setChatClickEvent(
- new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/neuentityviewer " + label))));
- }
- return;
- }
- EntityLivingBase entityLivingBase;
- if (strings[0].startsWith("@")) {
- ResourceLocation resourceLocation = new ResourceLocation(strings[0].substring(1));
- entityLivingBase = EntityViewer.constructEntity(resourceLocation);
- } else {
- entityLivingBase = EntityViewer.constructEntity(strings[0], Arrays.copyOfRange(strings, 1, strings.length));
- }
- if (entityLivingBase == null) {
- sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Could not create that entity"));
- return;
- }
- queuedGUIS.add(new EntityViewer(strings[0], entityLivingBase));
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/ScreenCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/ScreenCommand.java
deleted file mode 100644
index 1b90e5df..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/ScreenCommand.java
+++ /dev/null
@@ -1,45 +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 <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-
-public class ScreenCommand extends ClientCommandBase {
-
- private final ScreenOpener opener;
-
- protected ScreenCommand(String name, ScreenOpener opener) {
- super(name);
- this.opener = opener;
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- NotEnoughUpdates.INSTANCE.openGui = opener.open();
- }
-
- @FunctionalInterface
- public interface ScreenOpener {
- GuiScreen open();
- }
-}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.kt
index 8c15eee0..c7d80487 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.kt
@@ -56,7 +56,6 @@ class AhCommand {
if (search.isBlank() && NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.saveLastSearch)
null else search
)
-
}
}
hook.beforeCommand = Predicate {
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/ScreenOpenCommands.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/ScreenOpenCommands.kt
new file mode 100644
index 00000000..7a9b8d0e
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/ScreenOpenCommands.kt
@@ -0,0 +1,52 @@
+/*
+ * 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.commands.misc
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour
+import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor
+import io.github.moulberry.notenoughupdates.miscgui.NEUOverlayPlacements
+import io.github.moulberry.notenoughupdates.util.brigadier.thenExecute
+import io.github.moulberry.notenoughupdates.util.brigadier.withHelp
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+@NEUAutoSubscribe
+class ScreenOpenCommands {
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ event.command("neubuttons") {
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.openGui = GuiInvButtonEditor()
+ }
+ }.withHelp("Open the NEU inventory button editor")
+ event.command("neuec") {
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.openGui = GuiEnchantColour()
+ }
+ }.withHelp("Open the NEU custom enchant colour editor")
+ event.command("neuoverlay") {
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.openGui = NEUOverlayPlacements()
+ }
+ }.withHelp("Open the NEU gui overlay editor")
+ }
+}