@Override public void addProbeInfo( AEBaseTile tile, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data ) { if( tile instanceof TileCraftingMonitorTile ) { final TileCraftingMonitorTile monitor = (TileCraftingMonitorTile) tile; final IAEItemStack displayStack = monitor.getJobProgress(); if( displayStack != null ) { // TODO: check if OK final ItemStack itemStack = displayStack.asItemStackRepresentation(); final String itemName = itemStack.getDisplayName(); final String formattedCrafting = String.format( TheOneProbeText.CRAFTING.getLocal(), itemName ); final IProbeInfo centerAlignedHorizontalLayout = probeInfo .horizontal( probeInfo.defaultLayoutStyle().alignment( ElementAlignment.ALIGN_CENTER ) ); centerAlignedHorizontalLayout.item( itemStack ); centerAlignedHorizontalLayout.text( formattedCrafting ); } } }
@Override public void addProbeInfo( AEBaseTile tile, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data ) { if( tile instanceof TileCharger ) { final TileCharger charger = (TileCharger) tile; final IItemHandler chargerInventory = charger.getInternalInventory(); final ItemStack chargingItem = chargerInventory.getStackInSlot( 0 ); if( !chargingItem.isEmpty() ) { final String currentInventory = chargingItem.getDisplayName(); final IProbeInfo centerAlignedHorizontalLayout = probeInfo .horizontal( probeInfo.defaultLayoutStyle().alignment( ElementAlignment.ALIGN_CENTER ) ); centerAlignedHorizontalLayout.item( chargingItem ); centerAlignedHorizontalLayout.text( currentInventory ); } } }
@SuppressWarnings("unused") public ILayoutStyle right() { return probeinfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_BOTTOMRIGHT); }
public ILayoutStyle center() { return probeinfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER); }
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())); } } }
private void showMobSpawnerInfo(IProbeInfo probeInfo, World world, IProbeHitData data, Block block) { if (block instanceof BlockMobSpawner) { TileEntity te = world.getTileEntity(data.getPos()); if (te instanceof TileEntityMobSpawner) { MobSpawnerBaseLogic logic = ((TileEntityMobSpawner) te).getSpawnerBaseLogic(); String mobName = logic.getCachedEntity().getName(); probeInfo.horizontal(probeInfo.defaultLayoutStyle() .alignment(ElementAlignment.ALIGN_CENTER)) .text(LABEL + "Mob: " + INFO + mobName); } } }
@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); } } } } }
@Override protected void addProbeInfo(IWorkable capability, IProbeInfo probeInfo, TileEntity tileEntity, EnumFacing sideHit) { int currentProgress = capability.getProgress(); int maxProgress = capability.getMaxProgress(); if(maxProgress > 0) { int progressScaled = maxProgress == 0 ? 0 : (int) Math.floor(currentProgress / (maxProgress * 1.0) * 100); IProbeInfo horizontalPane = probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)); horizontalPane.text(TextStyleClass.INFO + "{*gregtech.top.progress*} "); horizontalPane.progress(progressScaled, 100, probeInfo.defaultProgressStyle() .suffix("%") .borderColor(0x00000000) .backgroundColor(0x00000000) .filledColor(0xFF000099) .alternateFilledColor(0xFF000077)); } if(!capability.isWorkingEnabled()) { probeInfo.text(TextStyleClass.INFOIMP + "{*gregtech.top.working_disabled*}"); } } }
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 showBrewingStandInfo(IProbeInfo probeInfo, World world, IProbeHitData data, Block block) { if (block instanceof BlockBrewingStand) { TileEntity te = world.getTileEntity(data.getPos()); if (te instanceof TileEntityBrewingStand) { int brewtime = ((TileEntityBrewingStand) te).getField(0); int fuel = ((TileEntityBrewingStand) te).getField(1); probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)) .item(new ItemStack(Items.BLAZE_POWDER), probeInfo.defaultItemStyle().width(16).height(16)) .text(LABEL + "Fuel: " + INFO + fuel); if (brewtime > 0) { probeInfo.text(LABEL + "Time: " + INFO + brewtime + " ticks"); } } } }
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(); } } }
@Override public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) { TileEntity te = world.getTileEntity(data.getPos()); if (te instanceof DataTileEntity) { DataTileEntity dataTileEntity = (DataTileEntity) te; probeInfo.horizontal() .item(new ItemStack(Items.CLOCK)) .text(TextFormatting.GREEN + STARTLOC + "message.modtut.counter" + ENDLOC + " " + dataTileEntity.getCounter()); probeInfo.horizontal(probeInfo.defaultLayoutStyle().borderColor(0xffff0000)) .entity("minecraft:horse") .progress(dataTileEntity.getCounter() % 100, 100, probeInfo.defaultProgressStyle().suffix("%")); } }
@Override protected void addProbeInfo(IEnergyContainer capability, IProbeInfo probeInfo, TileEntity tileEntity, EnumFacing sideHit) { long energyStored = capability.getEnergyStored(); long maxStorage = capability.getEnergyCapacity(); if(maxStorage == 0) return; //do not add empty max storage progress bar IProbeInfo horizontalPane = probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)); String additionalSpacing = tileEntity.hasCapability(GregtechCapabilities.CAPABILITY_WORKABLE, sideHit) ? " " : ""; horizontalPane.text(TextStyleClass.INFO + "{*gregtech.top.energy_stored*} " + additionalSpacing); horizontalPane.progress(energyStored, maxStorage, probeInfo.defaultProgressStyle() .suffix("/" + maxStorage + " EU") .borderColor(0x00000000) .backgroundColor(0x00000000) .filledColor(0xFFFFE000) .alternateFilledColor(0xFFEED000)); }
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 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(); } } }