2018-11-24 15:06:18 +01:00
|
|
|
package de.ellpeck.naturesaura.blocks.tiles;
|
|
|
|
|
2020-02-15 13:07:43 +01:00
|
|
|
import de.ellpeck.naturesaura.api.misc.IWorldData;
|
|
|
|
import de.ellpeck.naturesaura.misc.WorldData;
|
|
|
|
|
2018-11-24 15:06:18 +01:00
|
|
|
public class TileEntitySpawnLamp extends TileEntityImpl {
|
|
|
|
|
2020-01-22 01:32:26 +01:00
|
|
|
public TileEntitySpawnLamp() {
|
|
|
|
super(ModTileEntities.SPAWN_LAMP);
|
2020-01-21 23:02:39 +01:00
|
|
|
}
|
|
|
|
|
2018-11-24 15:06:18 +01:00
|
|
|
public int getRadius() {
|
|
|
|
return this.redstonePower * 3;
|
|
|
|
}
|
|
|
|
|
2020-02-15 13:07:43 +01:00
|
|
|
@Override
|
|
|
|
public void validate() {
|
|
|
|
super.validate();
|
|
|
|
if (!this.world.isRemote) {
|
|
|
|
WorldData data = (WorldData) IWorldData.getWorldData(this.world);
|
|
|
|
data.spawnLamps.add(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void remove() {
|
|
|
|
super.remove();
|
|
|
|
if (!this.world.isRemote) {
|
|
|
|
WorldData data = (WorldData) IWorldData.getWorldData(this.world);
|
|
|
|
data.spawnLamps.remove(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-27 13:57:34 +01:00
|
|
|
@Override
|
2019-03-19 17:21:06 +01:00
|
|
|
public void onRedstonePowerChange(int newPower) {
|
|
|
|
super.onRedstonePowerChange(newPower);
|
2019-01-27 13:57:34 +01:00
|
|
|
if (!this.world.isRemote)
|
|
|
|
this.sendToClients();
|
|
|
|
}
|
2018-11-24 15:06:18 +01:00
|
|
|
}
|