Search in sources :

Example 1 with IWorker

use of org.cyclops.commoncapabilities.api.capability.work.IWorker in project TUMAT by canitzp.

the class CommonCapabilities method renderTileEntity.

@Override
public TooltipComponent renderTileEntity(WorldClient world, EntityPlayerSP player, TileEntity tile, EnumFacing side, TooltipComponent component, boolean shouldCalculate) {
    // Temperature
    if (ConfigBoolean.SHOW_TEMPERATURE_COMMONCAPABILITIES.value && tile.hasCapability(TemperatureConfig.CAPABILITY, side)) {
        ITemperature temp = tile.getCapability(TemperatureConfig.CAPABILITY, side);
        if (temp != null) {
            float max = Math.round(temp.getMaximumTemperature() * 10F) / 10F;
            component.add(new TextComponent(L10n.getCommonCapsTemp(String.valueOf((Math.round(temp.getTemperature() * 10F) / 10F)), max > 10000 ? "<10000" : String.valueOf(max))).setColor(0x00EA723F), TooltipComponent.Priority.HIGH);
        }
    }
    // Worker
    if (ConfigBoolean.SHOW_WORK_COMMONCAPABILITIES.value && tile.hasCapability(WorkerConfig.CAPABILITY, side)) {
        IWorker worker = tile.getCapability(WorkerConfig.CAPABILITY, side);
        if (worker != null) {
            component.add(new TextComponent(worker.canWork() && worker.hasWork() ? L10n.COMMONCAPS_WORK_ON : L10n.COMMONCAPS_WORK_OFF).setColor(0x00965A40), TooltipComponent.Priority.HIGH);
        }
    }
    return component;
}
Also used : TextComponent(de.canitzp.tumat.api.components.TextComponent) ITemperature(org.cyclops.commoncapabilities.api.capability.temperature.ITemperature) IWorker(org.cyclops.commoncapabilities.api.capability.work.IWorker)

Aggregations

TextComponent (de.canitzp.tumat.api.components.TextComponent)1 ITemperature (org.cyclops.commoncapabilities.api.capability.temperature.ITemperature)1 IWorker (org.cyclops.commoncapabilities.api.capability.work.IWorker)1