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