initial work on combustion

This commit is contained in:
2026-04-12 20:39:46 +02:00
parent ae9a3fd2c7
commit 94e6c505bd
5 changed files with 48 additions and 3 deletions

View File

@@ -47,9 +47,14 @@ object BlockEntities {
::CapacitorEntity, mutableSetOf(Blocks.CAPACITOR_BLOCK.get()), BullshitFix()
)
}
val SOLARGEN_ENTITY: RegistrySupplier<BlockEntityType<CapacitorEntity>> = BLOCKENTITIES.register("solargen_entity") {
val SOLARGEN_ENTITY: RegistrySupplier<BlockEntityType<SolarGeneratorBlockEntity>> = BLOCKENTITIES.register("solargen_entity") {
BlockEntityType(
::CapacitorEntity, mutableSetOf(Blocks.SOLARGEN_BLOCK.get()), BullshitFix()
::SolarGeneratorBlockEntity, mutableSetOf(Blocks.SOLARGEN_BLOCK.get()), BullshitFix()
)
}
val COMBUSTGEN_ENTITY: RegistrySupplier<BlockEntityType<CombustionGeneratorBlockEntity>> = BLOCKENTITIES.register("combustgen_entity") {
BlockEntityType(
::CombustionGeneratorBlockEntity, mutableSetOf(Blocks.COMBUSTGEN_BLOCK.get()), BullshitFix()
)
}

View File

@@ -0,0 +1,20 @@
package org.neoflock.neocomputers.entity
import net.minecraft.core.BlockPos
import net.minecraft.world.level.block.entity.BlockEntity
import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState
import org.neoflock.neocomputers.block.NodeBlockEntity
class CombustionGeneratorBlockEntity(blockPos: BlockPos, blockState: BlockState) : BlockEntity(BlockEntities.COMBUSTGEN_ENTITY.get(), blockPos, blockState) {
val energyPerTick: Long = 50
fun giveSolarPower() {
if(level?.isDay == true) {
val below = level?.getBlockEntity(blockPos.below())
if(below is NodeBlockEntity) {
below.node.giveEnergy(energyPerTick)
}
}
}
}

View File

@@ -6,7 +6,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState
import org.neoflock.neocomputers.block.NodeBlockEntity
class SolarGeneratorBlockEntity(entityType: BlockEntityType<*>, blockPos: BlockPos, blockState: BlockState) : BlockEntity(entityType, blockPos, blockState) {
class SolarGeneratorBlockEntity(blockPos: BlockPos, blockState: BlockState) : BlockEntity(BlockEntities.SOLARGEN_ENTITY.get(), blockPos, blockState) {
val energyPerTick: Long = 50
fun giveSolarPower() {