aboutsummaryrefslogtreecommitdiff
path: root/forge
diff options
context:
space:
mode:
authorhackthetime <l4bg0jb7@duck.com>2023-10-31 14:16:09 +0100
committerhackthetime <l4bg0jb7@duck.com>2023-10-31 14:16:09 +0100
commitf4177d45a792c83cd6fd8fc14d80c9a16b67c3fd (patch)
tree3e864d0ddcc74b027353740d6db4131dd3890240 /forge
parent34eabc9c41cb4d038ac4feb3b2d08bfad013652e (diff)
downloadBBsentials-f4177d45a792c83cd6fd8fc14d80c9a16b67c3fd.tar.gz
BBsentials-f4177d45a792c83cd6fd8fc14d80c9a16b67c3fd.tar.bz2
BBsentials-f4177d45a792c83cd6fd8fc14d80c9a16b67c3fd.zip
worked on 1.8.9 MoulConfig → visual config screen
Diffstat (limited to 'forge')
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBBI.java (renamed from forge/src/main/java/de/hype/bbsentials/forge/client/CommandBBI.java)2
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandOpenConfig.java29
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/Commands.java3
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/ExampleMod.java3
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/client/MoulConfig.java49
5 files changed, 83 insertions, 3 deletions
diff --git a/forge/src/main/java/de/hype/bbsentials/forge/client/CommandBBI.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBBI.java
index 208caa3..99a2a67 100644
--- a/forge/src/main/java/de/hype/bbsentials/forge/client/CommandBBI.java
+++ b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandBBI.java
@@ -1,4 +1,4 @@
-package de.hype.bbsentials.forge.client;
+package de.hype.bbsentials.forge.CommandImplementations;
import de.hype.bbsentials.common.client.BBsentials;
import de.hype.bbsentials.common.client.Config;
diff --git a/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandOpenConfig.java b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandOpenConfig.java
new file mode 100644
index 0000000..acdc683
--- /dev/null
+++ b/forge/src/main/java/de/hype/bbsentials/forge/CommandImplementations/CommandOpenConfig.java
@@ -0,0 +1,29 @@
+package de.hype.bbsentials.forge.CommandImplementations;
+
+import de.hype.bbsentials.forge.ExampleMod;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.ICommandSender;
+
+
+public class CommandOpenConfig extends CommandBase {
+
+ @Override
+ public String getCommandName() {
+ return "bbconfig";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender sender) {
+ return "/bbconfig";
+ }
+
+ @Override
+ public void processCommand(ICommandSender sender, String[] args) {
+ ExampleMod.config.openConfigGui();
+ }
+
+ @Override
+ public boolean canCommandSenderUseCommand(ICommandSender sender) {
+ return true;
+ }
+}
diff --git a/forge/src/main/java/de/hype/bbsentials/forge/Commands.java b/forge/src/main/java/de/hype/bbsentials/forge/Commands.java
index 187823b..34ebb1d 100644
--- a/forge/src/main/java/de/hype/bbsentials/forge/Commands.java
+++ b/forge/src/main/java/de/hype/bbsentials/forge/Commands.java
@@ -6,7 +6,7 @@ import de.hype.bbsentials.common.mclibraries.MCCommand;
import de.hype.bbsentials.common.packets.AbstractPacket;
import de.hype.bbsentials.common.packets.packets.SplashNotifyPacket;
import de.hype.bbsentials.forge.CommandImplementations.*;
-import de.hype.bbsentials.forge.client.CommandBBI;
+import de.hype.bbsentials.forge.CommandImplementations.CommandBBI;
import net.minecraftforge.client.ClientCommandHandler;
public class Commands implements MCCommand {
@@ -24,6 +24,7 @@ public class Commands implements MCCommand {
ClientCommandHandler.instance.registerCommand(new CommandChChest());
ClientCommandHandler.instance.registerCommand(new CommandBC());
ClientCommandHandler.instance.registerCommand(new CommandBingoChat());
+ ClientCommandHandler.instance.registerCommand(new CommandOpenConfig());
}
public void registerRoleRequired(boolean hasDev, boolean hasAdmin, boolean hasMod, boolean hasSplasher, boolean hasBeta, boolean hasMiningEvents, boolean hasChChest) {
diff --git a/forge/src/main/java/de/hype/bbsentials/forge/ExampleMod.java b/forge/src/main/java/de/hype/bbsentials/forge/ExampleMod.java
index ca01526..4e60e69 100644
--- a/forge/src/main/java/de/hype/bbsentials/forge/ExampleMod.java
+++ b/forge/src/main/java/de/hype/bbsentials/forge/ExampleMod.java
@@ -2,6 +2,7 @@ package de.hype.bbsentials.forge;
import de.hype.bbsentials.common.client.BBsentials;
import de.hype.bbsentials.common.mclibraries.EnvironmentCore;
+import de.hype.bbsentials.forge.client.MoulConfig;
import io.github.moulberry.moulconfig.gui.MoulConfigEditor;
import io.github.moulberry.moulconfig.processor.MoulConfigProcessor;
import net.minecraftforge.common.MinecraftForge;
@@ -14,11 +15,11 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class ExampleMod {
static boolean alreadyInialised = false;
static BBsentials sentials = new BBsentials();
+ public static MoulConfig config = new MoulConfig();
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
printLocation();
-
EnvironmentCore core = new EnvironmentCore(new BBUtils(), new ForgeChat(), new MCUtils(), new Commands(), new Options(), new DebugThread());
MinecraftForge.EVENT_BUS.register(this);
}
diff --git a/forge/src/main/java/de/hype/bbsentials/forge/client/MoulConfig.java b/forge/src/main/java/de/hype/bbsentials/forge/client/MoulConfig.java
new file mode 100644
index 0000000..24bca8a
--- /dev/null
+++ b/forge/src/main/java/de/hype/bbsentials/forge/client/MoulConfig.java
@@ -0,0 +1,49 @@
+package de.hype.bbsentials.forge.client;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.moulconfig.Config;
+import io.github.moulberry.moulconfig.annotations.Category;
+import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown;
+import io.github.moulberry.moulconfig.annotations.ConfigOption;
+import io.github.moulberry.moulconfig.gui.GuiScreenElementWrapper;
+import io.github.moulberry.moulconfig.gui.MoulConfigEditor;
+import io.github.moulberry.moulconfig.processor.BuiltinMoulConfigGuis;
+import io.github.moulberry.moulconfig.processor.ConfigProcessorDriver;
+import io.github.moulberry.moulconfig.processor.MoulConfigProcessor;
+import net.minecraft.client.Minecraft;
+
+import static de.hype.bbsentials.common.client.BBsentials.config;
+
+
+public class MoulConfig extends Config {
+ @Expose
+ @ConfigOption(name = "test", desc = "dropdown test")
+ @ConfigEditorDropdown(values = {"hi", "test"})
+ public String test;
+ MoulConfigEditor<MoulConfig> editor;
+ MoulConfigProcessor<MoulConfig> processor;
+ @Expose
+ @Category(name = "First Category", desc = "This is the first category.")
+ MoulConfig main = this;
+
+ public MoulConfig() {
+ processor = new MoulConfigProcessor<>(this);
+ editor = new MoulConfigEditor<>(processor);
+ BuiltinMoulConfigGuis.addProcessors(processor);
+ ConfigProcessorDriver.processConfig(MoulConfig.class, this, processor);
+ }
+
+ @Override
+ public String getTitle() {
+ return "BBsentials " + de.hype.bbsentials.common.client.Config.apiVersion;
+ }
+
+ @Override
+ public void saveNow() {
+ config.save();
+ }
+
+ public void openConfigGui() {
+ Minecraft.getMinecraft().displayGuiScreen(new GuiScreenElementWrapper(editor));
+ }
+}