Search in sources :

Example 1 with EnumTankLevel

use of forestry.core.render.EnumTankLevel in project ForestryMC by ForestryMC.

the class TankManager method updateTankLevels.

private void updateTankLevels(StandardTank tank, boolean sendUpdate) {
    if (!(tile instanceof IRenderableTile)) {
        return;
    }
    int tankIndex = tank.getTankIndex();
    EnumTankLevel tankLevel = EnumTankLevel.rateTankLevel(tank);
    if (tankLevel != tankLevels.get(tankIndex)) {
        tankLevels.set(tankIndex, tankLevel);
        if (sendUpdate) {
            PacketTankLevelUpdate tankLevelUpdate = new PacketTankLevelUpdate(tile, tankIndex, tank.getFluid());
            NetworkUtil.sendNetworkPacket(tankLevelUpdate, tile.getCoordinates(), tile.getWorldObj());
        }
    }
}
Also used : EnumTankLevel(forestry.core.render.EnumTankLevel) IRenderableTile(forestry.core.tiles.IRenderableTile) PacketTankLevelUpdate(forestry.core.network.packets.PacketTankLevelUpdate)

Example 2 with EnumTankLevel

use of forestry.core.render.EnumTankLevel in project ForestryMC by ForestryMC.

the class GuiEngineElectric method drawGuiContainerBackgroundLayer.

@Override
protected void drawGuiContainerBackgroundLayer(float var1, int mouseX, int mouseY) {
    super.drawGuiContainerBackgroundLayer(var1, mouseX, mouseY);
    TileEngineElectric engine = tile;
    int storageHeight = engine.getStorageScaled(46);
    int storageMaxHeight = engine.getStorageScaled(100);
    EnumTankLevel rated = EnumTankLevel.rateTankLevel(storageMaxHeight);
    drawHealthMeter(guiLeft + 74, guiTop + 25, storageHeight, rated);
}
Also used : EnumTankLevel(forestry.core.render.EnumTankLevel) TileEngineElectric(forestry.energy.tiles.TileEngineElectric)

Aggregations

EnumTankLevel (forestry.core.render.EnumTankLevel)2 PacketTankLevelUpdate (forestry.core.network.packets.PacketTankLevelUpdate)1 IRenderableTile (forestry.core.tiles.IRenderableTile)1 TileEngineElectric (forestry.energy.tiles.TileEngineElectric)1