@Override public void apply(@Nonnull ChannelType type) { if (!data.sendChannels.get(type).isEmpty() || !data.recvChannels.get(type).isEmpty()) { final IProbeInfo lines = addIcon(eiobox.get().horizontal(eiobox.center()), type.getWidgetIcon()) .vertical(eiobox.getProbeinfo().defaultLayoutStyle().spacing(-1)); if (data.sendChannels.get(type).isEmpty()) { lines.text(loc("top.channel.send", loc("top.channel.none"))); } else { for (Channel channel : data.sendChannels.get(type)) { lines.text(loc("top.channel.send", channel.getName())); } } if (data.recvChannels.get(type).isEmpty()) { lines.text(loc("top.channel.recv", loc("top.channel.none"))); } else { for (Channel channel : data.recvChannels.get(type)) { lines.text(loc("top.channel.recv", channel.getName())); } } } } });
private void mkNotificationLine(ProbeMode mode, EioBox eiobox, TOPData data) { if (data.notifications != null && !data.notifications.isEmpty()) { IProbeInfo vertical = addIcon(eiobox.get().horizontal(eiobox.center()), IconEIO.REDSTONE_MODE_NEVER) .vertical(eiobox.getProbeinfo().defaultLayoutStyle().spacing(-1)); for (ILocalizable notification : data.notifications) { vertical.text(locRaw(notification.getUnlocalizedName())); } } }
private void mkRedstoneLine(ProbeMode mode, EioBox eiobox, TOPData data) { if (data.hasRedstone) { if (mode != ProbeMode.NORMAL || TopConfig.showRedstoneByDefault.get()) { addIcon(eiobox.get().horizontal(eiobox.center()), data.redstoneIcon).vertical(eiobox.getProbeinfo().defaultLayoutStyle().spacing(-1)) .text(loc(data.redstoneTooltip)).text(loc("top.redstone.header", loc("top.redstone." + data.redstoneControlStatus))); } else { eiobox.addMore(); } } }
private void mkSideConfigLine(ProbeMode mode, EioBox eiobox, TOPData data) { if (data.hasIOMode) { if (mode != ProbeMode.NORMAL || TopConfig.showSideConfigByDefault.get()) { addIcon(eiobox.get().horizontal(eiobox.center()), IconEIO.IO_CONFIG_UP).vertical(eiobox.getProbeinfo().defaultLayoutStyle().spacing(-1)) .text(TextFormatting.YELLOW + loc("top.machine.side", TextFormatting.WHITE + loc("top.machine.side." + data.sideName))) .text(TextFormatting.YELLOW + loc("top.machine.ioMode", loc(data.ioMode.getColorerUnlocalizedName()))); } else { eiobox.addMore(); } } }
private void mkOwner(ProbeMode mode, EioBox eiobox, TOPData data) { if (mode == ProbeMode.DEBUG && data.owner != null) { ItemStack skull = new ItemStack(Items.SKULL, 1, 3); NBTTagCompound nbt = new NBTTagCompound(); nbt.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), data.owner.getAsGameProfile())); skull.setTagCompound(nbt); eiobox.get().horizontal(eiobox.center()).item(skull).vertical(eiobox.getProbeinfo().defaultLayoutStyle().spacing(-1)).text(loc("top.owner.header")) .text(data.owner.getPlayerName()); } }
private void mkPaint(ProbeMode mode, EioBox eiobox, TOPData data) { if (data.isPainted) { IProbeInfo info = eiobox.get().horizontal(eiobox.center()).item(new ItemStack(Items.PAINTING)) .vertical(eiobox.getProbeinfo().defaultLayoutStyle().spacing(-1)).text(loc("top.paint.header")); // ItemStack.getDisplayName() should be run on the client, but I don't think we have a way to get the stack there if (Prep.isValid(data.paint2)) { info.horizontal(eiobox.center()).item(data.paint2).text(data.paint2.getDisplayName()); } if (Prep.isValid(data.paint1)) { info.horizontal(eiobox.center()).item(data.paint1).text(data.paint1.getDisplayName()); } } }
private static void showChestContents(IProbeInfo probeInfo, World world, BlockPos pos, List<ItemStack> stacks, boolean detailed) { IProbeInfo vertical = null; IProbeInfo horizontal = null; int rows = 0; int idx = 0; vertical = probeInfo.vertical(probeInfo.defaultLayoutStyle().borderColor(Config.chestContentsBorderColor).spacing(0)); if (detailed) { for (ItemStack stackInSlot : stacks) { horizontal = vertical.horizontal(new LayoutStyle().spacing(10).alignment(ElementAlignment.ALIGN_CENTER)); horizontal.item(stackInSlot, new ItemStyle().width(16).height(16)) .text(INFO + stackInSlot.getDisplayName()); } } else { for (ItemStack stackInSlot : stacks) { if (idx % 10 == 0) { horizontal = vertical.horizontal(new LayoutStyle().spacing(0)); rows++; if (rows > 4) { break; } } horizontal.item(stackInSlot); idx++; } } }
private void mkEnergyLine(ProbeMode mode, EioBox eiobox, TOPData data) { if (data.hasRF) { if (mode != ProbeMode.NORMAL || TopConfig.showPowerByDefault.get()) { IProbeInfo rfLine = eiobox.get().horizontal(eiobox.center()).item(Material.POWDER_INFINITY.getStack()); if (data.hasRFIO) { rfLine = rfLine.vertical(); } if (data.isPowered) { rfLine.progress(data.rf, data.maxrf, eiobox.getProbeinfo().defaultProgressStyle().suffix(EnderIO.lang.localize("top.suffix.rf")) .filledColor(0xffd63223).alternateFilledColor(0xffd63223)); } else { rfLine.text(loc("top.machine.outofpower")); } if (data.hasRFIO) { rfLine = rfLine.horizontal(); rfLine.vertical(eiobox.getProbeinfo().defaultLayoutStyle().spacing(-1))// .text(loc("top.rf.header.avg")).text(loc("top.rf.header.maxin")).text(loc("top.rf.header.maxout")); // LangPower.format should be run on the client, but we have no way to do that String line1 = loc("top.rf.value", (data.avgRF == 0 ? TextFormatting.WHITE : data.avgRF > 0 ? TextFormatting.GREEN + "+" : TextFormatting.RED) + LangPower.format(data.avgRF)); String line2 = loc("top.rf.value", LangPower.format(data.maxRFIn)); String line3 = loc("top.rf.value", LangPower.format(data.maxRFOut)); rfLine = rfLine.vertical(eiobox.getProbeinfo().defaultLayoutStyle().spacing(-1)).text(line1).text(line2).text(line3); } } else { eiobox.addMore(); } } }
NbtValue.FAKE.setBoolean(stack, true); eiobox.get().horizontal(eiobox.center()).item(stack).vertical(eiobox.getProbeinfo().defaultLayoutStyle().spacing(-1)).text(content1).text(content2);