Search in sources :

Example 51 with Style

use of net.minecraft.util.text.Style in project Pearcel-Mod by MiningMark48.

the class EventOnJoin method onJoin.

@SubscribeEvent
public void onJoin(TickEvent.PlayerTickEvent e) {
    if (!PearcelMod.haveWarnedVersionOutOfDate && e.player.world.isRemote) {
        if (!PearcelMod.versionChecker.isLatestVersion()) {
            ClickEvent versionCheckClickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL, "https://minecraft.curseforge.com/projects/pearcel-mod");
            e.player.sendMessage(new TextComponentString(TextFormatting.YELLOW + Translate.toLocal("chat.versionChecker.outOfDate") + TextFormatting.AQUA + " v" + PearcelMod.versionChecker.getLatestVersion()).setStyle(new Style().setClickEvent(versionCheckClickEvent)));
            PearcelMod.haveWarnedVersionOutOfDate = true;
        }
    }
    if (!JoinMessageWikiSent && e.player.world.isRemote) {
        // TODO: Make config setting for message
        ClickEvent versionCheckClickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL, "http://miningmark48.xyz/pearcelmod");
        e.player.sendMessage(new TextComponentString(TextFormatting.GREEN + Translate.toLocal("chat.joinMessage.wiki")).setStyle(new Style().setClickEvent(versionCheckClickEvent)));
        JoinMessageWikiSent = true;
    }
}
Also used : ClickEvent(net.minecraft.util.text.event.ClickEvent) Style(net.minecraft.util.text.Style) TextComponentString(net.minecraft.util.text.TextComponentString) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

Style (net.minecraft.util.text.Style)51 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)30 TextComponentString (net.minecraft.util.text.TextComponentString)21 ITextComponent (net.minecraft.util.text.ITextComponent)17 ClickEvent (net.minecraft.util.text.event.ClickEvent)10 BlockPos (net.minecraft.util.math.BlockPos)9 CommandException (net.minecraft.command.CommandException)7 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 ItemStack (net.minecraft.item.ItemStack)4 World (net.minecraft.world.World)4 Colony (com.minecolonies.coremod.colony.Colony)3 PlayerIdentifier (com.mraof.minestuck.util.IdentifierHandler.PlayerIdentifier)3 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)3 GameProfile (com.mojang.authlib.GameProfile)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 HoverEvent (net.minecraft.util.text.event.HoverEvent)2 Biome (net.minecraft.world.biome.Biome)2 FluidStack (net.minecraftforge.fluids.FluidStack)2