use of mcjty.theoneprobe.apiimpl.styles.ProgressStyle in project TechReborn by TechReborn.
the class ProbeProvider method addProbeInfo.
@Override
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) {
euStyle = new ProgressStyle().backgroundColor(0xFF8B8B8B).borderColor(0xFF373737).alternateFilledColor(PowerSystem.getDisplayPower().altColour).filledColor(PowerSystem.getDisplayPower().colour);
euStyle.suffix(" " + PowerSystem.getDisplayPower().abbreviation);
TileEntity tile = world.getTileEntity(data.getPos());
if (tile instanceof IListInfoProvider) {
List<String> strs = new ArrayList<>();
((IListInfoProvider) tile).addInfo(strs, true);
for (String string : strs) {
probeInfo.text(string);
}
}
if (tile instanceof IEnergyInterfaceTile) {
IEnergyInterfaceTile energy = (IEnergyInterfaceTile) tile;
if (PowerSystem.getDisplayPower() != PowerSystem.EnergySystem.EU) {
probeInfo.progress((int) energy.getEnergy() * RebornCoreConfig.euPerFU, (int) energy.getMaxPower() * RebornCoreConfig.euPerFU, euStyle);
} else {
probeInfo.progress((int) energy.getEnergy(), (int) energy.getMaxPower(), euStyle);
}
}
if (tile instanceof TileLegacyMachineBase && methodHandle_addStacks != null) {
TileLegacyMachineBase legacyMachineBase = (TileLegacyMachineBase) tile;
if (legacyMachineBase.getInventoryForTile().isPresent()) {
if (player.isSneaking()) {
probeInfo.text(I18n.translateToLocal("techreborn.tooltip.inventory"));
}
Inventory inventory = legacyMachineBase.getInventoryForTile().get();
if (!inventory.isEmpty()) {
List<ItemStack> stacks = Arrays.stream(inventory.contents).filter(stack -> !stack.isEmpty()).collect(Collectors.toList());
try {
methodHandle_addStacks.invoke(probeInfo, world, null, stacks, player.isSneaking());
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}
}
if (!legacyMachineBase.upgradeInventory.isEmpty() && player.isSneaking()) {
probeInfo.horizontal();
probeInfo.text(I18n.translateToLocal("techreborn.tooltip.upgrades"));
List<ItemStack> stacks = Arrays.stream(legacyMachineBase.upgradeInventory.contents).filter(stack -> !stack.isEmpty()).collect(Collectors.toList());
try {
methodHandle_addStacks.invoke(probeInfo, world, null, stacks, player.isSneaking());
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}
}
}
use of mcjty.theoneprobe.apiimpl.styles.ProgressStyle in project HorsePower by GoryMoon.
the class BlockChopper method addProbeInfo.
// The One Probe Integration
@Optional.Method(modid = "theoneprobe")
@Override
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) {
TileEntityChopper tileEntity = getTileEntity(world, data.getPos());
if (tileEntity != null) {
double totalWindup = Configs.general.pointsForWindup > 0 ? Configs.general.pointsForWindup : 1;
probeInfo.progress((long) ((((double) tileEntity.getField(2)) / totalWindup) * 100L), 100L, new ProgressStyle().prefix(Localization.TOP.WINDUP_PROGRESS.translate() + " ").suffix("%"));
if (tileEntity.getField(0) > 1)
probeInfo.progress((long) ((((double) tileEntity.getField(1)) / ((double) tileEntity.getField(0))) * 100L), 100L, new ProgressStyle().prefix(Localization.TOP.CHOPPING_PROGRESS.translate() + " ").suffix("%"));
}
}
Aggregations