use of net.minecraft.util.ChatComponentTranslation in project SecurityCraft by Geforce132.
the class HelpfulMethods method sendMessageToPlayer.
public static void sendMessageToPlayer(EntityPlayer par1EntityPlayer, String par2, EnumChatFormatting par3) {
ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(par2, new Object[0]);
if (par3 != null) {
chatcomponenttranslation.getChatStyle().setColor(par3);
}
par1EntityPlayer.addChatComponentMessage(chatcomponenttranslation);
}
use of net.minecraft.util.ChatComponentTranslation in project SecurityCraft by Geforce132.
the class HelpfulMethods method sendMessage.
public static void sendMessage(ICommandSender par1ICommandSender, String par2, EnumChatFormatting par3) {
ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(par2, new Object[0]);
chatcomponenttranslation.getChatStyle().setColor(par3);
par1ICommandSender.addChatMessage(chatcomponenttranslation);
}
use of net.minecraft.util.ChatComponentTranslation in project SecurityCraft by Geforce132.
the class CommandSCHelp method sendMessageToPlayer.
private void sendMessageToPlayer(String par1, ICommandSender par2) {
ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(par1, new Object[0]);
((EntityPlayerMP) getPlayer(par2, par2.getCommandSenderName())).addChatComponentMessage(chatcomponenttranslation);
}
use of net.minecraft.util.ChatComponentTranslation in project SecurityCraft by Geforce132.
the class BlockCageTrap method onEntityIntersected.
@Override
public void onEntityIntersected(World world, BlockPos pos, Entity entity) {
if (!world.isRemote) {
TileEntityCageTrap tileEntity = (TileEntityCageTrap) world.getTileEntity(pos);
boolean isPlayer = entity instanceof EntityPlayer;
boolean shouldCaptureMobs = tileEntity.getOptionByName("captureMobs").asBoolean();
if (isPlayer || (entity instanceof EntityMob && shouldCaptureMobs)) {
if ((isPlayer && ((IOwnable) world.getTileEntity(pos)).getOwner().isOwner((EntityPlayer) entity)))
return;
if (BlockUtils.getBlockPropertyAsBoolean(world, pos, DEACTIVATED))
return;
BlockUtils.setBlockProperty(world, pos, DEACTIVATED, true);
BlockUtils.setBlock(world, pos.up(4), SCContent.unbreakableIronBars);
BlockUtils.setBlock(world, pos.getX() + 1, pos.getY() + 4, pos.getZ(), SCContent.unbreakableIronBars);
BlockUtils.setBlock(world, pos.getX() - 1, pos.getY() + 4, pos.getZ(), SCContent.unbreakableIronBars);
BlockUtils.setBlock(world, pos.getX(), pos.getY() + 4, pos.getZ() + 1, SCContent.unbreakableIronBars);
BlockUtils.setBlock(world, pos.getX(), pos.getY() + 4, pos.getZ() - 1, SCContent.unbreakableIronBars);
BlockUtils.setBlockInBox(world, pos.getX(), pos.getY(), pos.getZ(), SCContent.unbreakableIronBars);
setTileEntities(world, pos.getX(), pos.getY(), pos.getZ(), ((IOwnable) world.getTileEntity(pos)).getOwner().getUUID(), ((IOwnable) world.getTileEntity(pos)).getOwner().getName());
world.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "random.anvil_use", 3.0F, 1.0F);
if (isPlayer)
MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentTranslation("[" + EnumChatFormatting.BLACK + StatCollector.translateToLocal("tile.cageTrap.name") + EnumChatFormatting.RESET + "] " + StatCollector.translateToLocal("messages.cageTrap.captured").replace("#player", ((EntityPlayer) entity).getCommandSenderName()).replace("#location", Utils.getFormattedCoordinates(pos))));
}
}
}
use of net.minecraft.util.ChatComponentTranslation in project Galacticraft by micdoodle8.
the class NEIServerUtils method givePlayerItem.
public static void givePlayerItem(EntityPlayerMP player, ItemStack stack, boolean infinite, boolean doGive) {
if (stack.getItem() == null) {
player.addChatComponentMessage(setColour(new ChatComponentTranslation("nei.chat.give.noitem"), EnumChatFormatting.WHITE));
return;
}
int given = stack.stackSize;
if (doGive) {
if (infinite) {
player.inventory.addItemStackToInventory(stack);
} else {
given -= InventoryUtils.insertItem(player.inventory, stack, false);
}
}
sendNotice(player, new ChatComponentTranslation("commands.give.success", stack.getChatComponent(), infinite ? "\u221E" : Integer.toString(given), player.getName()), "notify-item");
player.openContainer.detectAndSendChanges();
}
Aggregations