@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 IProgress) { IProgress progressTe = (IProgress) te; float progress = progressTe.getProgress(); if(progress > 0f) { probeInfo.horizontal().progress((int)(progress*100f), 100, probeInfo.defaultProgressStyle().suffix("%")); } } } }
private void addRFInfo(IProbeInfo probeInfo, ProbeConfig config, long energy, long maxEnergy) { if (config.getRFMode() == 1) { probeInfo.progress(energy, maxEnergy, probeInfo.defaultProgressStyle() .suffix("RF") .filledColor(Config.rfbarFilledColor) .alternateFilledColor(Config.rfbarAlternateFilledColor) .borderColor(Config.rfbarBorderColor) .numberFormat(Config.rfFormat)); } else { probeInfo.text(PROGRESS + "RF: " + ElementProgress.format(energy, Config.rfFormat, "RF")); } }
@Override 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 ResonatingCrystalTileEntity) { ResonatingCrystalTileEntity crystal = (ResonatingCrystalTileEntity) te; DecimalFormat fmt = new DecimalFormat("#.#"); probeInfo.text(TextFormatting.GREEN + "Strength/Efficiency/Purity: " + fmt.format(crystal.getStrength()) + "% " + fmt.format(crystal.getEfficiency()) + "% " + fmt.format(crystal.getPurity()) + "%"); int rfPerTick = crystal.getRfPerTick(); if (mode == ProbeMode.DEBUG) { probeInfo.text(TextStyleClass.INFO + "RF/t: " + rfPerTick + " RF/t"); probeInfo.text(TextStyleClass.INFO + "Power: " + fmt.format(crystal.getPower()) + "%"); probeInfo.text(TextStyleClass.INFO + "Instability: " + fmt.format(crystal.getInstability())); probeInfo.text(TextStyleClass.INFO + "Resistance: " + crystal.getResistance()); probeInfo.text(TextStyleClass.INFO + "Cooldown: " + crystal.getCooldown()); } else { probeInfo.horizontal().text(TextFormatting.YELLOW + "Power: " + fmt.format(crystal.getPower()) + "% (" + rfPerTick + " RF/t)") .progress((int) crystal.getPower(), 100, probeInfo.defaultProgressStyle() .suffix("%") .width(40) .height(10) .showText(false) .filledColor(0xffff0000) .alternateFilledColor(0xff990000)); } } }
@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 addFluidInfo(IProbeInfo probeInfo, ProbeConfig config, FluidStack fluidStack, int maxContents) { int contents = fluidStack == null ? 0 : fluidStack.amount; if (fluidStack != null) { probeInfo.text(NAME + "Liquid: " + fluidStack.getLocalizedName()); } if (config.getTankMode() == 1) { probeInfo.progress(contents, maxContents, probeInfo.defaultProgressStyle() .suffix("mB") .filledColor(Config.tankbarFilledColor) .alternateFilledColor(Config.tankbarAlternateFilledColor) .borderColor(Config.tankbarBorderColor) .numberFormat(Config.tankFormat)); } else { probeInfo.text(PROGRESS + ElementProgress.format(contents, Config.tankFormat, "mB")); } }
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(); } } }
@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 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 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(); } } }
@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()); } } } }
int armor = livingBase.getTotalArmorValue(); probeInfo.progress(health, maxHealth, probeInfo.defaultProgressStyle().lifeBar(true).showText(false).width(150).height(10)); probeInfo.progress(armor, armor, probeInfo.defaultProgressStyle().armorBar(true).showText(false).width(80).height(10));
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(); } } }