YuRaNnNzZZ — Сегодня, в 17:34

это-то легко

<----- clueless
This commit is contained in:
YuRaNnNzZZ 2023-07-01 18:18:15 +03:00
parent dc70b99868
commit 6690ca03c4
Signed by: YuRaNnNzZZ
GPG Key ID: 5F71738C85A6006D
2 changed files with 24 additions and 2 deletions

View File

@ -53,4 +53,23 @@ class FluidTankBlock : RotatableMatteryBlock(), EntityBlock {
): VoxelShape { ): VoxelShape {
return shapes[state]!! return shapes[state]!!
} }
override fun getLightEmission(state: BlockState?, level: BlockGetter?, pos: BlockPos?): Int {
if (pos == BlockPos.ZERO) return 15
val lightLevel = super.getLightEmission(state, level, pos)
val tile = level?.getExistingBlockEntity(pos) ?: lightLevel
if (tile is FluidTankBlockEntity) {
val fluid = tile.synchronizedFluid
if (!fluid.isEmpty) {
val newLevel = fluid.fluid.fluidType.getLightLevel(fluid)
return newLevel.coerceAtLeast(lightLevel)
}
}
return lightLevel
}
} }

View File

@ -29,8 +29,11 @@ import ru.dbotthepony.mc.otm.registry.MBlockEntities
class FluidTankBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryDeviceBlockEntity(MBlockEntities.FLUID_TANK, blockPos, blockState) { class FluidTankBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryDeviceBlockEntity(MBlockEntities.FLUID_TANK, blockPos, blockState) {
val fluid = BlockMatteryFluidHandler(::onChanged, ItemsConfig::FLUID_TANK_CAPACITY) val fluid = BlockMatteryFluidHandler(::onChanged, ItemsConfig::FLUID_TANK_CAPACITY)
var synchronizedFluid by synchronizer.Field(FluidStack.EMPTY, FluidStackValueCodec) var synchronizedFluid by synchronizer.Field(FluidStack.EMPTY, FluidStackValueCodec, setter = { value, access, remote ->
private set access.write(value)
level?.lightEngine?.checkBlock(blockPos)
})
val fillInput = MatteryContainer(::setChangedLight, 1).also(::addDroppableContainer) val fillInput = MatteryContainer(::setChangedLight, 1).also(::addDroppableContainer)
val drainInput = MatteryContainer(::setChangedLight, 1).also(::addDroppableContainer) val drainInput = MatteryContainer(::setChangedLight, 1).also(::addDroppableContainer)