net.minecraft.util.Formatting Java Examples
The following examples show how to use
net.minecraft.util.Formatting.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MachineHandledScreen.java From Galacticraft-Rewoven with MIT License | 7 votes |
@Override public void render(MatrixStack stack, int mouseX, int mouseY, float delta) { if (this.handler.blockEntity != null) { ConfigurableElectricMachineBlockEntity.SecurityInfo security = this.handler.blockEntity.getSecurity(); switch (security.getPublicity()) { case PRIVATE: if (!this.playerInventory.player.getUuid().equals(security.getOwner())) { DrawableUtils.drawCenteredString(stack, this.client.textRenderer, "\u00A7l" + new TranslatableText("ui.galacticraft-rewoven.tabs.security_config.not_your_machine").asString(), (this.width / 2), this.y + 50, Formatting.DARK_RED.getColorValue()); return; } case SPACE_RACE: if (!this.playerInventory.player.getUuid().equals(security.getOwner())) { DrawableUtils.drawCenteredString(stack, this.client.textRenderer, "\u00A7l" + new TranslatableText("Team stuff pending...").asString(), (this.width / 2), this.y + 50, Formatting.DARK_RED.getColorValue()); return; } default: break; } } this.drawConfigTabs(stack); super.render(stack, mouseX, mouseY, delta); }
Example #2
Source File: GalacticraftCommands.java From Galacticraft-Rewoven with MIT License | 6 votes |
private static int teleport(CommandContext<ServerCommandSource> context) { try { ServerWorld serverWorld = DimensionArgumentType.getDimensionArgument(context, "dimension"); if (serverWorld == null) { context.getSource().sendError(new TranslatableText("commands.galacticraft-rewoven.dimensiontp.failure.dimension").setStyle(Style.EMPTY.withColor(Formatting.RED))); return -1; } context.getSource().getPlayer().changeDimension(serverWorld); context.getSource().sendFeedback(new TranslatableText("commands.galacticraft-rewoven.dimensiontp.success.single", serverWorld.getRegistryKey().getValue()), true); } catch (CommandSyntaxException ignore) { context.getSource().sendError(new TranslatableText("commands.galacticraft-rewoven.dimensiontp.failure.entity").setStyle(Style.EMPTY.withColor(Formatting.RED))); return -1; } return -1; }
Example #3
Source File: GalacticraftCommands.java From Galacticraft-Rewoven with MIT License | 6 votes |
private static int teleportMultiple(CommandContext<ServerCommandSource> context) { try { ServerWorld serverWorld = DimensionArgumentType.getDimensionArgument(context, "dimension"); if (serverWorld == null) { context.getSource().sendError(new TranslatableText("commands.galacticraft-rewoven.dimensiontp.failure.dimension").setStyle(Style.EMPTY.withColor(Formatting.RED))); return -1; } Collection<? extends Entity> entities = EntityArgumentType.getEntities(context, "entities"); entities.forEach((Consumer<Entity>) entity -> { entity.changeDimension(serverWorld); context.getSource().sendFeedback(new TranslatableText("commands.galacticraft-rewoven.dimensiontp.success.multiple", entities.size(), serverWorld.getRegistryKey().getValue()), true); }); } catch (CommandSyntaxException ignore) { context.getSource().sendError(new TranslatableText("commands.galacticraft-rewoven.dimensiontp.failure.entity").setStyle(Style.EMPTY.withColor(Formatting.RED))); return -1; } return -1; }
Example #4
Source File: OxygenCollectorScreen.java From Galacticraft-Rewoven with MIT License | 6 votes |
@Override public void render(MatrixStack stack, int mouseX, int mouseY, float v) { super.render(stack, mouseX, mouseY, v); DrawableUtils.drawCenteredString(stack, this.client.textRenderer, new TranslatableText("block.galacticraft-rewoven.oxygen_collector").getString(), (this.width / 2), this.y + 5, Formatting.DARK_GRAY.getColorValue()); String statusText = new TranslatableText("ui.galacticraft-rewoven.machine.status").getString(); int statusX = this.x + 38; int statusY = this.y + 64; this.client.textRenderer.draw(stack, statusText, statusX, statusY, Formatting.DARK_GRAY.getColorValue()); this.client.textRenderer.draw(stack, OxygenCollectorBlockEntity.OxygenCollectorStatus.get(handler.status.get()).getText(), statusX + this.client.textRenderer.getWidth(statusText), statusY, OxygenCollectorBlockEntity.OxygenCollectorStatus.get(handler.status.get()).getText().getStyle().getColor().getRgb()); DrawableUtils.drawCenteredString(stack, this.client.textRenderer, new TranslatableText("ui.galacticraft-rewoven.machine.collecting", this.handler.lastCollectAmount.get()).getString(), (this.width / 2) + 10, statusY + 12, Formatting.DARK_GRAY.getColorValue()); this.drawMouseoverTooltip(stack, mouseX, mouseY); }
Example #5
Source File: PaperBagItem.java From the-hallow with MIT License | 6 votes |
@Override public void appendTooltip(ItemStack itemStack, World world, List<Text> list, TooltipContext tooltipContext) { String translatedTooltip = new TranslatableText("text.thehallow.paper_bag").asString(); String[] translatedTooltipWords = translatedTooltip.split(" "); StringBuilder tooltipBuilder = new StringBuilder(); for (int i = 1; i <= translatedTooltipWords.length; i++) { tooltipBuilder.append(translatedTooltipWords[i - 1]); if (i % 4 == 0) { list.add(new LiteralText(tooltipBuilder.toString()).formatted(Formatting.GRAY)); tooltipBuilder = new StringBuilder(); } else { tooltipBuilder.append(" "); } } super.appendTooltip(itemStack, world, list, tooltipContext); }
Example #6
Source File: Contributors.java From the-hallow with MIT License | 6 votes |
private static Text makeDesc(Person person, Formatting formatting) { ContactInformation contact = person.getContact(); Text ret = new LiteralText(person.getName()).formatted(formatting); contact.get("github").ifPresent(gh -> ret.append(Texts.bracketed(new TranslatableText("social.thehallow.github") .styled(style -> style.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, gh)))) .formatted(Formatting.BLACK) ) ); contact.get("minecraft").ifPresent(mc -> ret.append(Texts.bracketed(new TranslatableText("social.thehallow.minecraft") .styled(style -> style.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://mcuuid.net/?q=" + mc)))) .formatted(Formatting.GREEN) ) ); return ret; }
Example #7
Source File: ScoreboardCommand.java From multiconnect with MIT License | 5 votes |
private static String[] displaySlots() { List<String> slots = new ArrayList<>(); slots.add("list"); slots.add("sidebar"); slots.add("belowName"); for (Formatting formatting : Formatting.values()) { if (formatting.isColor()) { slots.add("sidebar.team." + formatting.getName().toLowerCase(Locale.ENGLISH)); } } return slots.toArray(new String[0]); }
Example #8
Source File: BasicSolarPanelScreen.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override @NotNull protected Collection<? extends Text> getEnergyTooltipLines() { List<Text> lines = new ArrayList<>(); if (this.handler.blockEntity.status != BasicSolarPanelBlockEntity.BasicSolarPanelStatus.FULL && this.handler.blockEntity.status != BasicSolarPanelBlockEntity.BasicSolarPanelStatus.BLOCKED) { long time = world.getTimeOfDay() % 24000; if (time > 6000) { lines.add(new TranslatableText("ui.galacticraft-rewoven.machine.gj_per_t", (int) (((6000D - (time - 6000D)) / 705.882353D) + 0.5D) * this.handler.blockEntity.multiplier).setStyle(Style.EMPTY.withColor(Formatting.LIGHT_PURPLE))); } else { lines.add(new TranslatableText("ui.galacticraft-rewoven.machine.gj_per_t", (int) ((time / 705.882353D) + 0.5D) * this.handler.blockEntity.multiplier).setStyle(Style.EMPTY.withColor(Formatting.LIGHT_PURPLE))); } } return lines; }
Example #9
Source File: ItemStackMixin.java From Galacticraft-Rewoven with MIT License | 5 votes |
@SuppressWarnings("RedundantSuppression") @Inject(method = "getName", at = @At("RETURN"), cancellable = true) private void getName(CallbackInfoReturnable<Text> returnable) { Identifier id = Registry.ITEM.getId(getItem()); //noinspection ConstantConditions,PointlessBooleanExpression if (false && id.getNamespace().equals(Constants.MOD_ID)) { Text returnVal = returnable.getReturnValue(); if (returnVal.getStyle().getColor() == null) { returnable.setReturnValue(returnVal.shallowCopy().setStyle(returnVal.getStyle().withColor(Formatting.BLUE))); } } }
Example #10
Source File: StandardWrenchItem.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override @Environment(EnvType.CLIENT) public void appendTooltip(ItemStack itemStack_1, World world_1, List<Text> list_1, TooltipContext tooltipContext_1) { if (Screen.hasShiftDown()) { list_1.add(new TranslatableText("tooltip.galacticraft-rewoven.standard_wrench").setStyle(Style.EMPTY.withColor(Formatting.GRAY))); } else { list_1.add(new TranslatableText("tooltip.galacticraft-rewoven.press_shift").setStyle(Style.EMPTY.withColor(Formatting.GRAY))); } }
Example #11
Source File: BatteryItem.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override @Environment(EnvType.CLIENT) public void appendTooltip(ItemStack stack, World world, List<Text> lines, TooltipContext context) { int charge = stack.getOrCreateTag().getInt("Energy"); if (stack.getMaxDamage() - stack.getDamage() < 3334) { lines.add(new TranslatableText("tooltip.galacticraft-rewoven.energy-remaining", charge).setStyle(Style.EMPTY.withColor(Formatting.DARK_RED))); } else if (stack.getMaxDamage() - stack.getDamage() < 6667) { lines.add(new TranslatableText("tooltip.galacticraft-rewoven.energy-remaining", charge).setStyle(Style.EMPTY.withColor(Formatting.GOLD))); } else { lines.add(new TranslatableText("tooltip.galacticraft-rewoven.energy-remaining", charge).setStyle(Style.EMPTY.withColor(Formatting.GREEN))); } super.appendTooltip(stack, world, lines, context); }
Example #12
Source File: Contributors.java From the-hallow with MIT License | 5 votes |
public static void sendContributorsMessage(ServerCommandSource source) { source.sendFeedback(Texts.bracketed(new TranslatableText("thehallow.contrib.title").formatted(Formatting.GOLD)), false); Text root = new LiteralText(""); for (Text entry : USER_INFO) { root.append(new TranslatableText("thehallow.contrib.entry", entry.copy())); } source.sendFeedback(root, false); }
Example #13
Source File: SpooktoberCommand.java From the-hallow with MIT License | 5 votes |
public static int run(CommandContext<ServerCommandSource> ctx) { long daysLeft = TimeUtil.daysTillSpooktober(); if (daysLeft != 0) { ctx.getSource().sendFeedback(new TranslatableText("thehallow.cmd.tillspooktober", daysLeft).formatted(Formatting.GRAY), false); return 0; } ctx.getSource().sendFeedback(new TranslatableText("thehallow.cmd.spooktober").formatted(Formatting.GOLD, Formatting.BOLD), false); return SINGLE_SUCCESS; }
Example #14
Source File: HallowedCommand.java From the-hallow with MIT License | 5 votes |
public static int run(CommandContext<ServerCommandSource> ctx) { ctx.getSource().sendFeedback(Texts.bracketed(new TranslatableText("thehallow.about.name").formatted(Formatting.GOLD)), false); ctx.getSource().sendFeedback(new TranslatableText("thehallow.about.description").formatted(Formatting.LIGHT_PURPLE), false); ctx.getSource().sendFeedback(new TranslatableText("thehallow.about.github").formatted(Formatting.YELLOW) .append(new TranslatableText("thehallow.github").formatted(Formatting.GREEN) .styled(style -> style.setClickEvent(new ClickEvent(Action.OPEN_URL, "https://github.com/fabric-community/the-hallow")))), false); return SINGLE_SUCCESS; }
Example #15
Source File: MachineHandledScreen.java From Galacticraft-Rewoven with MIT License | 5 votes |
protected void drawEnergyTooltip(MatrixStack stack, int mouseX, int mouseY, int energyX, int energyY) { if (check(mouseX, mouseY, energyX, energyY, Constants.TextureCoordinates.OVERLAY_WIDTH, Constants.TextureCoordinates.OVERLAY_HEIGHT)) { List<Text> lines = new ArrayList<>(); if (handler.blockEntity.getStatusForTooltip() != null) { lines.add(new TranslatableText("ui.galacticraft-rewoven.machine.status").setStyle(Style.EMPTY.withColor(Formatting.GRAY)).append(this.handler.blockEntity.getStatusForTooltip().getText())); } lines.add(new TranslatableText("ui.galacticraft-rewoven.machine.current_energy").setStyle(Style.EMPTY.withColor(Formatting.GOLD)).append(GalacticraftEnergy.GALACTICRAFT_JOULES.getDisplayAmount(this.handler.energy.get()).setStyle(Style.EMPTY.withColor(Formatting.BLUE)))); lines.add(new TranslatableText("ui.galacticraft-rewoven.machine.max_energy").setStyle(Style.EMPTY.withColor(Formatting.RED)).append(GalacticraftEnergy.GALACTICRAFT_JOULES.getDisplayAmount(this.handler.getMaxEnergy()).setStyle(Style.EMPTY.withColor(Formatting.BLUE)))); lines.addAll(getEnergyTooltipLines()); this.renderTooltip(stack, lines, mouseX, mouseY); } }
Example #16
Source File: OptifineZipResourcePack.java From OptiFabric with Mozilla Public License 2.0 | 5 votes |
@Override public <T> T parseMetadata(ResourceMetadataReader<T> metaReader) throws IOException { JsonObject pack = new JsonObject(); pack.addProperty("pack_format", 5); pack.addProperty("description", "Added by OptiFabric\n" + Formatting.RED.toString() + "Disable if you have issues."); pack.add("pack", new JsonObject()); if (!pack.has(metaReader.getKey())) { return null; } return metaReader.fromJson(pack); }
Example #17
Source File: Optifabric.java From OptiFabric with Mozilla Public License 2.0 | 5 votes |
public static void checkForErrors() { if (OptifabricError.hasError()) { ConfirmScreen confirmScreen = new ConfirmScreen(t -> { if (t) { Util.getOperatingSystem().open(OptifabricError.getErrorURL()); } else { MinecraftClient.getInstance().scheduleStop(); } }, new LiteralText(Formatting.RED + "There was an error loading OptiFabric!"), new LiteralText(OptifabricError.getError()), Formatting.GREEN + OptifabricError.getHelpButtonText(), Formatting.RED + "Close Game"); MinecraftClient.getInstance().openScreen(confirmScreen); } }
Example #18
Source File: SandboxTitleScreen.java From Sandbox with GNU Lesser General Public License v3.0 | 5 votes |
public SandboxTitleScreen(boolean boolean_1) { super(new TranslatableText("narrator.screen.title")); this.backgroundRenderer = new RotatingCubeMapRenderer(PANORAMA_CUBE_MAP); this.doBackgroundFade = boolean_1; this.field_17776 = (double) (new Random()).nextFloat() < 1.0E-4D; if (Sandbox.unsupportedModsLoaded) { this.warning = new Warning( new TranslatableText("warning.sandbox.unsupported_mods_1").formatted(Formatting.RED, Formatting.BOLD), new TranslatableText("warning.sandbox.unsupported_mods_2").formatted(Formatting.RED), "https://hrzn.atlassian.net/servicedesk/customer/portal/3" ); } }
Example #19
Source File: ESP.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Subscribe public void onTick(EventTick event) { for (Entity e: mc.world.getEntities()) { if (e instanceof PlayerEntity && e != mc.player && getSettings().get(0).toToggle().state) { EntityUtils.setGlowing(e, Formatting.RED, "players"); } else if (e instanceof Monster && getSettings().get(1).toToggle().state) { EntityUtils.setGlowing(e, Formatting.DARK_BLUE, "mobs"); } else if (EntityUtils.isAnimal(e) && getSettings().get(2).toToggle().state) { EntityUtils.setGlowing(e, Formatting.GREEN, "passive"); } else if (e instanceof ItemEntity && getSettings().get(3).toToggle().state) { EntityUtils.setGlowing(e, Formatting.GOLD, "items"); } else if (e instanceof EnderCrystalEntity && getSettings().get(4).toToggle().state) { EntityUtils.setGlowing(e, Formatting.LIGHT_PURPLE, "crystals"); } else if ((e instanceof BoatEntity || e instanceof AbstractMinecartEntity) && getSettings().get(5).toToggle().state) { EntityUtils.setGlowing(e, Formatting.GRAY, "vehicles"); } else { e.setGlowing(false); } } }
Example #20
Source File: EntityUtils.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void setGlowing(Entity entity, Formatting color, String teamName) { Team team = mc.world.getScoreboard().getTeamNames().contains(teamName) ? mc.world.getScoreboard().getTeam(teamName) : mc.world.getScoreboard().addTeam(teamName); mc.world.getScoreboard().addPlayerToTeam( entity instanceof PlayerEntity ? entity.getEntityName() : entity.getUuidAsString(), team); mc.world.getScoreboard().getTeam(teamName).setColor(color); entity.setGlowing(true); }
Example #21
Source File: ESP.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Subscribe public void onTick(EventTick event) { for (Entity e: mc.world.getEntities()) { if (e instanceof PlayerEntity && e != mc.player && getSettings().get(0).toToggle().state) { EntityUtils.setGlowing(e, Formatting.RED, "players"); } else if (e instanceof Monster && getSettings().get(1).toToggle().state) { EntityUtils.setGlowing(e, Formatting.DARK_BLUE, "mobs"); } else if (EntityUtils.isAnimal(e) && getSettings().get(2).toToggle().state) { EntityUtils.setGlowing(e, Formatting.GREEN, "passive"); } else if (e instanceof ItemEntity && getSettings().get(3).toToggle().state) { EntityUtils.setGlowing(e, Formatting.GOLD, "items"); } else if (e instanceof EndCrystalEntity && getSettings().get(4).toToggle().state) { EntityUtils.setGlowing(e, Formatting.LIGHT_PURPLE, "crystals"); } else if ((e instanceof BoatEntity || e instanceof AbstractMinecartEntity) && getSettings().get(5).toToggle().state) { EntityUtils.setGlowing(e, Formatting.GRAY, "vehicles"); } else { e.setGlowing(false); } } }
Example #22
Source File: EntityUtils.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void setGlowing(Entity entity, Formatting color, String teamName) { Team team = mc.world.getScoreboard().getTeamNames().contains(teamName) ? mc.world.getScoreboard().getTeam(teamName) : mc.world.getScoreboard().addTeam(teamName); mc.world.getScoreboard().addPlayerToTeam( entity instanceof PlayerEntity ? entity.getEntityName() : entity.getUuidAsString(), team); mc.world.getScoreboard().getTeam(teamName).setColor(color); entity.setGlowing(true); }
Example #23
Source File: ESP.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Subscribe public void onTick(EventTick event) { for (Entity e: mc.world.getEntities()) { if (e instanceof PlayerEntity && e != mc.player && getSettings().get(0).toToggle().state) { EntityUtils.setGlowing(e, Formatting.RED, "players"); } else if (e instanceof Monster && getSettings().get(1).toToggle().state) { EntityUtils.setGlowing(e, Formatting.DARK_BLUE, "mobs"); } else if (EntityUtils.isAnimal(e) && getSettings().get(2).toToggle().state) { EntityUtils.setGlowing(e, Formatting.GREEN, "passive"); } else if (e instanceof ItemEntity && getSettings().get(3).toToggle().state) { EntityUtils.setGlowing(e, Formatting.GOLD, "items"); } else if (e instanceof EnderCrystalEntity && getSettings().get(4).toToggle().state) { EntityUtils.setGlowing(e, Formatting.LIGHT_PURPLE, "crystals"); } else if ((e instanceof BoatEntity || e instanceof AbstractMinecartEntity) && getSettings().get(5).toToggle().state) { EntityUtils.setGlowing(e, Formatting.GRAY, "vehicles"); } else { e.setGlowing(false); } } }
Example #24
Source File: EntityUtils.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void setGlowing(Entity entity, Formatting color, String teamName) { Team team = mc.world.getScoreboard().getTeamNames().contains(teamName) ? mc.world.getScoreboard().getTeam(teamName) : mc.world.getScoreboard().addTeam(teamName); mc.world.getScoreboard().addPlayerToTeam( entity instanceof PlayerEntity ? entity.getEntityName() : entity.getUuidAsString(), team); mc.world.getScoreboard().getTeam(teamName).setColor(color); entity.setGlowing(true); }
Example #25
Source File: Messenger.java From fabric-carpet with MIT License | 5 votes |
public static Style parseStyle(String style) { //could be rewritten to be more efficient Style styleInstance = new Style(); styleInstance.setItalic(style.indexOf('i')>=0); styleInstance.setStrikethrough(style.indexOf('s')>=0); styleInstance.setUnderline(style.indexOf('u')>=0); styleInstance.setBold(style.indexOf('b')>=0); styleInstance.setObfuscated(style.indexOf('o')>=0); styleInstance.setColor(Formatting.WHITE); if (style.indexOf('w')>=0) styleInstance.setColor(Formatting.WHITE); // not needed if (style.indexOf('y')>=0) styleInstance.setColor(Formatting.YELLOW); if (style.indexOf('m')>=0) styleInstance.setColor(Formatting.LIGHT_PURPLE); if (style.indexOf('r')>=0) styleInstance.setColor(Formatting.RED); if (style.indexOf('c')>=0) styleInstance.setColor(Formatting.AQUA); if (style.indexOf('l')>=0) styleInstance.setColor(Formatting.GREEN); if (style.indexOf('t')>=0) styleInstance.setColor(Formatting.BLUE); if (style.indexOf('f')>=0) styleInstance.setColor(Formatting.DARK_GRAY); if (style.indexOf('g')>=0) styleInstance.setColor(Formatting.GRAY); if (style.indexOf('d')>=0) styleInstance.setColor(Formatting.GOLD); if (style.indexOf('p')>=0) styleInstance.setColor(Formatting.DARK_PURPLE); if (style.indexOf('n')>=0) styleInstance.setColor(Formatting.DARK_RED); if (style.indexOf('q')>=0) styleInstance.setColor(Formatting.DARK_AQUA); if (style.indexOf('e')>=0) styleInstance.setColor(Formatting.DARK_GREEN); if (style.indexOf('v')>=0) styleInstance.setColor(Formatting.DARK_BLUE); if (style.indexOf('k')>=0) styleInstance.setColor(Formatting.BLACK); return styleInstance; }
Example #26
Source File: GlowstoneTorchBlock.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override @Environment(EnvType.CLIENT) public void buildTooltip(ItemStack itemStack, BlockView blockView, List<Text> list, TooltipContext tooltipContext) { if (Screen.hasShiftDown()) { list.add(new TranslatableText("tooltip.galacticraft-rewoven.glowstone_torch").setStyle(Style.EMPTY.withColor(Formatting.GRAY))); } else { list.add(new TranslatableText("tooltip.galacticraft-rewoven.press_shift").setStyle(Style.EMPTY.withColor(Formatting.GRAY))); } }
Example #27
Source File: GlowstoneWallTorchBlock.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override @Environment(EnvType.CLIENT) public void buildTooltip(ItemStack itemStack, BlockView blockView, List<Text> list, TooltipContext tooltipContext) { if (Screen.hasShiftDown()) { list.add(new TranslatableText("tooltip.galacticraft-rewoven.glowstone_torch").setStyle(Style.EMPTY.withColor(Formatting.GRAY))); } else { list.add(new TranslatableText("tooltip.galacticraft-rewoven.press_shift").setStyle(Style.EMPTY.withColor(Formatting.GRAY))); } }
Example #28
Source File: CompressorBlock.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override @Environment(EnvType.CLIENT) public final void buildTooltip(ItemStack itemStack_1, BlockView blockView_1, List<Text> list_1, TooltipContext tooltipContext_1) { if (Screen.hasShiftDown()) { list_1.add(new TranslatableText("tooltip.galacticraft-rewoven.compressor").setStyle(Style.EMPTY.withColor(Formatting.GRAY))); } else { list_1.add(new TranslatableText("tooltip.galacticraft-rewoven.press_shift").setStyle(Style.EMPTY.withColor(Formatting.GRAY))); } }
Example #29
Source File: OxygenCollectorScreen.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override public void drawMouseoverTooltip(MatrixStack stack, int mouseX, int mouseY) { super.drawMouseoverTooltip(stack, mouseX, mouseY); this.drawEnergyTooltip(stack, mouseX, mouseY, this.x + 11, this.y + 18); if (mouseX >= oxygenDisplayX && mouseX <= oxygenDisplayX + OVERLAY_WIDTH && mouseY >= oxygenDisplayY && mouseY <= oxygenDisplayY + OVERLAY_HEIGHT) { List<Text> toolTipLines = new ArrayList<>(); toolTipLines.add(new TranslatableText("ui.galacticraft-rewoven.machine.current_oxygen", GalacticraftEnergy.GALACTICRAFT_JOULES.getDisplayAmount(this.handler.energy.get()).setStyle(Style.EMPTY.withColor(Formatting.BLUE))).setStyle(Style.EMPTY.withColor(Formatting.GOLD))); toolTipLines.add(new TranslatableText("ui.galacticraft-rewoven.machine.max_oxygen", GalacticraftEnergy.GALACTICRAFT_JOULES.getDisplayAmount(this.handler.getMaxEnergy())).setStyle(Style.EMPTY.withColor(Formatting.RED))); this.renderTooltip(stack, toolTipLines, mouseX, mouseY); } }
Example #30
Source File: CompressorScreen.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override public void drawMouseoverTooltip(MatrixStack stack, int mouseX, int mouseY) { super.drawMouseoverTooltip(stack, mouseX, mouseY); if (mouseX >= this.x - 22 && mouseX <= this.x && mouseY >= this.y + 3 && mouseY <= this.y + (22 + 3)) { this.renderTooltip(stack, new TranslatableText("ui.galacticraft-rewoven.tabs.side_config").setStyle(Style.EMPTY.withColor(Formatting.GRAY)), mouseX, mouseY); } }