Interface SidedStorageBlockEntity


public interface SidedStorageBlockEntity
Optional helper class that can be implemented on block entities that wish to provide a sided fluid storage and/or a sided item storage without having to register a provider for each block entity type.

How it works is that fabric registers fallback providers for instances of this interface. This can be used for convenient Storage registration, but please always use the SIDED lookups for queries:

Storage<FluidVariant> maybeFluidStorage = FluidStorage.SIDED.find(level, pos, direction);
if (maybeFluidStorage != null) {
    // use it
}
Storage<ItemVariant> maybeItemStorage = ItemStorage.SIDED.find(level, pos, direction);
if (maybeItemStorage != null) {
    // use it
}
  • Method Summary

    Modifier and Type
    Method
    Description
    default @Nullable Storage<FluidVariant>
    getFluidStorage(@Nullable net.minecraft.core.Direction side)
    Return a fluid storage if available on the queried side, or null otherwise.
    default @Nullable Storage<ItemVariant>
    getItemStorage(@Nullable net.minecraft.core.Direction side)
    Return an item storage if available on the queried side, or null otherwise.
  • Method Details

    • getFluidStorage

      @OverrideOnly default @Nullable Storage<FluidVariant> getFluidStorage(@Nullable net.minecraft.core.Direction side)
      Return a fluid storage if available on the queried side, or null otherwise.
      Parameters:
      side - The side of the storage to query, null means that the full storage without the restriction should be returned instead.
    • getItemStorage

      @OverrideOnly default @Nullable Storage<ItemVariant> getItemStorage(@Nullable net.minecraft.core.Direction side)
      Return an item storage if available on the queried side, or null otherwise.
      Parameters:
      side - The side of the storage to query, null means that the full storage without the restriction should be returned instead.