Fix chat formatting not surviving line wraps in chat messages.

This commit is contained in:
LexManos 2016-02-15 14:30:24 -08:00
parent 9760b3b52f
commit 74fe690227
2 changed files with 18 additions and 0 deletions

View file

@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java
@@ -73,6 +73,7 @@
s3 = s4;
}
+ s3 = FontRenderer.func_78282_e(s2) + s3; //Forge: Fix chat formatting not surviving line wrapping.
ChatComponentText chatcomponenttext2 = new ChatComponentText(s3);
chatcomponenttext2.func_150255_a(ichatcomponent1.func_150256_b().func_150232_l());
list1.add(j + 1, chatcomponenttext2);

View file

@ -1,8 +1,11 @@
package net.minecraftforge.test;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.nbt.NBTBase;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge;
@ -53,6 +56,11 @@ public class TestCapabilityMod
IExampleCapability inv = te.getCapability(TEST_CAP, event.face);
System.out.println("Hi I'm a " + inv.getOwnerType());
}
if (event.world.getBlockState(event.pos).getBlock() == Blocks.dirt)
{
event.entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "" + EnumChatFormatting.ITALIC + "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST"));
event.setCanceled(true);
}
}