@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(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) { TileEntity te = world.getTileEntity(data.getPos()); if(te instanceof BaseTileEntityTunnel) { BaseTileEntityTunnel tnt = (BaseTileEntityTunnel) te; String translate = "enumfacing." + blockState.getValue(BlockBaseTunnel.MACHINE_SIDE).getName(); probeInfo.horizontal() .item(new ItemStack(Items.COMPASS), probeInfo.defaultItemStyle().width(14).height(14)) .text(TextFormatting.YELLOW + "{*" + translate + "*}" + TextFormatting.RESET); ItemStack connectedStack = tnt.getConnectedPickBlock(); if(connectedStack != null && !connectedStack.isEmpty()) { probeInfo.horizontal().item(connectedStack, probeInfo.defaultItemStyle().width(14).height(14)).itemLabel(connectedStack); } } } }
@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 ); } } }
@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 TileEntityFieldProjector) { TileEntityFieldProjector tfp = (TileEntityFieldProjector) te; TileEntityFieldProjector master = tfp.getMasterProjector(); if(master == null) { return; } ItemStack crafting = master.getActiveCraftingResult(); if(!crafting.isEmpty()) { probeInfo.horizontal().text("{*top.compactmachines3.currently_crafting*}").item(crafting).itemLabel(crafting); probeInfo.horizontal().progress((int)(master.getCraftingProgressPercent() * 100), 100, probeInfo.defaultProgressStyle().suffix("%").filledColor(0xff44AA44).alternateFilledColor(0xff44AA44).backgroundColor(0xff836953)); return; } MultiblockRecipe result = MultiblockRecipes.tryCrafting(world, data.getPos(), null); if(result != null) { probeInfo.horizontal().text("{*top.compactmachines3.found_recipe_for*}").item(result.getTargetStack()).itemLabel(result.getTargetStack()); } } } }
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()); } } }
@Override public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) { probeInfo.horizontal() .item(new ItemStack(Items.REDSTONE), probeInfo.defaultItemStyle().width(14).height(14)) .text(blockState.getValue(IS_OUTPUT) ? TextFormatting.DARK_GREEN + "Output" : TextFormatting.DARK_RED + "Input"); super.addProbeInfo(mode, probeInfo, player, world, blockState, data); } }
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; }); }
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 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 showRedstonePower(IProbeInfo probeInfo, World world, IBlockState blockState, IProbeHitData data, Block block, boolean showLever) { if (showLever && block instanceof BlockLever) { // We are showing the lever setting so we don't show redstone in that case return; } int redstonePower; if (block instanceof BlockRedstoneWire) { redstonePower = blockState.getValue(BlockRedstoneWire.POWER); } else { redstonePower = world.getRedstonePower(data.getPos(), data.getSideHit().getOpposite()); } if (redstonePower > 0) { probeInfo.horizontal() .item(new ItemStack(Items.REDSTONE), probeInfo.defaultItemStyle().width(14).height(14)) .text(LABEL + "Power: " + INFO + redstonePower); } }
private void mkItemFillLevelLine(ProbeMode mode, EioBox eiobox, TOPData data) { if (data.hasItemFillLevel) { if (mode != ProbeMode.NORMAL || TopConfig.showItemCountDefault.get()) { eiobox.get().horizontal(eiobox.center()).item(new ItemStack(Blocks.CHEST)).progress(data.fillCur, data.fillMax, eiobox.getProbeinfo().defaultProgressStyle().suffix(EnderIO.lang.localize("top.suffix.items")).filledColor(0xfff8f83c) .alternateFilledColor(0xffcfac0b).borderColor(0xffcfac0b)); } 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"); } } } }
@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("%")); } }
private void mkXPLine(ProbeMode mode, EioBox eiobox, TOPData data) { if (data.hasXP) { if (mode != ProbeMode.NORMAL || TopConfig.showXPByDefault.get()) { // We need to put the number of levels in as "current" value for it to be displayed as text. To make the progress bar scale to the partial level, we set // the "max" value in a way that is in the same ratio to the number of levels as the xp needed for the next level is to the current xp. If the bar // should be empty but we do have at least one level in, there will be a small error, as (levels/Integer.MAX_VALUE) > 0. int scalemax = data.xpBarScaled > 0 ? data.experienceLevel * 100 / data.xpBarScaled : Integer.MAX_VALUE; eiobox.get().horizontal(eiobox.center()).item(new ItemStack(Items.EXPERIENCE_BOTTLE)).progress(data.experienceLevel, scalemax, eiobox.getProbeinfo().defaultProgressStyle().suffix(EnderIO.lang.localize("top.suffix.levels")).filledColor(0xff00FF0F) .alternateFilledColor(0xff00AA0A).borderColor(0xff00AA0A)); } else { eiobox.addMore(); } } }
private void showLeverSetting(IProbeInfo probeInfo, World world, IBlockState blockState, IProbeHitData data, Block block) { if (block instanceof BlockLever) { Boolean powered = blockState.getValue(BlockLever.POWERED); probeInfo.horizontal().item(new ItemStack(Items.REDSTONE), probeInfo.defaultItemStyle().width(14).height(14)) .text(LABEL + "State: " + INFO + (powered ? "On" : "Off")); } else if (block instanceof BlockRedstoneComparator) { BlockRedstoneComparator.Mode mode = blockState.getValue(BlockRedstoneComparator.MODE); probeInfo.text(LABEL + "Mode: " + INFO + mode.getName()); } else if (block instanceof BlockRedstoneRepeater) { Boolean locked = blockState.getValue(BlockRedstoneRepeater.LOCKED); Integer delay = blockState.getValue(BlockRedstoneRepeater.DELAY); probeInfo.text(LABEL + "Delay: " + INFO + delay + " ticks"); if (locked) { probeInfo.text(INFO + "Locked"); } } }
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 mkProgressLine(ProbeMode mode, EioBox eiobox, TOPData data) { if (data.progressResult != TOPData.ProgressResult.NONE) { if (mode != ProbeMode.NORMAL || TopConfig.showProgressByDefault.get() || data.progressResult == TOPData.ProgressResult.PROGRESS_NO_POWER) { final IProbeInfo progressLine = eiobox.get().horizontal(eiobox.center()).item(new ItemStack(Items.CLOCK)); switch (data.progressResult) { case PROGRESS: progressLine.progress((int) (data.progress * 100), 100, eiobox.getProbeinfo().defaultProgressStyle() .suffix(EnderIO.lang.localize("top.suffix.percent")).filledColor(0xffffb600).alternateFilledColor(0xffffb600)); break; case PROGRESS_NO_POWER: progressLine.text(loc("top.progress.outofpower")); break; case PROGRESS_ACTIVE: case NO_PROGRESS_ACTIVE: progressLine.text(loc("top.machine.active")); break; case PROGRESS_IDLE: case NO_PROGRESS_IDLE: progressLine.text(loc("top.machine.idle")); break; case NONE: break; } } 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);
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(); } } }