Search in sources :

Example 1 with TileEntityHeatSink

use of pneumaticCraft.common.tileentity.TileEntityHeatSink in project PneumaticCraft by MineMaarten.

the class ModuleAirGrate method coolHeatSinks.

private void coolHeatSinks(World world, int x, int y, int z, int range) {
    if (grateRange > 2) {
        int curTeIndex = (int) (world.getTotalWorldTime() % 27);
        x += dir.offsetX * 2;
        y += dir.offsetY * 2;
        z += dir.offsetZ * 2;
        TileEntity te = world.getTileEntity(x - 1 + curTeIndex % 3, y - 1 + curTeIndex / 3 % 3, z - 1 + curTeIndex / 9 % 3);
        if (te instanceof TileEntityHeatSink)
            heatSinks.add((TileEntityHeatSink) te);
        Iterator<TileEntityHeatSink> iterator = heatSinks.iterator();
        while (iterator.hasNext()) {
            TileEntityHeatSink heatSink = iterator.next();
            if (heatSink.isInvalid()) {
                iterator.remove();
            } else {
                for (int i = 0; i < 4; i++) heatSink.onFannedByAirGrate();
            }
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityHeatSink(pneumaticCraft.common.tileentity.TileEntityHeatSink)

Aggregations

TileEntity (net.minecraft.tileentity.TileEntity)1 TileEntityHeatSink (pneumaticCraft.common.tileentity.TileEntityHeatSink)1