use of v1_8_9.net.minecraft.util.ChatComponentText in project TecTech by Technus.
the class ChargeCommand method processCommand.
@Override
public void processCommand(ICommandSender sender, String[] args) {
if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) {
EntityPlayerMP player = (EntityPlayerMP) sender;
if (args == null || args.length == 0) {
sender.addChatMessage(new ChatComponentText("Charge amount: " + TecTech.anomalyHandler.getCharge(player)));
return;
}
double amount;
try {
amount = Double.parseDouble(args[0]);
} catch (NumberFormatException e) {
sender.addChatMessage(new ChatComponentText("Cannot parse amount!"));
return;
}
if (player.capabilities.isCreativeMode) {
sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!"));
} else {
TecTech.anomalyHandler.setCharge(player, amount);
sender.addChatMessage(new ChatComponentText("Charge set to: " + amount));
}
}
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project TecTech by Technus.
the class ConvertInteger method processCommand.
@Override
public void processCommand(ICommandSender sender, String[] args) {
if (!sender.getEntityWorld().isRemote) {
if (args.length == 1) {
try {
int value = Integer.parseInt(args[0]);
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + TT_Utility.intBitsToShortString(value) + " " + EnumChatFormatting.RESET + EnumChatFormatting.BLUE + value));
} catch (Exception e) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Invalid Integer " + args[0]));
}
} else {
sender.addChatMessage(new ChatComponentText(getCommandUsage(sender)));
}
}
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project TecTech by Technus.
the class EMList method listClasses.
private void listClasses(ICommandSender sender) {
sender.addChatMessage(new ChatComponentText(" Available Direct: name (use as parameter to learn more"));
TecTech.definitionsRegistry.getDirectTypes().forEach((aClass, emDirectType) -> sender.addChatMessage(new ChatComponentText(emDirectType.getLocalizedName())));
sender.addChatMessage(new ChatComponentText(" Available Indirect: tag - name"));
TecTech.definitionsRegistry.getIndirectBinds().forEach((bind, emIndirectType) -> sender.addChatMessage(new ChatComponentText(bind + " - " + emIndirectType.getLocalizedName())));
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project TecTech by Technus.
the class CancerCommand method processCommand.
@Override
public void processCommand(ICommandSender sender, String[] args) {
if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) {
EntityPlayerMP player = (EntityPlayerMP) sender;
if (args == null || args.length == 0) {
sender.addChatMessage(new ChatComponentText("Cancer amount: " + TecTech.anomalyHandler.getCancer(player)));
return;
}
double amount;
try {
amount = Double.parseDouble(args[0]);
} catch (NumberFormatException e) {
sender.addChatMessage(new ChatComponentText("Cannot parse amount!"));
return;
}
if (player.capabilities.isCreativeMode) {
sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!"));
} else {
TecTech.anomalyHandler.setCancer(player, amount);
sender.addChatMessage(new ChatComponentText("Cancer set to: " + amount));
}
}
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project TecTech by Technus.
the class ConvertFloat method processCommand.
@Override
public void processCommand(ICommandSender sender, String[] args) {
if (!sender.getEntityWorld().isRemote) {
if (args.length == 1) {
try {
float value = Float.parseFloat(args[0]);
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + TT_Utility.intBitsToShortString(Float.floatToIntBits(value)) + " " + EnumChatFormatting.RESET + EnumChatFormatting.BLUE + value));
} catch (Exception e) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Invalid Float " + args[0]));
}
} else {
sender.addChatMessage(new ChatComponentText(getCommandUsage(sender)));
}
}
}
Aggregations