Get rid of savetable()
This commit is contained in:
parent
6737d52c10
commit
db6b5e7efc
@ -394,10 +394,6 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
|
||||
side.revive()
|
||||
}
|
||||
|
||||
protected inline fun <reified T : Tag, V : INBTSerializable<T?>> savetable(property: KProperty0<V>, name: String = property.name) {
|
||||
savetables.stateful(property, name, T::class.java)
|
||||
}
|
||||
|
||||
final override fun saveAdditional(nbt: CompoundTag) {
|
||||
super.saveAdditional(nbt)
|
||||
saveShared(nbt)
|
||||
|
@ -114,11 +114,11 @@ class MatterBottlerBlockEntity(blockPos: BlockPos, blockState: BlockState) :
|
||||
|
||||
savetables.bool(::isBottling)
|
||||
savetables.bool(::spitItemsWhenCantWork)
|
||||
savetable(::energy, ENERGY_KEY)
|
||||
savetable(::matter, MATTER_STORAGE_KEY)
|
||||
savetable(::bottling)
|
||||
savetable(::unbottling)
|
||||
savetable(::upgrades)
|
||||
savetables.stateful(::energy, ENERGY_KEY)
|
||||
savetables.stateful(::matter, MATTER_STORAGE_KEY)
|
||||
savetables.stateful(::bottling)
|
||||
savetables.stateful(::unbottling)
|
||||
savetables.stateful(::upgrades)
|
||||
}
|
||||
|
||||
var workProgress: Float = 0f
|
||||
|
@ -60,8 +60,8 @@ class DriveRackBlockEntity(blockPos: BlockPos, blockState: BlockState) : Mattery
|
||||
}.also(::addDroppableContainer)
|
||||
|
||||
init {
|
||||
savetable(::energy, ENERGY_KEY)
|
||||
savetable(::container, INVENTORY_KEY)
|
||||
savetables.stateful(::energy, ENERGY_KEY)
|
||||
savetables.stateful(::container, INVENTORY_KEY)
|
||||
exposeGlobally(MatteryCapability.STORAGE_NODE, cell)
|
||||
savetables.int(::insertPriority)
|
||||
savetables.int(::extractPriority)
|
||||
|
@ -90,8 +90,8 @@ class DriveViewerBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte
|
||||
}
|
||||
|
||||
init {
|
||||
savetable(::energy, ENERGY_KEY)
|
||||
savetable(::container, INVENTORY_KEY)
|
||||
savetables.stateful(::energy, ENERGY_KEY)
|
||||
savetables.stateful(::container, INVENTORY_KEY)
|
||||
}
|
||||
|
||||
override fun createMenu(containerID: Int, inventory: Inventory, ply: Player): AbstractContainerMenu {
|
||||
|
@ -178,7 +178,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte
|
||||
val energyConfig = ConfigurableEnergy(energy)
|
||||
|
||||
init {
|
||||
savetable(::energy, ENERGY_KEY)
|
||||
savetables.stateful(::energy, ENERGY_KEY)
|
||||
}
|
||||
|
||||
var poweredView: PoweredVirtualComponent<ItemStorageStack>? = null
|
||||
|
@ -96,7 +96,7 @@ class StorageBusBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matter
|
||||
}
|
||||
|
||||
init {
|
||||
savetable(::energy, ENERGY_KEY)
|
||||
savetables.stateful(::energy, ENERGY_KEY)
|
||||
savetables.int(::insertPriority)
|
||||
savetables.int(::extractPriority)
|
||||
exposeGlobally(MatteryCapability.STORAGE_NODE, cell) { it != RelativeSide.FRONT }
|
||||
@ -127,7 +127,7 @@ class StorageBusBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matter
|
||||
}
|
||||
|
||||
init {
|
||||
savetable(::filter, FILTER_KEY)
|
||||
savetables.stateful(::filter, FILTER_KEY)
|
||||
}
|
||||
|
||||
override fun setLevel(level: Level) {
|
||||
|
@ -83,7 +83,7 @@ abstract class AbstractStorageImportExport(
|
||||
}
|
||||
|
||||
init {
|
||||
savetable(::energy, ENERGY_KEY)
|
||||
savetables.stateful(::energy, ENERGY_KEY)
|
||||
exposeGlobally(MatteryCapability.STORAGE_NODE, cell) { it != RelativeSide.FRONT }
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ abstract class AbstractStorageImportExport(
|
||||
abstract val filter: ItemFilter
|
||||
|
||||
init {
|
||||
savetable(::filter, FILTER_KEY)
|
||||
savetables.stateful(::filter, FILTER_KEY)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -25,7 +25,7 @@ class StoragePowerSupplierBlockEntity(blockPos: BlockPos, blockState: BlockState
|
||||
override val energy = WorkerEnergyStorage(this::markDirtyFast, MachinesConfig.STORAGE_POWER_SUPPLIER)
|
||||
|
||||
init {
|
||||
savetable(::energy, ENERGY_KEY)
|
||||
savetables.stateful(::energy, ENERGY_KEY)
|
||||
|
||||
exposeEnergyGlobally(energy)
|
||||
exposeGlobally(MatteryCapability.STORAGE_NODE, cell)
|
||||
|
@ -46,10 +46,10 @@ class ChemicalGeneratorBlockEntity(pos: BlockPos, state: BlockState) : MatteryDe
|
||||
for (piece in energyConfig.pieces.values)
|
||||
piece.automatePush = true
|
||||
|
||||
savetable(::energy, ENERGY_KEY)
|
||||
savetable(::batteryContainer)
|
||||
savetable(::residueContainer)
|
||||
savetable(::fuelContainer)
|
||||
savetables.stateful(::energy, ENERGY_KEY)
|
||||
savetables.stateful(::batteryContainer)
|
||||
savetables.stateful(::residueContainer)
|
||||
savetables.stateful(::fuelContainer)
|
||||
|
||||
savetables.int(::workTicks)
|
||||
savetables.int(::workTicksTotal)
|
||||
|
@ -26,7 +26,7 @@ class CobblerBlockEntity(blockPos: BlockPos, blockState: BlockState)
|
||||
val itemConfig = ConfigurableItemHandler(output = container.handler(HandlerFilter.OnlyOut))
|
||||
|
||||
init {
|
||||
savetable(::container, INVENTORY_KEY)
|
||||
savetables.stateful(::container, INVENTORY_KEY)
|
||||
}
|
||||
|
||||
override fun onJobFinish(status: JobStatus<ItemJob>, id: Int) {
|
||||
|
@ -79,9 +79,9 @@ class PlatePressBlockEntity(
|
||||
)
|
||||
|
||||
init {
|
||||
savetable(::energy, ENERGY_KEY)
|
||||
savetable(::inputContainer)
|
||||
savetable(::outputContainer)
|
||||
savetables.stateful(::energy, ENERGY_KEY)
|
||||
savetables.stateful(::inputContainer)
|
||||
savetables.stateful(::outputContainer)
|
||||
savetables.double(::experience)
|
||||
savetables.stateful(::upgrades)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user