use of net.minecraft.util.text.event.ClickEvent in project RecurrentComplex by Ivorforce.
the class RCTextStyle method area.
public static ITextComponent area(BlockArea area) {
ITextComponent component = ServerTranslations.format("commands.rcarea.get", pos(area.getPoint1()), pos(area.getPoint2()));
component.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, ServerTranslations.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;
}
use of net.minecraft.util.text.event.ClickEvent in project MorePlanets by SteveKunG.
the class ClientEventHandler method onPlayerTick.
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onPlayerTick(PlayerTickEvent event) {
String URL = "https://minecraft.curseforge.com/projects/galacticraft-add-on-more-planets";
JsonUtil json = new JsonUtil();
EntityPlayer player = event.player;
if (player != null) {
// prevent randomly NPE
if (this.mc.player == player) {
this.runAlienBeamTick(player);
}
// 0 = OutOfDate, 1 = ShowDesc, 2 = NoConnection
if (player.world.isRemote) {
if (ConfigManagerMP.enableVersionChecker) {
if (!MorePlanetsCore.STATUS_CHECK[2] && VersionChecker.INSTANCE.noConnection()) {
player.sendMessage(json.text("Unable to check latest version, Please check your internet connection").setStyle(json.red()));
player.sendMessage(json.text(VersionChecker.INSTANCE.getExceptionMessage()).setStyle(json.red()));
MorePlanetsCore.STATUS_CHECK[2] = true;
return;
}
if (!MorePlanetsCore.STATUS_CHECK[0] && !MorePlanetsCore.STATUS_CHECK[2] && VersionChecker.INSTANCE.isLatestVersion()) {
player.sendMessage(json.text("New version of ").appendSibling(json.text("More Planets").setStyle(json.style().setColor(TextFormatting.AQUA)).appendSibling(json.text(" is available ").setStyle(json.white()).appendSibling(json.text("v" + VersionChecker.INSTANCE.getLatestVersion().replace("[" + MorePlanetsCore.MC_VERSION + "]=", "")).setStyle(json.style().setColor(TextFormatting.GREEN)).appendSibling(json.text(" for ").setStyle(json.white()).appendSibling(json.text("MC-" + MorePlanetsCore.MC_VERSION).setStyle(json.style().setColor(TextFormatting.GOLD))))))));
player.sendMessage(json.text("Download Link ").setStyle(json.style().setColor(TextFormatting.YELLOW)).appendSibling(json.text("[CLICK HERE]").setStyle(json.style().setColor(TextFormatting.BLUE).setHoverEvent(json.hover(HoverEvent.Action.SHOW_TEXT, json.text("Click Here!").setStyle(json.style().setColor(TextFormatting.DARK_GREEN)))).setClickEvent(json.click(ClickEvent.Action.OPEN_URL, URL)))));
MorePlanetsCore.STATUS_CHECK[0] = true;
}
}
if (ConfigManagerMP.enableChangeLogInGame) {
if (!MorePlanetsCore.STATUS_CHECK[1] && !MorePlanetsCore.STATUS_CHECK[2]) {
for (String log : VersionChecker.INSTANCE.getChangeLog()) {
player.sendMessage(json.text(log).setStyle(json.colorFromConfig("gray")));
}
player.sendMessage(json.text("To read More Planets full change log. Use /mpchangelog command!").setStyle(json.colorFromConfig("gray").setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/mpchangelog"))));
}
MorePlanetsCore.STATUS_CHECK[1] = true;
}
}
}
}
Aggregations