initial work on combustion
This commit is contained in:
@@ -28,6 +28,7 @@ object Blocks {
|
||||
val SCREEN_BLOCK: RegistrySupplier<Block> = BaseBlock.register("screen") { ScreenBlock() }
|
||||
val CAPACITOR_BLOCK: RegistrySupplier<Block> = BaseBlock.register("capacitor") { CapacitorBlock() }
|
||||
val SOLARGEN_BLOCK: RegistrySupplier<Block> = BaseBlock.register("solargen") { SolarGeneratorBlock() }
|
||||
val COMBUSTGEN_BLOCK: RegistrySupplier<Block> = BaseBlock.register("combustgen") { CombustionGeneratorBlock() }
|
||||
|
||||
fun registerBlockItems() {
|
||||
BLOCKS.forEach(Consumer { sup: RegistrySupplier<Block> ->
|
||||
|
||||
@@ -15,6 +15,25 @@ class SolarGeneratorBlock : BaseBlock(), EntityBlock {
|
||||
return SolarGeneratorBlockEntity(BlockEntities.SOLARGEN_ENTITY.get(), blockPos, blockState)
|
||||
}
|
||||
|
||||
override fun <T : BlockEntity> getTicker(
|
||||
level: Level,
|
||||
blockState: BlockState,
|
||||
blockEntityType: BlockEntityType<T>
|
||||
): BlockEntityTicker<T> {
|
||||
return object : BlockEntityTicker<T> {
|
||||
override fun tick(level: Level, blockPos: BlockPos, blockState: BlockState, blockEntity: T) {
|
||||
if(blockEntity !is SolarGeneratorBlockEntity) return;
|
||||
blockEntity.giveSolarPower();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CombustionGeneratorBlock : BaseBlock(), EntityBlock {
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return CombustionGeneratorBlockEntity(BlockEntities.COMBUSTGEN_ENTITY.get(), blockPos, blockState)
|
||||
}
|
||||
|
||||
override fun <T : BlockEntity> getTicker(
|
||||
level: Level,
|
||||
blockState: BlockState,
|
||||
|
||||
Reference in New Issue
Block a user