2014-07-16 03:26:04 +02:00
|
|
|
package appeng.tile.misc;
|
|
|
|
|
|
|
|
import appeng.tile.AEBaseTile;
|
2014-08-28 09:39:52 +02:00
|
|
|
import appeng.tile.TileEvent;
|
2014-07-16 03:26:04 +02:00
|
|
|
import appeng.tile.events.TileEventType;
|
|
|
|
import appeng.util.Platform;
|
|
|
|
|
|
|
|
public class TileLightDetector extends AEBaseTile
|
|
|
|
{
|
|
|
|
|
|
|
|
int lastCheck = 30;
|
|
|
|
int lastLight = 0;
|
|
|
|
|
|
|
|
public boolean isReady()
|
|
|
|
{
|
|
|
|
return lastLight > 0;
|
|
|
|
}
|
|
|
|
|
2014-08-28 09:39:52 +02:00
|
|
|
@TileEvent(TileEventType.TICK)
|
|
|
|
public void Tick_TileLightDetector()
|
2014-07-16 03:26:04 +02:00
|
|
|
{
|
2014-08-28 09:39:52 +02:00
|
|
|
lastCheck++;
|
|
|
|
if ( lastCheck > 30 )
|
2014-07-16 03:26:04 +02:00
|
|
|
{
|
2014-08-28 09:39:52 +02:00
|
|
|
lastCheck = 0;
|
|
|
|
updateLight();
|
2014-07-16 03:26:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void updateLight()
|
|
|
|
{
|
|
|
|
int val = worldObj.getBlockLightValue( xCoord, yCoord, zCoord );
|
|
|
|
|
|
|
|
if ( lastLight != val )
|
|
|
|
{
|
|
|
|
lastLight = val;
|
|
|
|
Platform.notifyBlocksOfNeighbors( worldObj, xCoord, yCoord, zCoord );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canBeRotated()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|