diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt index 9005db565..cd9d6707b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt @@ -394,10 +394,6 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc side.revive() } - protected inline fun > savetable(property: KProperty0, name: String = property.name) { - savetables.stateful(property, name, T::class.java) - } - final override fun saveAdditional(nbt: CompoundTag) { super.saveAdditional(nbt) saveShared(nbt) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterBottlerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterBottlerBlockEntity.kt index f01765e4a..a929d2892 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterBottlerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterBottlerBlockEntity.kt @@ -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 diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/DriveRackBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/DriveRackBlockEntity.kt index 90ce6f6d1..ca660924f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/DriveRackBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/DriveRackBlockEntity.kt @@ -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) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/DriveViewerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/DriveViewerBlockEntity.kt index 87da29344..d6dee99b5 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/DriveViewerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/DriveViewerBlockEntity.kt @@ -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 { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/ItemMonitorBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/ItemMonitorBlockEntity.kt index 2a63e5a86..970a12ba2 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/ItemMonitorBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/ItemMonitorBlockEntity.kt @@ -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? = null diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StorageBusBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StorageBusBlockEntity.kt index d15bcee90..b3a21ef86 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StorageBusBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StorageBusBlockEntity.kt @@ -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) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StorageInterfaces.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StorageInterfaces.kt index 39907eb94..e03e29597 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StorageInterfaces.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StorageInterfaces.kt @@ -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 { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StoragePowerSupplierBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StoragePowerSupplierBlockEntity.kt index a2a7214ef..b10d647ae 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StoragePowerSupplierBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StoragePowerSupplierBlockEntity.kt @@ -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) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/ChemicalGeneratorBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/ChemicalGeneratorBlockEntity.kt index 0ef5e8939..38597c699 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/ChemicalGeneratorBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/ChemicalGeneratorBlockEntity.kt @@ -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) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/CobblerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/CobblerBlockEntity.kt index 92fc99454..23adfcb8e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/CobblerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/CobblerBlockEntity.kt @@ -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, id: Int) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PlatePressBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PlatePressBlockEntity.kt index a570ee003..081471a0b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PlatePressBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/PlatePressBlockEntity.kt @@ -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) }