mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
CraftTweaker gases sub command. Implements #10
This commit is contained in:
4 files changed
+45
-1
No files matched your search
@@ -94,6 +94,7 @@ public final class MekanismHooks {
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("crafttweaker")) {
|
||||
CrafttweakerIntegration.registerCommands();
|
||||
CrafttweakerIntegration.applyRecipeChanges();
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
@@ -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<Gas> gases = GasRegistry.getRegisteredGasses();
|
||||
gases.forEach(
|
||||
gas -> CraftTweakerAPI.logCommand(String.format("<gas:%s>, %s", gas.getName(), gas.getLocalizedName())));
|
||||
sender.sendMessage(getLinkToCraftTweakerLog("List of " + gases.size() + " gases generated;", sender));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user