use of net.minecraft.util.ChatComponentText in project watson by totemo.
the class WatsonCommandBase method sendColouredText.
// --------------------------------------------------------------------------
/**
* Send a message to the specified command sender in the specified colour.
*
* @param sender the command sender who is the message recipient.
* @param colour the colour.
* @param message the text.
*/
public void sendColouredText(ICommandSender sender, EnumChatFormatting colour, String message) {
ChatComponentText chat = new ChatComponentText(message);
ChatStyle style = new ChatStyle();
style.setColor(colour);
chat.setChatStyle(style);
sender.addChatMessage(chat);
}
use of net.minecraft.util.ChatComponentText in project watson by totemo.
the class Chat method localChat.
// --------------------------------------------------------------------------
/**
* Display a chat message locally.
*
* @param colour the colour to format the text as.
* @param message the text to display.
*/
public static void localChat(EnumChatFormatting colour, String message) {
ChatComponentText chat = new ChatComponentText(message);
ChatStyle style = new ChatStyle();
style.setColor(colour);
chat.setChatStyle(style);
localChat(chat);
}
use of net.minecraft.util.ChatComponentText in project ICBM-Classic by BuiltBrokenModding.
the class TileRadarStation method onPlayerRightClick.
@Override
protected boolean onPlayerRightClick(EntityPlayer entityPlayer, int side, Pos hit) {
if (entityPlayer.inventory.getCurrentItem() != null) {
if (WrenchUtility.isUsableWrench(entityPlayer, entityPlayer.inventory.getCurrentItem(), this.xCoord, this.yCoord, this.zCoord)) {
if (!this.worldObj.isRemote) {
this.emitAll = !this.emitAll;
entityPlayer.addChatMessage(new ChatComponentText(LanguageUtility.getLocal("message.radar.redstone") + " " + this.emitAll));
}
return true;
}
}
if (isServer()) {
entityPlayer.openGui(ICBMClassic.INSTANCE, 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
}
return true;
}
use of net.minecraft.util.ChatComponentText in project ICBM-Classic by BuiltBrokenModding.
the class TileCamouflage method onPlayerRightClickWrench.
@Override
protected boolean onPlayerRightClickWrench(EntityPlayer player, int side, Pos hit) {
if (player.canPlayerEdit(xi(), yi(), zi(), side, player.getHeldItem())) {
//TODO ensure there is a permission flag for editing in global list so its not an (eta all)
if (owner == null || owner.equals(player.getGameProfile().getId())) {
if (isServer()) {
if (player.isSneaking()) {
toggleCollision();
player.addChatComponentMessage(new ChatComponentText("Collision set to " + getCanCollide()));
} else {
toggleRenderSide(ForgeDirection.getOrientation(side));
player.addChatComponentMessage(new ChatComponentText("Side set to render: " + canRenderSide(ForgeDirection.getOrientation(side))));
}
}
return true;
} else if (Engine.runningAsDev && isServer()) {
player.addChatComponentMessage(new ChatComponentText("No perms"));
}
} else if (Engine.runningAsDev && isServer()) {
player.addChatComponentMessage(new ChatComponentText("Empty hand or can not edit"));
}
return false;
}
use of net.minecraft.util.ChatComponentText in project ICBM-Classic by BuiltBrokenModding.
the class ItemGrenade method onPlayerStoppedUsing.
@Override
public void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityPlayer entityPlayer, int nengLiang) {
if (!world.isRemote) {
Explosives zhaPin = Explosives.get(itemStack.getItemDamage());
ExplosivePreDetonationEvent evt = new ExplosivePreDetonationEvent(world, entityPlayer, ExplosiveType.ITEM, zhaPin.handler);
MinecraftForge.EVENT_BUS.post(evt);
if (!evt.isCanceled()) {
if (!entityPlayer.capabilities.isCreativeMode) {
itemStack.stackSize--;
if (itemStack.stackSize <= 0) {
entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, null);
}
}
world.playSoundAtEntity(entityPlayer, "random.fuse", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
world.spawnEntityInWorld(new EntityGrenade(world, entityPlayer, zhaPin, (float) (this.getMaxItemUseDuration(itemStack) - nengLiang) / (float) this.getMaxItemUseDuration(itemStack)));
} else {
entityPlayer.addChatMessage(new ChatComponentText("Grenades are banned in this region."));
}
}
}
Aggregations