package com.thebrokenrail.energonrelics.block; import com.thebrokenrail.energonrelics.block.entity.LightningRodBlockEntity; import com.thebrokenrail.energonrelics.block.util.energy.EnergyProviderBlock; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.BlockState; import net.minecraft.block.Material; import net.minecraft.block.MaterialColor; import net.minecraft.block.ShapeContext; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.util.math.BlockPos; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import java.util.function.Function; public class LightningRodBlock extends EnergyProviderBlock { public LightningRodBlock() { super(FabricBlockSettings.of(Material.STONE, MaterialColor.BLUE_TERRACOTTA).nonOpaque().allowsSpawning((state, world, pos, type) -> false).solidBlock((state, world, pos) -> false).suffocates((state, world, pos) -> false).emissiveLighting((state, world, pos) -> true).lightLevel(10).requiresTool().strength(1.5f, 6.0f)); } @Override @SuppressWarnings("deprecation") @Environment(EnvType.CLIENT) public float getAmbientOcclusionLightLevel(BlockState state, BlockView world, BlockPos pos) { return 1f; } @Override public boolean isTranslucent(BlockState state, BlockView world, BlockPos pos) { return true; } @Override protected Function, BlockEntity> getFactory() { return LightningRodBlockEntity::new; } private static final VoxelShape SHAPE = VoxelShapes.union(createCuboidShape(3d, 0d, 3d, 13d, 2d, 13d), createCuboidShape(7.5d, 2d, 7.5d, 8.5d, 26d, 8.5d)); @SuppressWarnings("deprecation") @Override public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return SHAPE; } }