mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-06-29 13:36:36 +02:00
43 lines
1.1 KiB
Java
43 lines
1.1 KiB
Java
package de.ellpeck.naturesaura.blocks.tiles;
|
|
|
|
import de.ellpeck.naturesaura.api.misc.ILevelData;
|
|
import de.ellpeck.naturesaura.misc.LevelData;
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
|
|
public class BlockEntitySpawnLamp extends BlockEntityImpl {
|
|
|
|
public BlockEntitySpawnLamp(BlockPos pos, BlockState state) {
|
|
super(ModBlockEntities.SPAWN_LAMP, pos, state);
|
|
}
|
|
|
|
public int getRadius() {
|
|
return this.redstonePower * 3;
|
|
}
|
|
|
|
@Override
|
|
public void onLoad() {
|
|
super.onLoad();
|
|
if (!this.level.isClientSide) {
|
|
var data = (LevelData) ILevelData.getLevelData(this.level);
|
|
data.spawnLamps.add(this);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void setRemoved() {
|
|
super.setRemoved();
|
|
if (!this.level.isClientSide) {
|
|
var data = (LevelData) ILevelData.getLevelData(this.level);
|
|
data.spawnLamps.remove(this);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void onRedstonePowerChange(int newPower) {
|
|
super.onRedstonePowerChange(newPower);
|
|
if (!this.level.isClientSide)
|
|
this.sendToClients();
|
|
}
|
|
}
|