use of v1_8_9.net.minecraft.util.ChatComponentText in project Armourers-Workshop by RiskyKen.
the class UndoManager method undoPressed.
public static void undoPressed(EntityPlayer player) {
String key = player.getCommandSenderName();
if (!playerUndoData.containsKey(key)) {
String outOfUndosText = StatCollector.translateToLocal("chat." + LibModInfo.ID.toLowerCase() + ":undo.outOfUndos");
player.addChatMessage(new ChatComponentText(outOfUndosText));
return;
}
PlayerUndoData playerData = playerUndoData.get(key);
World world = player.worldObj;
String undoText = StatCollector.translateToLocal("chat." + LibModInfo.ID.toLowerCase() + ":undo.undoing");
player.addChatMessage(new ChatComponentText(undoText));
playerData.playerPressedUndo(world);
if (playerData.getAvalableUndos() < 1) {
playerUndoData.remove(key);
}
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project Armourers-Workshop by RiskyKen.
the class SkinIOUtils method updateSkins.
public static void updateSkins(EntityPlayer player) {
File updateDir = new File(System.getProperty("user.dir"), "skin-update");
if (!updateDir.exists() & updateDir.isDirectory()) {
player.addChatComponentMessage(new ChatComponentText("Directory skin-update not found."));
return;
}
File outputDir = new File(updateDir, "updated");
if (!outputDir.exists()) {
outputDir.mkdir();
}
File[] skinFiles = updateDir.listFiles();
player.addChatComponentMessage(new ChatComponentText(String.format("Found %d skins to be updated.", skinFiles.length)));
player.addChatComponentMessage(new ChatComponentText("Working..."));
int successCount = 0;
int failCount = 0;
for (int i = 0; i < skinFiles.length; i++) {
File skinFile = skinFiles[i];
if (skinFile.isFile()) {
Skin skin = loadSkinFromFile(skinFile);
if (skin != null) {
if (saveSkinToFile(new File(outputDir, skinFile.getName()), skin)) {
successCount++;
} else {
ModLogger.log(Level.ERROR, "Failed to update skin " + skinFile.getName());
failCount++;
}
} else {
ModLogger.log(Level.ERROR, "Failed to update skin " + skinFile.getName());
failCount++;
}
}
}
player.addChatComponentMessage(new ChatComponentText("Finished skin update."));
player.addChatComponentMessage(new ChatComponentText(String.format("%d skins were updated and %d failed.", successCount, failCount)));
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project ct.js by ChatTriggers.
the class ChatLib method editChat.
/**
* Edits an already sent chat message
*
* @param chatMessage the unformatted text of the message to be replaced
* @param toReplace the new message to be put in replace of the old one
*/
public static void editChat(String chatMessage, String toReplace, boolean once) {
List<ChatLine> drawnChatLines = ReflectionHelper.getPrivateValue(GuiNewChat.class, Client.getChatGUI(), "drawnChatLines", "field_146252_h");
List<ChatLine> chatLines = ReflectionHelper.getPrivateValue(GuiNewChat.class, Client.getChatGUI(), "chatLines", "field_146252_h");
ChatComponentText cct = new ChatComponentText(addColor(toReplace));
for (ChatLine chatLine : drawnChatLines) {
if (removeFormatting(chatLine.getChatComponent().getUnformattedText()).equals(chatMessage)) {
ReflectionHelper.setPrivateValue(ChatLine.class, chatLine, cct, "lineString", "field_74541_b");
if (once)
break;
}
}
for (ChatLine chatLine : chatLines) {
if (removeFormatting(chatLine.getChatComponent().getUnformattedText()).equals(chatMessage)) {
ReflectionHelper.setPrivateValue(ChatLine.class, chatLine, cct, "lineString", "field_74541_b");
if (once)
break;
}
}
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project ct.js by ChatTriggers.
the class TextComponent method reInstance.
// helper method to re-instance the component
private void reInstance() {
String text = this.text;
if (this.formatted)
text = ChatLib.addColor(text);
this.chatComponentText = new ChatComponentText(text);
reInstanceClick();
reInstanceHover();
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project PneumaticCraft by MineMaarten.
the class ClientEventHandler method onPlayerJoin.
@SubscribeEvent
public void onPlayerJoin(TickEvent.PlayerTickEvent event) {
if (Config.shouldDisplayChangeNotification && firstTick && event.player.worldObj.isRemote && event.player == FMLClientHandler.instance().getClientPlayerEntity()) {
event.player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GREEN + "[PneumaticCraft] Disabled world generation of plants and plant mob drops in your config automatically, oil is turned on as replacement. This is only done once, you can change it as you wish now."));
firstTick = false;
}
}
Aggregations