Add CraftTweaker infuseType command

This commit is contained in:
pupnewfster committed 2019-03-13 00:52:51 -04:00
1 parent 13f3db86eb
commit ce1e1b32bf
3 files changed
+42 -9

No files matched your search

@@ -6,7 +6,8 @@ import crafttweaker.mc1120.commands.CTChatCommand;
import java.util.LinkedList;
import java.util.List;
import mekanism.common.Mekanism;
import mekanism.common.integration.crafttweaker.gas.GasesCommand;
import mekanism.common.integration.crafttweaker.commands.GasesCommand;
import mekanism.common.integration.crafttweaker.commands.InfuseTypesCommand;
public class CrafttweakerIntegration {
@@ -39,5 +40,6 @@ public class CrafttweakerIntegration {
public static void registerCommands() {
CTChatCommand.registerCommand(new GasesCommand());
CTChatCommand.registerCommand(new InfuseTypesCommand());
}
}
@@ -1,11 +1,8 @@
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;
package mekanism.common.integration.crafttweaker.commands;
import crafttweaker.CraftTweakerAPI;
import crafttweaker.mc1120.commands.CraftTweakerCommand;
import crafttweaker.mc1120.commands.SpecialMessagesChat;
import java.util.List;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasRegistry;
@@ -21,8 +18,8 @@ public class GasesCommand extends CraftTweakerCommand {
@Override
protected void init() {
setDescription(getClickableCommandText(TextFormatting.DARK_GREEN + "/ct " + subCommandName,
"/ct " + subCommandName, true), getNormalMessage(TextFormatting.DARK_AQUA +
setDescription(SpecialMessagesChat.getClickableCommandText(TextFormatting.DARK_GREEN + "/ct " + subCommandName,
"/ct " + subCommandName, true), SpecialMessagesChat.getNormalMessage(TextFormatting.DARK_AQUA +
"Outputs a list of all registered gases to the crafttweaker.log"));
}
@@ -32,6 +29,7 @@ public class GasesCommand extends CraftTweakerCommand {
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));
sender.sendMessage(SpecialMessagesChat.getLinkToCraftTweakerLog(
"List of " + gases.size() + " gases generated;", sender));
}
}
@@ -0,0 +1,33 @@
package mekanism.common.integration.crafttweaker.commands;
import crafttweaker.CraftTweakerAPI;
import crafttweaker.mc1120.commands.CraftTweakerCommand;
import crafttweaker.mc1120.commands.SpecialMessagesChat;
import java.util.Set;
import mekanism.api.infuse.InfuseRegistry;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.TextFormatting;
public class InfuseTypesCommand extends CraftTweakerCommand {
public InfuseTypesCommand() {
super("infuseTypes");
}
@Override
protected void init() {
setDescription(SpecialMessagesChat.getClickableCommandText(TextFormatting.DARK_GREEN + "/ct " + subCommandName,
"/ct " + subCommandName, true), SpecialMessagesChat.getNormalMessage(TextFormatting.DARK_AQUA +
"Outputs a list of all registered metallurgic infuser infusion types to the crafttweaker.log"));
}
@Override
public void executeCommand(MinecraftServer server, ICommandSender sender, String[] args) {
CraftTweakerAPI.logCommand("Infuse Types:");
Set<String> names = InfuseRegistry.getInfuseMap().keySet();
names.forEach(CraftTweakerAPI::logCommand);
sender.sendMessage(SpecialMessagesChat.getLinkToCraftTweakerLog("List of " + names.size() +
" metallurgic infuser infusion types generated;", sender));
}
}