use of forestry.greenhouse.multiblock.IGreenhouseControllerInternal in project ForestryMC by ForestryMC.
the class ItemGreenhouseScreen method addInformation.
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flag) {
super.addInformation(stack, world, tooltip, flag);
boolean previewModeActive = isPreviewModeActive(stack);
String previewMode = Translator.translateToLocal(previewModeActive ? "for.greenhouse_screen.mode.active" : "for.greenhouse_screen.mode.inactive");
tooltip.add(Translator.translateToLocal(Translator.translateToLocalFormatted("for.greenhouse_screen.mode", previewMode)));
boolean isValid = isValid(stack, world);
BlockPos pos = getGreenhousePos(stack);
String state = isValid ? Translator.translateToLocalFormatted("for.greenhouse_screen.state.linked", pos.getX(), pos.getY(), pos.getZ()) : Translator.translateToLocal("for.greenhouse_screen.state.fail");
tooltip.add(Translator.translateToLocalFormatted("for.greenhouse_screen.state", state));
if (!isValid) {
return;
}
IGreenhouseControllerInternal controller = MultiblockUtil.getController(world, pos, IGreenhouseComponent.class);
IClimateState climateState = controller.getClimateContainer().getState();
tooltip.add(Translator.translateToLocalFormatted("for.greenhouse_screen.temperature", TextFormatting.GOLD + StringUtil.floatAsPercent(climateState.getTemperature())));
tooltip.add(Translator.translateToLocalFormatted("for.greenhouse_screen.humidity", TextFormatting.BLUE + StringUtil.floatAsPercent(climateState.getHumidity())));
}
Aggregations