mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Added satellite list command
This commit is contained in:
parent
59d54942a3
commit
fffad80638
@ -8,6 +8,7 @@ import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatStyle;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
@ -25,8 +26,10 @@ public class CommandSatellites extends CommandBase {
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender iCommandSender) {
|
||||
return String.format(Locale.US,
|
||||
"%s/%s orbit %s- Launch the held satellite\n" +
|
||||
"%s/%s descend <frequency> %s- Deletes satellite by frequency.",
|
||||
"%s/%s orbit %s- Launch the held satellite.\n" +
|
||||
"%s/%s descend <frequency> %s- Deletes satellite by frequency.\n"+
|
||||
"%s/%s list %s- Lists all active satellites.",
|
||||
EnumChatFormatting.GREEN, getCommandName(), EnumChatFormatting.LIGHT_PURPLE,
|
||||
EnumChatFormatting.GREEN, getCommandName(), EnumChatFormatting.LIGHT_PURPLE,
|
||||
EnumChatFormatting.GREEN, getCommandName(), EnumChatFormatting.LIGHT_PURPLE
|
||||
);
|
||||
@ -65,6 +68,22 @@ public class CommandSatellites extends CommandBase {
|
||||
sender.addChatMessage(new ChatComponentTranslation( "commands.satellite.no_satellite").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
|
||||
}
|
||||
break;
|
||||
case "list":
|
||||
data = SatelliteSavedData.getData(sender.getEntityWorld());
|
||||
if (data.sats.isEmpty()) {
|
||||
ChatComponentTranslation message = new ChatComponentTranslation("commands.satellite.no_active_satellites");
|
||||
message.getChatStyle().setColor(EnumChatFormatting.RED);
|
||||
sender.addChatMessage(message);
|
||||
} else {
|
||||
data.sats.forEach((listFreq, sat) -> {
|
||||
String messageText = String.valueOf(listFreq) + " - " + sat.getClass().getSimpleName();
|
||||
ChatComponentText message = new ChatComponentText(messageText);
|
||||
message.getChatStyle().setColor(EnumChatFormatting.GREEN);
|
||||
sender.addChatMessage(message);
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +97,7 @@ public class CommandSatellites extends CommandBase {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if(args.length == 1) {
|
||||
return getListOfStringsMatchingLastWord(args, "orbit", "descend");
|
||||
return getListOfStringsMatchingLastWord(args, "orbit", "descend","list");
|
||||
}
|
||||
if (args[0].equals("descend")) {
|
||||
return getListOfStringsFromIterableMatchingLastWord(args, SatelliteSavedData.getData(sender.getEntityWorld()).sats.keySet().stream().map(String::valueOf).collect(Collectors.toList()));
|
||||
|
||||
@ -675,6 +675,7 @@ chem.XENON=Linde Xenon Cycle
|
||||
chem.XENON_OXY=Boosted Linde Xenon Cycle
|
||||
chem.YELLOWCAKE=Yellowcake Production
|
||||
|
||||
commands.satellite.no_active_satellites=No active satellites found!
|
||||
commands.satellite.no_satellite=No satellite using this frequency found!
|
||||
commands.satellite.not_a_satellite=The held item is not a satellite!
|
||||
commands.satellite.satellite_descended=Satellite successfully descended.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user