Search in sources :

Example 16 with ClickEvent

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

the class RCTextStyle method path.

@Nonnull
public static ITextComponent path(ResourceDirectory directory, String... path) {
    ITextComponent pathComponent = new TextComponentString(String.format("%s%s%s", directory, path.length > 0 ? "/" : "", Strings.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, directory.toFile().getAbsolutePath()));
    return pathComponent;
}
Also used : HoverEvent(net.minecraft.util.text.event.HoverEvent) ClickEvent(net.minecraft.util.text.event.ClickEvent) Nonnull(javax.annotation.Nonnull)

Example 17 with ClickEvent

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

the class RCTextStyle method copy.

public static ITextComponent copy(String text) {
    ITextComponent comp = new TextComponentString(text);
    comp.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, ServerTranslations.get("commands.rccopy.suggest")));
    comp.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, text));
    return comp;
}
Also used : HoverEvent(net.minecraft.util.text.event.HoverEvent) ClickEvent(net.minecraft.util.text.event.ClickEvent)

Example 18 with ClickEvent

use of net.minecraft.util.text.event.ClickEvent 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, ServerTranslations.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 19 with ClickEvent

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

the class RCTextStyle method submit.

@Nonnull
public static ITextComponent submit(String id) {
    ITextComponent submit = ServerTranslations.get("reccomplex.save.submit");
    submit.getStyle().setColor(TextFormatting.AQUA);
    submit.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, ServerTranslations.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 20 with ClickEvent

use of net.minecraft.util.text.event.ClickEvent 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 %s", RCCommands.lookup.getName(), id)));
    comp.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, ServerTranslations.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)

Aggregations

ClickEvent (net.minecraft.util.text.event.ClickEvent)21 HoverEvent (net.minecraft.util.text.event.HoverEvent)16 TextComponentString (net.minecraft.util.text.TextComponentString)9 ITextComponent (net.minecraft.util.text.ITextComponent)8 Nonnull (javax.annotation.Nonnull)7 Style (net.minecraft.util.text.Style)4 Colony (com.minecolonies.coremod.colony.Colony)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 BlockPos (net.minecraft.util.math.BlockPos)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 CitizenData (com.minecolonies.coremod.colony.CitizenData)1 IColony (com.minecolonies.coremod.colony.IColony)1 RCEntityInfo (ivorius.reccomplex.capability.RCEntityInfo)1 RCParameters (ivorius.reccomplex.commands.parameters.RCParameters)1 WorldRandomData (ivorius.reccomplex.world.gen.feature.WorldRandomData)1 GenericStructure (ivorius.reccomplex.world.gen.feature.structure.generic.GenericStructure)1 Metadata (ivorius.reccomplex.world.gen.feature.structure.generic.Metadata)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1