Use constant as capacity

This commit is contained in:
DBotThePony 2022-01-23 15:33:12 +07:00
parent 5dbd634215
commit 72aaea3120
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 4 additions and 3 deletions

View File

@ -24,7 +24,7 @@ class BlockEntityCargoCrate(
p_155229_: BlockPos, p_155229_: BlockPos,
p_155230_: BlockState p_155230_: BlockState
) : BlockEntityMattery(Registry.BlockEntities.CARGO_CRATE, p_155229_, p_155230_) { ) : BlockEntityMattery(Registry.BlockEntities.CARGO_CRATE, p_155229_, p_155230_) {
val container = MatteryContainer(this::setChanged, 9 * 6) val container = MatteryContainer(this::setChanged, CAPACITY)
private var interactingPlayers = 0 private var interactingPlayers = 0
val handler = container.handler() val handler = container.handler()
@ -77,5 +77,6 @@ class BlockEntityCargoCrate(
companion object { companion object {
private val NAME = TranslatableComponent("block.overdrive_that_matters.cargo_crate") private val NAME = TranslatableComponent("block.overdrive_that_matters.cargo_crate")
const val CAPACITY = 9 * 6
} }
} }

View File

@ -14,9 +14,9 @@ class CargoCrateMenu @JvmOverloads constructor(
val crateSlots: Array<MatterySlot> val crateSlots: Array<MatterySlot>
init { init {
val container = tile?.container ?: SimpleContainer(9 * 6) val container = tile?.container ?: SimpleContainer(BlockEntityCargoCrate.CAPACITY)
crateSlots = Array(9 * 6) { crateSlots = Array(BlockEntityCargoCrate.CAPACITY) {
val slot = MatterySlot(container, it) val slot = MatterySlot(container, it)
addSlot(slot) addSlot(slot)
return@Array slot return@Array slot