for(ForgeDirection dir:ForgeDirection.VALID_DIRECTIONS) {
LPPosition pos = new LPPosition(this);
pos.moveForward(dir);
TileEntity tile = pos.getTileEntity(getWorldObj());
if(!(tile instanceof LogisticsTileGenericPipe)) continue;
LogisticsTileGenericPipe tPipe = (LogisticsTileGenericPipe) tile;
if(!(tPipe.pipe instanceof CoreRoutedPipe)) continue;
CoreRoutedPipe pipe = (CoreRoutedPipe) tPipe.pipe;
if(pipe.useEnergy(50)) {
heat += 5;
if(heat > 100) {
heat = 100;
}
updateHeat();
usedEnergy = true;
break;
}
}
if(!usedEnergy && getWorldObj().getTotalWorldTime() % 5 == 0) {
heat--;
if(heat < 0) {
heat = 0;
}
updateHeat();
}
} else if(!hasWork && heat > 0) {
heat--;
updateHeat();
}
if(hasWork && heat >= 100) {
for(ForgeDirection dir:ForgeDirection.VALID_DIRECTIONS) {
LPPosition pos = new LPPosition(this);
pos.moveForward(dir);
TileEntity tile = pos.getTileEntity(getWorldObj());
if(!(tile instanceof LogisticsTileGenericPipe)) continue;
LogisticsTileGenericPipe tPipe = (LogisticsTileGenericPipe) tile;
if(!(tPipe.pipe instanceof CoreRoutedPipe)) continue;
CoreRoutedPipe pipe = (CoreRoutedPipe) tPipe.pipe;
if(pipe.useEnergy(30)) {
progress += 3;
} else if(pipe.useEnergy(20)) {