use of net.minecraft.util.ChatComponentText in project ICBM-Classic by BuiltBrokenModding.
the class TileLauncherScreen method onPlayerActivated.
@Override
public boolean onPlayerActivated(EntityPlayer player, int side, Pos hit) {
if (isServer()) {
boolean notNull = player.getHeldItem() != null;
if (notNull && player.getHeldItem().getItem() == Items.redstone) {
if (canLaunch()) {
launch();
} else {
player.addChatComponentMessage(new ChatComponentText(LanguageUtility.getLocal("chat.launcher.failedToFire")));
String translation = LanguageUtility.getLocal("chat.launcher.status");
translation = translation.replace("%1", getStatus());
player.addChatComponentMessage(new ChatComponentText(translation));
}
} else if (notNull && player.getHeldItem().getItem() instanceof ItemRemoteDetonator) {
((ItemRemoteDetonator) player.getHeldItem().getItem()).setBroadCastHz(player.getHeldItem(), getFrequency());
player.addChatComponentMessage(new ChatComponentText(LanguageUtility.getLocal("chat.launcher.toolFrequencySet").replace("%1", "" + getFrequency())));
} else if (notNull && player.getHeldItem().getItem() instanceof IWorldPosItem) {
IWorldPosition location = ((IWorldPosItem) player.getHeldItem().getItem()).getLocation(player.getHeldItem());
if (location != null) {
if (location.world() == world()) {
setTarget(new Pos(location.x(), location.y(), location.z()));
player.addChatComponentMessage(new ChatComponentText(LanguageUtility.getLocal("chat.launcher.toolTargetSet")));
} else {
player.addChatComponentMessage(new ChatComponentText(LanguageUtility.getLocal("chat.launcher.toolWorldNotMatch")));
}
} else {
player.addChatComponentMessage(new ChatComponentText(LanguageUtility.getLocal("chat.launcher.noTargetInTool")));
}
} else {
player.openGui(ICBMClassic.INSTANCE, 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
}
}
return true;
}
use of net.minecraft.util.ChatComponentText in project LogisticsPipes by RS485.
the class MeCommand method executeCommand.
@Override
public void executeCommand(ICommandSender sender, String[] args) {
DebugGuiController.instance().startWatchingOf(sender, (EntityPlayer) sender);
sender.addChatMessage(new ChatComponentText("Starting SelfDebuging"));
}
use of net.minecraft.util.ChatComponentText in project LogisticsPipes by RS485.
the class PipeCommand method executeCommand.
@Override
public void executeCommand(ICommandSender sender, String[] args) {
if (args.length != 1) {
sender.addChatMessage(new ChatComponentText("Wrong amount of arguments"));
return;
}
if (args[0].equalsIgnoreCase("help")) {
sender.addChatMessage(new ChatComponentText("client, server, both or console"));
} else if (args[0].equalsIgnoreCase("both")) {
MainProxy.sendPacketToPlayer(PacketHandler.getPacket(PipeDebugAskForTarget.class).setServer(true), (EntityPlayer) sender);
MainProxy.sendPacketToPlayer(PacketHandler.getPacket(PipeDebugAskForTarget.class).setServer(false), (EntityPlayer) sender);
sender.addChatMessage(new ChatComponentText("Asking for Target."));
} else if (args[0].equalsIgnoreCase("console") || args[0].equalsIgnoreCase("c")) {
MainProxy.sendPacketToPlayer(PacketHandler.getPacket(PipeDebugLogAskForTarget.class), (EntityPlayer) sender);
sender.addChatMessage(new ChatComponentText("Asking for Target."));
} else {
boolean isClient = args[0].equalsIgnoreCase("client");
MainProxy.sendPacketToPlayer(PacketHandler.getPacket(PipeDebugAskForTarget.class).setServer(!isClient), (EntityPlayer) sender);
sender.addChatMessage(new ChatComponentText("Asking for Target."));
}
}
use of net.minecraft.util.ChatComponentText in project LogisticsPipes by RS485.
the class ShowCommand method executeCommand.
@Override
public void executeCommand(ICommandSender sender, String[] args) {
if (args.length != 1) {
sender.addChatMessage(new ChatComponentText("Wrong amount of arguments"));
return;
}
String name = args[0];
List<AbstractWrapper> list = new ArrayList<>(LogisticsWrapperHandler.wrapperController);
Iterator<AbstractWrapper> iter = list.iterator();
while (iter.hasNext()) {
AbstractWrapper item = iter.next();
if (item.getState() != WrapperState.Exception) {
iter.remove();
}
}
iter = list.iterator();
while (iter.hasNext()) {
AbstractWrapper item = iter.next();
if (!(item.getName() + item.getTypeName()).startsWith(name)) {
iter.remove();
}
}
if (list.size() > 1) {
sender.addChatMessage(new ChatComponentText("Possible: "));
for (AbstractWrapper can : list) {
sender.addChatMessage(new ChatComponentText(can.getName() + can.getTypeName()));
}
} else if (list.isEmpty()) {
sender.addChatMessage(new ChatComponentText("No match found"));
} else {
AbstractWrapper wrapper = list.get(0);
Throwable t = wrapper.getReason();
if (t == null) {
sender.addChatMessage(new ChatComponentText("null"));
return;
} else {
sender.addChatMessage(new ChatComponentText("-----------------------------------------------------"));
sender.addChatMessage(new ChatComponentText(t.toString()));
for (StackTraceElement s : t.getStackTrace()) {
sender.addChatMessage(new ChatComponentText(" " + s.toString()));
}
t.printStackTrace();
}
}
}
use of net.minecraft.util.ChatComponentText in project LogisticsPipes by RS485.
the class ChangelogCommand method executeCommand.
@Override
public void executeCommand(ICommandSender sender, String[] args) {
VersionChecker versionChecker = LogisticsPipes.versionChecker;
String statusMessage = versionChecker.getVersionCheckerStatus();
if (versionChecker.isVersionCheckDone() && versionChecker.getVersionInfo().isNewVersionAvailable()) {
VersionChecker.VersionInfo versionInfo = versionChecker.getVersionInfo();
MorePageDisplay display = new MorePageDisplay(new String[] { "(The newest version is #" + versionInfo.getNewestBuild() + ")", "< Changelog Page %/$ >" }, sender);
if (versionInfo.getChangelog().isEmpty()) {
display.append("No commits since your version.");
} else {
versionInfo.getChangelog().forEach(display::append);
}
display.display(sender);
} else {
sender.addChatMessage(new ChatComponentText(statusMessage));
}
}
Aggregations