solar power

This commit is contained in:
2026-04-12 20:04:31 +02:00
parent e38184d3a3
commit ae9a3fd2c7
6 changed files with 60 additions and 4 deletions

View File

@@ -47,6 +47,11 @@ object BlockEntities {
::CapacitorEntity, mutableSetOf(Blocks.CAPACITOR_BLOCK.get()), BullshitFix()
)
}
val SOLARGEN_ENTITY: RegistrySupplier<BlockEntityType<CapacitorEntity>> = BLOCKENTITIES.register("solargen_entity") {
BlockEntityType(
::CapacitorEntity, mutableSetOf(Blocks.SOLARGEN_BLOCK.get()), BullshitFix()
)
}
fun registerPowerBlocks() {
PowerManager.registerPowerBlockEntity(CAPACITOR_ENTITY.get())

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 SolarGeneratorBlockEntity(entityType: BlockEntityType<*>, blockPos: BlockPos, blockState: BlockState) : BlockEntity(entityType, 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)
}
}
}
}