use of net.minecraft.util.text.ITextComponent in project Cavern2 by kegare.
the class SpecialMagicMessage method process.
@Override
public IMessage process(EntityPlayerMP player) {
MagicBook book = MagicBook.get(player);
SpecialMagic magic = book.getSpecialMagic();
if (magic != null) {
ITextComponent message = magic.finishMagic();
if (message != null) {
player.sendStatusMessage(message, true);
}
SoundEvent sound = magic.getFinishSound();
if (sound != null) {
player.world.playSound(null, player.posX, player.posY + 0.25D, player.posZ, sound, SoundCategory.PLAYERS, 1.0F, 1.0F);
}
book.setSpecialMagic(null);
}
return null;
}
use of net.minecraft.util.text.ITextComponent in project Cavern2 by kegare.
the class MiningAssistMessage method process.
@Override
public IMessage process(EntityPlayerMP player) {
IMinerStats stats = MinerStats.get(player);
if (stats.getRank() < MiningAssistConfig.minerRank.getValue()) {
ITextComponent component = new TextComponentTranslation(MinerRank.get(MiningAssistConfig.minerRank.getValue()).getUnlocalizedName());
component.getStyle().setItalic(Boolean.valueOf(true));
component = new TextComponentTranslation("cavern.miningassist.toggle.failed.message", component);
component.getStyle().setColor(TextFormatting.RED);
player.sendMessage(component);
} else {
stats.toggleMiningAssist();
stats.adjustData();
ITextComponent component = new TextComponentTranslation(MiningAssist.get(stats.getMiningAssist()).getUnlocalizedName());
component.getStyle().setColor(TextFormatting.GRAY).setItalic(Boolean.valueOf(true));
component = new TextComponentTranslation("cavern.miningassist.toggle.message", component);
player.sendMessage(component);
}
return null;
}
use of net.minecraft.util.text.ITextComponent in project DynamicSurroundings by OreCruncher.
the class VersionChecker method playerLogin.
public void playerLogin(@Nonnull final PlayerLoggedInEvent event) {
if (event.player instanceof EntityPlayer) {
final String updateMessage = getUpdateMessage(this.modId);
if (updateMessage != null) {
try {
final ITextComponent component = ITextComponent.Serializer.jsonToComponent(updateMessage);
event.player.sendMessage(component);
} catch (@Nonnull final Throwable t) {
t.printStackTrace();
}
}
}
}
use of net.minecraft.util.text.ITextComponent in project BloodMagic by WayofTime.
the class ItemSanguineBook method onItemUse.
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (world.isRemote)
return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
IBlockState hitState = world.getBlockState(pos);
if (player.isSneaking()) {
if (hitState.getBlock() instanceof IDocumentedBlock) {
trySetDisplayedTier(world, pos);
IDocumentedBlock documentedBlock = (IDocumentedBlock) hitState.getBlock();
List<ITextComponent> docs = documentedBlock.getDocumentation(player, world, pos, hitState);
if (!docs.isEmpty()) {
ChatUtil.sendNoSpam(player, docs.toArray(new ITextComponent[docs.size()]));
return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
}
}
}
return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
}
use of net.minecraft.util.text.ITextComponent in project BloodMagic by WayofTime.
the class ItemSigilDivination method onItemRightClick.
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if (stack.getItem() instanceof ISigil.Holding)
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
if (PlayerHelper.isFakePlayer(player))
return ActionResult.newResult(EnumActionResult.FAIL, stack);
if (!world.isRemote) {
super.onItemRightClick(world, player, hand);
Binding binding = getBinding(stack);
if (binding != null) {
int currentEssence = NetworkHelper.getSoulNetwork(binding).getCurrentEssence();
List<ITextComponent> toSend = Lists.newArrayList();
if (!binding.getOwnerId().equals(player.getGameProfile().getId()))
toSend.add(new TextComponentTranslation(tooltipBase + "otherNetwork", binding.getOwnerName()));
toSend.add(new TextComponentTranslation(tooltipBase + "currentEssence", currentEssence));
ChatUtil.sendNoSpam(player, toSend.toArray(new ITextComponent[toSend.size()]));
}
}
return super.onItemRightClick(world, player, hand);
}
Aggregations