public IProbeInfo get() { if (eiobox == null) { eiobox = probeinfo.vertical(probeinfo.defaultLayoutStyle().borderColor(0xffff0000)); } return eiobox; }
@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())); } } }
public void finish() { if (eiobox != null) { if (addMoreIndicator) { addIcon(addIcon(get().horizontal(center()), IconEIO.TOP_NOICON, 0), IconEIO.TOP_MORE, 0); } else { addIcon(addIcon(get().horizontal(center()), IconEIO.TOP_NOICON, 0), IconEIO.TOP_NOMORE, 0); } } else if (addMoreIndicator) { addIcon(addIcon(probeinfo.vertical().horizontal(center()), IconEIO.TOP_NOICON_WIDE, 0), IconEIO.TOP_MORE, 0); } } }
private void showDebugInfo(IProbeInfo probeInfo, World world, IBlockState blockState, BlockPos pos, Block block, EnumFacing side) { String simpleName = block.getClass().getSimpleName(); IProbeInfo vertical = probeInfo.vertical(new LayoutStyle().borderColor(0xffff4444).spacing(2)) .text(LABEL + "Reg Name: " + INFO + block.getRegistryName().toString()) .text(LABEL + "Unlocname: " + INFO + block.getUnlocalizedName()) .text(LABEL + "Meta: " + INFO + blockState.getBlock().getMetaFromState(blockState)) .text(LABEL + "Class: " + INFO + simpleName) .text(LABEL + "Hardness: " + INFO + block.getBlockHardness(blockState, world, pos)) .text(LABEL + "Power W: " + INFO + block.getWeakPower(blockState, world, pos, side.getOpposite()) + LABEL + ", S: " + INFO + block.getStrongPower(blockState, world, pos, side.getOpposite())) .text(LABEL + "Light: " + INFO + block.getLightValue(blockState, world, pos)); TileEntity te = world.getTileEntity(pos); if (te != null) { vertical.text(LABEL + "TE: " + INFO + te.getClass().getSimpleName()); } } }
public static void registerTopExtras() { TOPCompatibility.GetTheOneProbe.probe.registerBlockDisplayOverride((mode, probeInfo, player, world, blockState, data) -> { Block block = blockState.getBlock(); if (block == ModBlocks.facadeBlock) { String modid = XNet.MODNAME; ItemStack pickBlock = data.getPickBlock(); TileEntity te = world.getTileEntity(data.getPos()); if (te instanceof FacadeTileEntity) { pickBlock = new ItemStack(NetCableSetup.netCableBlock, 1, pickBlock.getItemDamage()); } if (!pickBlock.isEmpty()) { probeInfo.horizontal() .item(pickBlock) .vertical() .itemLabel(pickBlock) .text(MODNAME + modid); } else { probeInfo.vertical() .text(NAME + getBlockUnlocalizedName(block)) .text(MODNAME + modid); } return true; } return false; }); }
@Override @Optional.Method(modid = "theoneprobe") public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) { super.addProbeInfo(mode, probeInfo, player, world, blockState, data); TileEntity te = world.getTileEntity(data.getPos()); if (te instanceof ProcessorTileEntity) { ProcessorTileEntity processor = (ProcessorTileEntity) te; if (processor.hasNetworkCard()) { probeInfo.text(TextFormatting.GREEN + "Channel: " + processor.getChannelName()); probeInfo.text(TextFormatting.GREEN + "Nodes: " + processor.getNodeCount()); } if (mode == ProbeMode.EXTENDED) { List<String> lastMessages = processor.getLastMessages(6); if (!lastMessages.isEmpty()) { IProbeInfo v = probeInfo.vertical(probeInfo.defaultLayoutStyle().borderColor(0xffff0000)); for (String s : lastMessages) { v.text(" " + s); } } } } }
private void renderProbe() { Block block = Blocks.LOG; String modid = Tools.getModName(block); ProbeInfo probeInfo = TheOneProbe.theOneProbeImp.create(); ItemStack pickBlock = new ItemStack(block); probeInfo.horizontal() .item(pickBlock) .vertical() .text(NAME + pickBlock.getDisplayName()) .text(MODNAME + modid); probeInfo.text(LABEL + "Fuel: " + INFO + "5 volts"); probeInfo.text(LABEL + "Error: " + ERROR + "Oups!"); renderElements(probeInfo, Config.getDefaultOverlayStyle()); }
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()); } }
public static void showStandardInfo(ProbeMode mode, IProbeInfo probeInfo, Entity entity, IProbeConfig config) { String modid = Tools.getModName(entity); if (Tools.show(mode, config.getShowModName())) { probeInfo.horizontal() .entity(entity) .vertical() .text(NAME + entity.getDisplayName().getFormattedText()) .text(MODNAME + modid); } else { probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)) .entity(entity) .text(NAME + entity.getDisplayName().getFormattedText()); } } }
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(); } } }
horizontal.vertical() .text(NAME + fluidStack.getLocalizedName()) .text(MODNAME + modid); probeInfo.horizontal() .item(pickBlock) .vertical() .itemLabel(pickBlock) .text(MODNAME + modid); probeInfo.vertical() .text(NAME + getBlockUnlocalizedName(block)) .text(MODNAME + modid); } else { probeInfo.vertical() .text(NAME + getBlockUnlocalizedName(block));
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++; } } }
NbtValue.FAKE.setBoolean(stack, true); eiobox.get().horizontal(eiobox.center()).item(stack).vertical(eiobox.getProbeinfo().defaultLayoutStyle().spacing(-1)).text(content1).text(content2);
Collection<PotionEffect> effects = livingBase.getActivePotionEffects(); if (!effects.isEmpty()) { IProbeInfo vertical = probeInfo.vertical(probeInfo.defaultLayoutStyle().borderColor(0xffffffff)); float durationFactor = 1.0f; for (PotionEffect effect : effects) {