@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 ElementItemStack(ByteBuf buf) { if (buf.readBoolean()) { itemStack = NetworkTools.readItemStack(buf); } else { itemStack = ItemStack.EMPTY; } style = new ItemStyle() .width(buf.readInt()) .height(buf.readInt()); }
@Override public int getHeight() { return style.getHeight(); }
@Override public int getWidth() { return style.getWidth(); }
@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); } } } }
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 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); } }
if(!stack.isEmpty()) { probeInfo.horizontal(new LayoutStyle().spacing(10).alignment(ElementAlignment.ALIGN_CENTER)) .item(stack, new ItemStyle().width(16).height(16)) .text(INFO + stack.getDisplayName()); if (mode == ProbeMode.EXTENDED) {
public static void render(ItemStack itemStack, IItemStyle style, int x, int y) { RenderItem itemRender = Minecraft.getMinecraft().getRenderItem(); if (!itemStack.isEmpty()) { int size = itemStack.getCount(); String amount; if (size <= 1) { amount = ""; } else if (size < 100000) { amount = String.valueOf(size); } else if (size < 1000000) { amount = String.valueOf(size / 1000) + "k"; } else if (size < 1000000000) { amount = String.valueOf(size / 1000000) + "m"; } else { amount = String.valueOf(size / 1000000000) + "g"; } if (!RenderHelper.renderItemStack(Minecraft.getMinecraft(), itemRender, itemStack, x + (style.getWidth() - 18) / 2, y + (style.getHeight() - 18) / 2, amount)) { // There was a crash rendering this item RenderHelper.renderText(Minecraft.getMinecraft(), x, y, TextFormatting.RED + "ERROR: " + itemStack.getDisplayName()); } } }
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 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"); } } }