2018-10-28 17:39:53 +01:00
|
|
|
package de.ellpeck.naturesaura.blocks;
|
|
|
|
|
2021-12-04 15:40:09 +01:00
|
|
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraDetector;
|
2021-12-15 14:26:42 +01:00
|
|
|
import net.minecraft.core.BlockPos;
|
|
|
|
import net.minecraft.world.level.Level;
|
|
|
|
import net.minecraft.world.level.block.SoundType;
|
|
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
|
|
import net.minecraft.world.level.material.Material;
|
2018-10-28 17:39:53 +01:00
|
|
|
|
|
|
|
public class BlockAuraDetector extends BlockContainerImpl {
|
|
|
|
|
|
|
|
public BlockAuraDetector() {
|
2021-12-19 15:32:45 +01:00
|
|
|
super("aura_detector", BlockEntityAuraDetector.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
|
2018-10-28 17:39:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-12-15 14:26:42 +01:00
|
|
|
public boolean hasAnalogOutputSignal(BlockState state) {
|
2018-10-28 17:39:53 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-12-15 14:26:42 +01:00
|
|
|
public int getAnalogOutputSignal(BlockState blockState, Level levelIn, BlockPos pos) {
|
2021-12-15 16:30:22 +01:00
|
|
|
var tile = levelIn.getBlockEntity(pos);
|
2021-12-15 14:26:42 +01:00
|
|
|
if (tile instanceof BlockEntityAuraDetector detector)
|
|
|
|
return detector.redstonePower;
|
2018-10-28 17:39:53 +01:00
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|