YuRaNnNzZZ — Сегодня, в 17:34
это-то легко <----- clueless
This commit is contained in:
parent
dc70b99868
commit
6690ca03c4
@ -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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user