2020-07-13 20:37:21 +00:00
|
|
|
package com.thebrokenrail.energonrelics.block;
|
|
|
|
|
|
|
|
import com.thebrokenrail.energonrelics.block.entity.EnergonLightBlockEntity;
|
2020-08-04 17:06:11 +00:00
|
|
|
import com.thebrokenrail.energonrelics.api.block.energy.EnergyBlock;
|
2020-07-13 20:37:21 +00:00
|
|
|
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;
|
|
|
|
|
2020-07-26 23:05:59 +00:00
|
|
|
public class EnergonLightBlock extends EnergyBlock {
|
2020-07-13 20:37:21 +00:00
|
|
|
public static final BooleanProperty POWERED = Properties.POWERED;
|
|
|
|
|
|
|
|
public EnergonLightBlock() {
|
2020-07-22 20:17:01 +00:00
|
|
|
super(FabricBlockSettings.of(Material.REDSTONE_LAMP).sounds(BlockSoundGroup.GLASS).nonOpaque().lightLevel(state -> state.get(POWERED) ? 15 : 0).strength(0.3f));
|
2020-07-13 20:37:21 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|