diff --git a/build.gradle b/build.gradle index 2e5c13e75..ac5b09311 100644 --- a/build.gradle +++ b/build.gradle @@ -128,7 +128,7 @@ dependencies { compileOnly ("CraftTweaker2:CraftTweaker2-API:${config.crafttweaker_version}") { exclude module: "asm-debug-all" } - runtime ("CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-${config.crafttweaker_version}") { + deobfCompile ("CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-${config.crafttweaker_version}") { exclude module: "asm-debug-all" } compileOnly "com.blamejared:MTLib:${config.mtlib_version}" diff --git a/src/main/java/mekanism/common/integration/MekanismHooks.java b/src/main/java/mekanism/common/integration/MekanismHooks.java index a7bc345dc..4afc47ffd 100644 --- a/src/main/java/mekanism/common/integration/MekanismHooks.java +++ b/src/main/java/mekanism/common/integration/MekanismHooks.java @@ -94,6 +94,7 @@ public final class MekanismHooks { } if (Loader.isModLoaded("crafttweaker")) { + CrafttweakerIntegration.registerCommands(); CrafttweakerIntegration.applyRecipeChanges(); } diff --git a/src/main/java/mekanism/common/integration/crafttweaker/CrafttweakerIntegration.java b/src/main/java/mekanism/common/integration/crafttweaker/CrafttweakerIntegration.java index 0952d5aa4..d2da22356 100644 --- a/src/main/java/mekanism/common/integration/crafttweaker/CrafttweakerIntegration.java +++ b/src/main/java/mekanism/common/integration/crafttweaker/CrafttweakerIntegration.java @@ -2,9 +2,11 @@ package mekanism.common.integration.crafttweaker; import crafttweaker.CraftTweakerAPI; import crafttweaker.IAction; +import crafttweaker.mc1120.commands.CTChatCommand; import java.util.LinkedList; import java.util.List; import mekanism.common.Mekanism; +import mekanism.common.integration.crafttweaker.gas.GasesCommand; public class CrafttweakerIntegration { @@ -34,4 +36,8 @@ public class CrafttweakerIntegration { } }); } + + public static void registerCommands() { + CTChatCommand.registerCommand(new GasesCommand()); + } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/integration/crafttweaker/gas/GasesCommand.java b/src/main/java/mekanism/common/integration/crafttweaker/gas/GasesCommand.java new file mode 100644 index 000000000..5e402c004 --- /dev/null +++ b/src/main/java/mekanism/common/integration/crafttweaker/gas/GasesCommand.java @@ -0,0 +1,37 @@ +package mekanism.common.integration.crafttweaker.gas; + +import static crafttweaker.mc1120.commands.SpecialMessagesChat.getClickableCommandText; +import static crafttweaker.mc1120.commands.SpecialMessagesChat.getLinkToCraftTweakerLog; +import static crafttweaker.mc1120.commands.SpecialMessagesChat.getNormalMessage; + +import crafttweaker.CraftTweakerAPI; +import crafttweaker.mc1120.commands.CraftTweakerCommand; +import java.util.List; +import mekanism.api.gas.Gas; +import mekanism.api.gas.GasRegistry; +import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.text.TextFormatting; + +public class GasesCommand extends CraftTweakerCommand { + + public GasesCommand() { + super("gases"); + } + + @Override + protected void init() { + setDescription(getClickableCommandText(TextFormatting.DARK_GREEN + "/ct " + subCommandName, + "/ct " + subCommandName, true), getNormalMessage(TextFormatting.DARK_AQUA + + "Outputs a list of all registered gases to the crafttweaker.log")); + } + + @Override + public void executeCommand(MinecraftServer server, ICommandSender sender, String[] args) { + CraftTweakerAPI.logCommand("Gases:"); + List gases = GasRegistry.getRegisteredGasses(); + gases.forEach( + gas -> CraftTweakerAPI.logCommand(String.format(", %s", gas.getName(), gas.getLocalizedName()))); + sender.sendMessage(getLinkToCraftTweakerLog("List of " + gases.size() + " gases generated;", sender)); + } +} \ No newline at end of file