Search in sources :

Example 26 with HoverEvent

use of net.minecraft.util.text.event.HoverEvent in project RecurrentComplex by Ivorforce.

the class RCTextStyle method structure.

public static ITextComponent structure(String id) {
    TextComponentString comp = new TextComponentString(id);
    comp.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.format("/%s", RCCommands.structures.lookup(id))));
    comp.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, RecurrentComplex.translations.get("commands.rcsearch.lookup")));
    comp.getStyle().setColor(TextFormatting.AQUA);
    return comp;
}
Also used : HoverEvent(net.minecraft.util.text.event.HoverEvent) ClickEvent(net.minecraft.util.text.event.ClickEvent)

Example 27 with HoverEvent

use of net.minecraft.util.text.event.HoverEvent in project RecurrentComplex by Ivorforce.

the class RCTextStyle method submit.

@Nonnull
public static ITextComponent submit(String id) {
    ITextComponent submit = RecurrentComplex.translations.get("reccomplex.save.submit");
    submit.getStyle().setColor(TextFormatting.AQUA);
    submit.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, RecurrentComplex.translations.get("reccomplex.save.submit.hover")));
    submit.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, Repository.submitURL(id)));
    return submit;
}
Also used : HoverEvent(net.minecraft.util.text.event.HoverEvent) ClickEvent(net.minecraft.util.text.event.ClickEvent) Nonnull(javax.annotation.Nonnull)

Example 28 with HoverEvent

use of net.minecraft.util.text.event.HoverEvent in project RecurrentComplex by Ivorforce.

the class RCTextStyle method biome.

@Nonnull
public static ITextComponent biome(Biome biome) {
    ITextComponent component = new TextComponentString(biome.getBiomeName());
    Style style = component.getStyle();
    style.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.format("/%s types %s", RCCommands.biomeDict.getName(), biome.getRegistryName())));
    style.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, RecurrentComplex.translations.format("commands.biomedict.list.number", BiomeDictionary.getTypes(biome).size())));
    style.setColor(TextFormatting.AQUA);
    return component;
}
Also used : HoverEvent(net.minecraft.util.text.event.HoverEvent) ClickEvent(net.minecraft.util.text.event.ClickEvent) Nonnull(javax.annotation.Nonnull)

Example 29 with HoverEvent

use of net.minecraft.util.text.event.HoverEvent in project RecurrentComplex by Ivorforce.

the class RCTextStyle method visit.

@Nonnull
public static ITextComponent visit(File file, String... path) {
    ITextComponent pathComponent = new TextComponentString(String.join("/", path));
    pathComponent.getStyle().setColor(TextFormatting.GOLD);
    pathComponent.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString("Visit File")));
    pathComponent.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, file.getAbsolutePath()));
    return pathComponent;
}
Also used : HoverEvent(net.minecraft.util.text.event.HoverEvent) ClickEvent(net.minecraft.util.text.event.ClickEvent) Nonnull(javax.annotation.Nonnull)

Example 30 with HoverEvent

use of net.minecraft.util.text.event.HoverEvent in project RecurrentComplex by Ivorforce.

the class RCTextStyle method area.

public static ITextComponent area(BlockArea area) {
    ITextComponent component = RecurrentComplex.translations.format("commands.rcarea.get", pos(area.getPoint1()), pos(area.getPoint2()));
    component.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, RecurrentComplex.translations.get("commands.rcarea.select")));
    component.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.format("/%s %s %d %d %d %d %d %d --first --second", RCCommands.select.getName(), RCCommands.select.set.getName(), area.getPoint1().getX(), area.getPoint1().getY(), area.getPoint1().getZ(), area.getPoint2().getX(), area.getPoint2().getY(), area.getPoint2().getZ())));
    return component;
}
Also used : HoverEvent(net.minecraft.util.text.event.HoverEvent) ClickEvent(net.minecraft.util.text.event.ClickEvent)

Aggregations

HoverEvent (net.minecraft.util.text.event.HoverEvent)30 ClickEvent (net.minecraft.util.text.event.ClickEvent)21 ITextComponent (net.minecraft.util.text.ITextComponent)9 TextComponentString (net.minecraft.util.text.TextComponentString)9 Nonnull (javax.annotation.Nonnull)8 IGrowable (net.minecraft.block.IGrowable)2 Minecraft (net.minecraft.client.Minecraft)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 ItemStack (net.minecraft.item.ItemStack)2 StringTextComponent (net.minecraft.util.text.StringTextComponent)2 Style (net.minecraft.util.text.Style)2 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)2 TextFormatting (net.minecraft.util.text.TextFormatting)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 JsonObject (com.google.gson.JsonObject)1 LiteralArgumentBuilder (com.mojang.brigadier.builder.LiteralArgumentBuilder)1 CommandContext (com.mojang.brigadier.context.CommandContext)1 CommandSyntaxException (com.mojang.brigadier.exceptions.CommandSyntaxException)1 CommandExpecting (ivorius.mcopts.commands.CommandExpecting)1 ivorius.mcopts.commands.parameters (ivorius.mcopts.commands.parameters)1