diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DataGen.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DataGen.kt index 3fa4a06d3..0d74294a1 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DataGen.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DataGen.kt @@ -258,7 +258,7 @@ object DataGen { TileNbtCopy("work_ticks"), TileNbtCopy("current_job"), TileNbtCopy("battery_container"), - TileNbtCopy("energy_cap"), + TileNbtCopy("energy"), ) with(lootTableProvider) { @@ -272,21 +272,21 @@ object DataGen { simpleBlock(Blocks.GRAVITATION_STABILIZER) tile(Blocks.ENERGY_COUNTER, TileNbtCopy("passed"), TileNbtCopy("history"), TileNbtCopy("history_tick")) - tile(Blocks.CHEMICAL_GENERATOR, TileNbtCopy("energy"), TileNbtCopy("slots"), TileNbtCopy("working_ticks"), TileNbtCopy("working_ticks_total")) + tile(Blocks.CHEMICAL_GENERATOR, TileNbtCopy("energy"), TileNbtCopy("container"), TileNbtCopy("working_ticks"), TileNbtCopy("working_ticks_total")) - tile(Blocks.ANDROID_STATION, TileNbtCopy("energy_cap"), TileNbtCopy("battery_container")) - tile(Blocks.BATTERY_BANK, TileNbtCopy("battery_bank")) - tile(Blocks.DRIVE_VIEWER, TileNbtCopy("energy_cap"), TileNbtCopy("drive_slot"), TileNbtCopy("battery_container")) + tile(Blocks.ANDROID_STATION, TileNbtCopy("energy"), TileNbtCopy("battery_container")) + tile(Blocks.BATTERY_BANK, TileNbtCopy("container")) + tile(Blocks.DRIVE_VIEWER, TileNbtCopy("energy"), TileNbtCopy("container"), TileNbtCopy("battery_container")) - tile(Blocks.MATTER_DECOMPOSER, TileNbtCopy("work_slots"), TileNbtCopy("matter_capability"), *workerTags) - tile(Blocks.MATTER_REPLICATOR, TileNbtCopy("regular_slots"), TileNbtCopy("reserved_slots"), TileNbtCopy("matter_capability"), *workerTags) - tile(Blocks.MATTER_SCANNER, TileNbtCopy("work_slots"), *workerTags) + tile(Blocks.MATTER_DECOMPOSER, TileNbtCopy("container"), TileNbtCopy("matter"), *workerTags) + tile(Blocks.MATTER_REPLICATOR, TileNbtCopy("container"), TileNbtCopy("matter"), *workerTags) + tile(Blocks.MATTER_SCANNER, TileNbtCopy("container"), *workerTags) tile(Blocks.PLATE_PRESS, TileNbtCopy("container"), *workerTags) tile(Blocks.MATTER_PANEL, TileNbtCopy("tasks")) tile(Blocks.PATTERN_STORAGE, TileNbtCopy("patterns")) - tile(Blocks.MATTER_CAPACITOR_BANK, TileNbtCopy("matter_container")) - tile(Blocks.MATTER_BOTTLER, TileNbtCopy("energy_cap"), TileNbtCopy("battery_container"), TileNbtCopy("work_slots"), TileNbtCopy("work_flow"), TileNbtCopy("matter_capability")) + tile(Blocks.MATTER_CAPACITOR_BANK, TileNbtCopy("container")) + tile(Blocks.MATTER_BOTTLER, TileNbtCopy("energy"), TileNbtCopy("battery_container"), TileNbtCopy("work_slots"), TileNbtCopy("work_flow"), TileNbtCopy("matter")) } with(recipeProvider) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityBatteryBank.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityBatteryBank.kt index 85ec5671f..3e1e8b2f5 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityBatteryBank.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityBatteryBank.kt @@ -28,7 +28,6 @@ import ru.dbotthepony.mc.otm.capability.extractEnergy import ru.dbotthepony.mc.otm.capability.receiveEnergy import ru.dbotthepony.mc.otm.container.MatteryContainer import ru.dbotthepony.mc.otm.core.Fraction -import ru.dbotthepony.mc.otm.ifHas import ru.dbotthepony.mc.otm.menu.BatteryBankMenu import ru.dbotthepony.mc.otm.set import ru.dbotthepony.mc.otm.unaryMinus @@ -240,14 +239,11 @@ class BlockEntityBatteryBank(p_155229_: BlockPos, p_155230_: BlockState) : Block override fun saveAdditional(nbt: CompoundTag) { super.saveAdditional(nbt) - nbt["battery_bank"] = container.serializeNBT() + nbt["container"] = container.serializeNBT() } override fun load(nbt: CompoundTag) { - nbt.ifHas("battery_bank") { - container.deserializeNBT(it) - } - + container.deserializeNBT(nbt["container"]) super.load(nbt) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityChemicalGenerator.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityChemicalGenerator.kt index 63a97cd21..7a06d6dcc 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityChemicalGenerator.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityChemicalGenerator.kt @@ -20,19 +20,17 @@ import net.minecraftforge.common.util.LazyOptional import net.minecraftforge.energy.CapabilityEnergy import net.minecraftforge.energy.IEnergyStorage import net.minecraftforge.items.CapabilityItemHandler -import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.Registry -import ru.dbotthepony.mc.otm.capability.IMatteryEnergyStorage -import ru.dbotthepony.mc.otm.capability.MatteryCapability -import ru.dbotthepony.mc.otm.container.MatteryContainer -import ru.dbotthepony.mc.otm.core.Fraction -import ru.dbotthepony.mc.otm.menu.MenuCHemicalGenerator import ru.dbotthepony.mc.otm.* import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState +import ru.dbotthepony.mc.otm.capability.IMatteryEnergyStorage +import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryMachineEnergyStorage import ru.dbotthepony.mc.otm.capability.receiveEnergy +import ru.dbotthepony.mc.otm.container.MatteryContainer +import ru.dbotthepony.mc.otm.core.Fraction import ru.dbotthepony.mc.otm.core.plus +import ru.dbotthepony.mc.otm.menu.MenuCHemicalGenerator import java.lang.ref.WeakReference class BlockEntityChemicalGenerator(pos: BlockPos, state: BlockState) : BlockEntityMattery(Registry.BlockEntities.CHEMICAL_GENERATOR, pos, state) { @@ -91,7 +89,7 @@ class BlockEntityChemicalGenerator(pos: BlockPos, state: BlockState) : BlockEnti super.saveAdditional(nbt) nbt["energy"] = energy.serializeNBT() - nbt["slots"] = container.serializeNBT() + nbt["container"] = container.serializeNBT() nbt["working_ticks"] = workingTicks nbt["working_ticks_total"] = workingTicksTotal } @@ -99,13 +97,8 @@ class BlockEntityChemicalGenerator(pos: BlockPos, state: BlockState) : BlockEnti override fun load(nbt: CompoundTag) { super.load(nbt) - nbt.ifHas("energy", CompoundTag::class.java) { - energy.deserializeNBT(it) - } - - nbt.ifHas("slots") { - container.deserializeNBT(it) - } + nbt.ifHas("energy", CompoundTag::class.java, energy::deserializeNBT) + container.deserializeNBT(nbt["container"]) nbt.ifHas("working_ticks") { if (it is IntTag) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityDriveViewer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityDriveViewer.kt index f5dff60fc..afbbda55e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityDriveViewer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityDriveViewer.kt @@ -19,7 +19,6 @@ import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryMachineEnergyStorage import ru.dbotthepony.mc.otm.container.MatteryContainer import ru.dbotthepony.mc.otm.core.Fraction -import ru.dbotthepony.mc.otm.ifHas import ru.dbotthepony.mc.otm.menu.MenuDriveViewer import ru.dbotthepony.mc.otm.set import javax.annotation.ParametersAreNonnullByDefault @@ -38,7 +37,7 @@ class BlockEntityDriveViewer(p_155229_: BlockPos, p_155230_: BlockState) : Block var state = blockState - if (drive_slot.getItem(0).getCapability(MatteryCapability.DRIVE).isPresent && energy.batteryLevel >= OverdriveThatMatters.ITEM_STORAGE.energyPerOperation()) { + if (container.getItem(0).getCapability(MatteryCapability.DRIVE).isPresent && energy.batteryLevel >= OverdriveThatMatters.ITEM_STORAGE.energyPerOperation()) { state = state.setValue(WorkerState.SEMI_WORKER_STATE, WorkerState.WORKING) } else { state = state.setValue(WorkerState.SEMI_WORKER_STATE, WorkerState.IDLE) @@ -52,7 +51,7 @@ class BlockEntityDriveViewer(p_155229_: BlockPos, p_155230_: BlockState) : Block } @JvmField - val drive_slot: MatteryContainer = object : MatteryContainer(this::setChanged, 1) { + val container: MatteryContainer = object : MatteryContainer(this::setChanged, 1) { override fun setChanged(slot: Int, new: ItemStack, old: ItemStack) { super.setChanged(slot, new, old) @@ -91,15 +90,13 @@ class BlockEntityDriveViewer(p_155229_: BlockPos, p_155230_: BlockState) : Block override fun saveAdditional(nbt: CompoundTag) { super.saveAdditional(nbt) - nbt["drive_slot"] = drive_slot.serializeNBT() + nbt["container"] = container.serializeNBT() } override fun load(nbt: CompoundTag) { super.load(nbt) - nbt.ifHas("drive_slot") { - drive_slot.deserializeNBT(it) - } + container.deserializeNBT(nbt["container"]) } fun tick() { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterBottler.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterBottler.kt index b77906251..434262dfa 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterBottler.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterBottler.kt @@ -172,17 +172,14 @@ class BlockEntityMatterBottler(p_155229_: BlockPos, p_155230_: BlockState) : super.saveAdditional(nbt) nbt["work_slots"] = container.serializeNBT() nbt["work_flow"] = this.workFlow - nbt["matter_capability"] = matter.serializeNBT() + nbt["matter"] = matter.serializeNBT() } override fun load(nbt: CompoundTag) { super.load(nbt) container.deserializeNBT(nbt["work_slots"]) workFlow = nbt.getBoolean("work_flow") - - nbt.ifHas("matter_capability", CompoundTag::class.java) { - matter.deserializeNBT(it) - } + nbt.ifHas("matter", CompoundTag::class.java, matter::deserializeNBT) } init { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterCapacitorBank.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterCapacitorBank.kt index 26110ca54..138447777 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterCapacitorBank.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterCapacitorBank.kt @@ -45,7 +45,7 @@ class BlockEntityMatterCapacitorBank(p_155229_: BlockPos, p_155230_: BlockState) override fun getStoredMatter(): Fraction { var summ = Fraction.ZERO - for (stack in matterContainer) + for (stack in container) if (!stack.isEmpty) stack.getCapability(MatteryCapability.MATTER).ifPresent { summ += it.storedMatter @@ -57,7 +57,7 @@ class BlockEntityMatterCapacitorBank(p_155229_: BlockPos, p_155230_: BlockState) override fun getMaxStoredMatter(): Fraction { var summ = Fraction.ZERO - for (stack in matterContainer) + for (stack in container) if (!stack.isEmpty) stack.getCapability(MatteryCapability.MATTER).ifPresent { summ += it.maxStoredMatter @@ -74,7 +74,7 @@ class BlockEntityMatterCapacitorBank(p_155229_: BlockPos, p_155230_: BlockState) var howMuch = howMuch var summ = Fraction.ZERO - for (stack in matterContainer) { + for (stack in container) { if (!stack.isEmpty) { stack.getCapability(MatteryCapability.MATTER).ifPresent { val diff = it.receiveMatterOuter(howMuch, simulate) @@ -99,7 +99,7 @@ class BlockEntityMatterCapacitorBank(p_155229_: BlockPos, p_155230_: BlockState) var howMuch = howMuch var summ = Fraction.ZERO - for (stack in matterContainer) { + for (stack in container) { if (!stack.isEmpty) { stack.getCapability(MatteryCapability.MATTER).ifPresent { val diff = it.extractMatterOuter(howMuch, simulate) @@ -122,7 +122,7 @@ class BlockEntityMatterCapacitorBank(p_155229_: BlockPos, p_155230_: BlockState) private var resolver = LazyOptional.of { this } @JvmField - val matterContainer = object : MatteryContainer(this::setChangedLight, 6 * 2) { + val container = object : MatteryContainer(this::setChangedLight, 6 * 2) { override fun setChanged(slot: Int, new: ItemStack, old: ItemStack) { super.setChanged(slot, new, old) val level = level @@ -154,11 +154,11 @@ class BlockEntityMatterCapacitorBank(p_155229_: BlockPos, p_155230_: BlockState) override fun saveAdditional(nbt: CompoundTag) { super.saveAdditional(nbt) - nbt["matter_container"] = matterContainer.serializeNBT() + nbt["container"] = container.serializeNBT() } override fun load(nbt: CompoundTag) { - matterContainer.deserializeNBT(nbt["matter_container"]) + container.deserializeNBT(nbt["container"]) super.load(nbt) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterDecomposer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterDecomposer.kt index 4fafd7bbb..6f76ed7f7 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterDecomposer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterDecomposer.kt @@ -85,21 +85,18 @@ class BlockEntityMatterDecomposer(pos: BlockPos, state: BlockState) override fun saveAdditional(nbt: CompoundTag) { super.saveAdditional(nbt) - nbt["work_slots"] = itemContainer.serializeNBT() - nbt["matter_capability"] = matter.serializeNBT() + nbt["container"] = itemContainer.serializeNBT() + nbt["matter"] = matter.serializeNBT() } override fun load(nbt: CompoundTag) { super.load(nbt) - nbt.ifHas("matter_capability") { - if (it is CompoundTag) - matter.deserializeNBT(it) + nbt.ifHas("matter", CompoundTag::class.java) { + matter.deserializeNBT(it) } - nbt.ifHas("work_slots") { - itemContainer.deserializeNBT(it) - } + itemContainer.deserializeNBT(nbt["container"]) } override fun reviveCaps() { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterReplicator.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterReplicator.kt index 1c6f97eef..ccb01cefe 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterReplicator.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterReplicator.kt @@ -1,42 +1,42 @@ package ru.dbotthepony.mc.otm.block.entity import net.minecraft.MethodsReturnNonnullByDefault -import javax.annotation.ParametersAreNonnullByDefault import net.minecraft.core.BlockPos import net.minecraft.core.Direction -import net.minecraft.world.level.block.state.BlockState -import ru.dbotthepony.mc.otm.block.entity.worker.BlockEntityMatteryWorker -import ru.dbotthepony.mc.otm.capability.matter.MatterHandlerCapability -import ru.dbotthepony.mc.otm.capability.matter.IMatterHandler -import ru.dbotthepony.mc.otm.container.MatteryContainer -import net.minecraft.world.item.ItemStack +import net.minecraft.nbt.CompoundTag +import net.minecraft.network.chat.Component +import net.minecraft.network.chat.TranslatableComponent +import net.minecraft.server.level.ServerLevel import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Player import net.minecraft.world.inventory.AbstractContainerMenu -import ru.dbotthepony.mc.otm.menu.MatterReplicatorMenu +import net.minecraft.world.item.ItemStack +import net.minecraft.world.level.Level +import net.minecraft.world.level.block.state.BlockState +import net.minecraftforge.common.capabilities.Capability +import net.minecraftforge.common.util.LazyOptional +import net.minecraftforge.items.CapabilityItemHandler +import ru.dbotthepony.mc.otm.Registry +import ru.dbotthepony.mc.otm.block.entity.worker.BlockEntityMatteryWorker import ru.dbotthepony.mc.otm.block.entity.worker.MachineJob import ru.dbotthepony.mc.otm.block.entity.worker.MachineJobStatus +import ru.dbotthepony.mc.otm.block.entity.worker.WorkTickContext +import ru.dbotthepony.mc.otm.capability.MatteryCapability +import ru.dbotthepony.mc.otm.capability.MatteryMachineEnergyStorage +import ru.dbotthepony.mc.otm.capability.matter.IMatterHandler +import ru.dbotthepony.mc.otm.capability.matter.MatterHandlerCapability import ru.dbotthepony.mc.otm.capability.matter.MatterTask import ru.dbotthepony.mc.otm.capability.matter.PatternState -import ru.dbotthepony.mc.otm.matter.MatterRegistry -import ru.dbotthepony.mc.otm.block.entity.worker.WorkTickContext -import net.minecraft.nbt.CompoundTag -import net.minecraft.network.chat.Component -import net.minecraftforge.common.util.LazyOptional -import ru.dbotthepony.mc.otm.capability.MatteryCapability -import net.minecraftforge.items.CapabilityItemHandler -import ru.dbotthepony.mc.otm.capability.MatteryMachineEnergyStorage -import net.minecraft.network.chat.TranslatableComponent -import net.minecraft.server.level.ServerLevel -import net.minecraft.world.level.Level -import net.minecraftforge.common.capabilities.Capability -import ru.dbotthepony.mc.otm.Registry +import ru.dbotthepony.mc.otm.container.MatteryContainer import ru.dbotthepony.mc.otm.core.Fraction import ru.dbotthepony.mc.otm.graph.Graph6Node import ru.dbotthepony.mc.otm.graph.matter.IMatterGraphNode import ru.dbotthepony.mc.otm.graph.matter.MatterNetworkGraph import ru.dbotthepony.mc.otm.ifHas +import ru.dbotthepony.mc.otm.matter.MatterRegistry +import ru.dbotthepony.mc.otm.menu.MatterReplicatorMenu import ru.dbotthepony.mc.otm.set +import javax.annotation.ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault @@ -57,9 +57,6 @@ class BlockEntityMatterReplicator(p_155229_: BlockPos, p_155230_: BlockState) : @JvmField val regularSlots = MatteryContainer(this::setChangedLight, 3) - // запросы от matter replicator interface? - val reservedSlots = MatteryContainer(this::setChangedLight, 3) - private val itemHandler = regularSlots.handler { slot: Int, stack: ItemStack? -> false } override fun getDefaultDisplayName(): Component { @@ -172,17 +169,15 @@ class BlockEntityMatterReplicator(p_155229_: BlockPos, p_155230_: BlockState) : override fun saveAdditional(nbt: CompoundTag) { super.saveAdditional(nbt) - nbt["regular_slots"] = regularSlots.serializeNBT() - nbt["reserved_slots"] = reservedSlots.serializeNBT() - nbt["matter_capability"] = matter.serializeNBT() + nbt["container"] = regularSlots.serializeNBT() + nbt["matter"] = matter.serializeNBT() } override fun load(nbt: CompoundTag) { super.load(nbt) - regularSlots.deserializeNBT(nbt["regular_slots"]) - reservedSlots.deserializeNBT(nbt["reserved_slots"]) + regularSlots.deserializeNBT(nbt["container"]) - nbt.ifHas("matter_capability", CompoundTag::class.java) { + nbt.ifHas("matter", CompoundTag::class.java) { matter.deserializeNBT(it) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterScanner.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterScanner.kt index 63d18208a..ca4bda7e8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterScanner.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatterScanner.kt @@ -21,7 +21,8 @@ import ru.dbotthepony.mc.otm.block.entity.worker.MachineJob import ru.dbotthepony.mc.otm.block.entity.worker.MachineJobStatus import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryMachineEnergyStorage -import ru.dbotthepony.mc.otm.capability.matter.* +import ru.dbotthepony.mc.otm.capability.matter.PatternInsertStatus +import ru.dbotthepony.mc.otm.capability.matter.PatternState import ru.dbotthepony.mc.otm.container.MatteryContainer import ru.dbotthepony.mc.otm.core.Fraction import ru.dbotthepony.mc.otm.graph.Graph6Node @@ -103,11 +104,11 @@ class BlockEntityMatterScanner(p_155229_: BlockPos, p_155230_: BlockState) : override fun saveAdditional(nbt: CompoundTag) { super.saveAdditional(nbt) - nbt.put("work_slots", input_slot.serializeNBT()) + nbt.put("container", input_slot.serializeNBT()) } override fun load(nbt: CompoundTag) { - input_slot.deserializeNBT(nbt["work_slots"]) + input_slot.deserializeNBT(nbt["container"]) super.load(nbt) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatteryPowered.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatteryPowered.kt index eda866836..66a9be330 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatteryPowered.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityMatteryPowered.kt @@ -68,12 +68,12 @@ abstract class BlockEntityMatteryPowered(p_155228_: BlockEntityType<*>, p_155229 public override fun saveAdditional(nbt: CompoundTag) { super.saveAdditional(nbt) - nbt["energy_cap"] = energy.serializeNBT() + nbt["energy"] = energy.serializeNBT() nbt["battery_container"] = batteryContainer.serializeNBT() } override fun load(nbt: CompoundTag) { - nbt.ifHas("energy_cap", CompoundTag::class.java, energy::deserializeNBT) + nbt.ifHas("energy", CompoundTag::class.java, energy::deserializeNBT) nbt.ifHas("battery_container", CompoundTag::class.java, batteryContainer::deserializeNBT) super.load(nbt) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MenuDriveViewer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MenuDriveViewer.kt index c8c465127..c2207a77d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MenuDriveViewer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MenuDriveViewer.kt @@ -34,7 +34,7 @@ class MenuDriveViewer @JvmOverloads constructor( override fun getNetworkedItemView() = view init { - val container = if (tile != null) tile.drive_slot else SimpleContainer(1) + val container = if (tile != null) tile.container else SimpleContainer(1) driveSlot = object : MatterySlot(container, 0) { override fun mayPlace(stack: ItemStack): Boolean { @@ -63,7 +63,7 @@ class MenuDriveViewer @JvmOverloads constructor( super.broadcastChanges() if (tile != null) { - val itemStack = (tile as BlockEntityDriveViewer).drive_slot.getItem(0) + val itemStack = (tile as BlockEntityDriveViewer).container.getItem(0) val prev = lastDrive lastDrive = null diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MenuMatterCapacitor.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MenuMatterCapacitor.kt index 74504d1a5..45c96958d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MenuMatterCapacitor.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MenuMatterCapacitor.kt @@ -32,7 +32,7 @@ class MenuMatterCapacitor @JvmOverloads constructor( }) } - val container = tile?.matterContainer ?: SimpleContainer(2 * 6) + val container = tile?.container ?: SimpleContainer(2 * 6) for (row in 0..1) { for (column in 0..5) {