Cleanup
This commit is contained in:
parent
6ab65c6c17
commit
e83933077e
@ -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 <T> trackGlobally(capability: Capability<T>): List<LazyOptional<T>> {
|
|
||||||
return SupplierList(_sides.values.map { it.track(capability)::get })
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SideListener<T> : Supplier<LazyOptional<T>> {
|
interface SideListener<T> : Supplier<LazyOptional<T>> {
|
||||||
fun addListener(listener: Consumer<LazyOptional<T>>)
|
fun addListener(listener: Consumer<LazyOptional<T>>)
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ import ru.dbotthepony.mc.otm.once
|
|||||||
/**
|
/**
|
||||||
* Device block entity base, implementing [MenuProvider] and [IRedstoneControlled], and also tracks custom display name
|
* 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)
|
abstract class MatteryDeviceBlockEntity(blockEntityType: BlockEntityType<*>, blockPos: BlockPos, blockState: BlockState)
|
||||||
: MatteryBlockEntity(blockEntityType, blockPos, blockState), MenuProvider, IRedstoneControlled {
|
: MatteryBlockEntity(blockEntityType, blockPos, blockState), MenuProvider, IRedstoneControlled {
|
||||||
var customDisplayName: Component? = null
|
var customDisplayName: Component? = null
|
||||||
|
@ -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.LootContextParamSets
|
||||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams
|
import net.minecraft.world.level.storage.loot.parameters.LootContextParams
|
||||||
import net.minecraft.world.phys.Vec3
|
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.decorative.CargoCrateBlock
|
||||||
import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
||||||
@ -85,7 +86,7 @@ class CargoCrateBlockEntity(
|
|||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
exposeItemsGlobally(handler)
|
exposeGlobally(ForgeCapabilities.ITEM_HANDLER, handler)
|
||||||
savetablesLevel.stateful(::container, INVENTORY_KEY)
|
savetablesLevel.stateful(::container, INVENTORY_KEY)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user