From e83933077e933150e5cecb14b06e06a5811818e2 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 4 Aug 2023 15:07:11 +0700 Subject: [PATCH] Cleanup --- .../mc/otm/block/entity/MatteryBlockEntity.kt | 9 --------- .../mc/otm/block/entity/MatteryDeviceBlockEntity.kt | 1 + .../otm/block/entity/decorative/CargoCrateBlockEntity.kt | 3 ++- 3 files changed, 3 insertions(+), 10 deletions(-) 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 aa24a6d06..1fac08b2b 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 @@ -196,15 +196,6 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc } } - protected fun exposeItemsGlobally(value: IItemHandler) { - exposeGlobally(ForgeCapabilities.ITEM_HANDLER, value) - } - - @Suppress("SuspiciousCallableReferenceInLambda") - protected fun trackGlobally(capability: Capability): List> { - return SupplierList(_sides.values.map { it.track(capability)::get }) - } - interface SideListener : Supplier> { fun addListener(listener: Consumer>) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryDeviceBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryDeviceBlockEntity.kt index 81d945102..de41cc61a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryDeviceBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryDeviceBlockEntity.kt @@ -39,6 +39,7 @@ import ru.dbotthepony.mc.otm.once /** * Device block entity base, implementing [MenuProvider] and [IRedstoneControlled], and also tracks custom display name */ +@Suppress("LiftReturnOrAssignment") abstract class MatteryDeviceBlockEntity(blockEntityType: BlockEntityType<*>, blockPos: BlockPos, blockState: BlockState) : MatteryBlockEntity(blockEntityType, blockPos, blockState), MenuProvider, IRedstoneControlled { var customDisplayName: Component? = null diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/decorative/CargoCrateBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/decorative/CargoCrateBlockEntity.kt index 636a47b1c..f09d23fa8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/decorative/CargoCrateBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/decorative/CargoCrateBlockEntity.kt @@ -25,6 +25,7 @@ import net.minecraft.world.level.storage.loot.LootParams import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets import net.minecraft.world.level.storage.loot.parameters.LootContextParams import net.minecraft.world.phys.Vec3 +import net.minecraftforge.common.capabilities.ForgeCapabilities import ru.dbotthepony.mc.otm.block.decorative.CargoCrateBlock import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity import ru.dbotthepony.mc.otm.container.MatteryContainer @@ -85,7 +86,7 @@ class CargoCrateBlockEntity( } init { - exposeItemsGlobally(handler) + exposeGlobally(ForgeCapabilities.ITEM_HANDLER, handler) savetablesLevel.stateful(::container, INVENTORY_KEY) }