37 lines
1.4 KiB
Java
37 lines
1.4 KiB
Java
|
package com.thebrokenrail.energonrelics.block;
|
||
|
|
||
|
import com.thebrokenrail.energonrelics.block.entity.EnergonLightBlockEntity;
|
||
|
import com.thebrokenrail.energonrelics.block.util.EnergyProviderBlock;
|
||
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||
|
import net.minecraft.block.Block;
|
||
|
import net.minecraft.block.BlockState;
|
||
|
import net.minecraft.block.Material;
|
||
|
import net.minecraft.block.entity.BlockEntity;
|
||
|
import net.minecraft.block.entity.BlockEntityType;
|
||
|
import net.minecraft.sound.BlockSoundGroup;
|
||
|
import net.minecraft.state.StateManager;
|
||
|
import net.minecraft.state.property.BooleanProperty;
|
||
|
import net.minecraft.state.property.Properties;
|
||
|
|
||
|
import java.util.function.Function;
|
||
|
|
||
|
public class EnergonLightBlock extends EnergyProviderBlock {
|
||
|
public static final BooleanProperty POWERED = Properties.POWERED;
|
||
|
|
||
|
public EnergonLightBlock() {
|
||
|
super(FabricBlockSettings.of(Material.GLASS).sounds(BlockSoundGroup.GLASS).nonOpaque().lightLevel(state -> state.get(POWERED) ? 15 : 0).strength(0.3f));
|
||
|
setDefaultState(getDefaultState().with(POWERED, false));
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||
|
super.appendProperties(builder);
|
||
|
builder.add(POWERED);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected Function<BlockEntityType<BlockEntity>, BlockEntity> getFactory() {
|
||
|
return EnergonLightBlockEntity::new;
|
||
|
}
|
||
|
}
|