mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-14 16:49:09 +01:00
47 lines
1.2 KiB
Java
47 lines
1.2 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();
|
|
}
|
|
|
|
@Override
|
|
public boolean allowsLowerLimiter() {
|
|
return true;
|
|
}
|
|
}
|