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<FluidStorage> maybeFluidStorage = FluidStorage.SIDED.find(world, pos, direction);
 if (maybeFluidStorage != null) {
     // use it
 }
 Storage<ItemStorage> maybeItemStorage = ItemStorage.SIDED.find(world, pos, direction);
 if (maybeItemStorage != null) {
     // use it
 }
 
  • Method Details

    • getFluidStorage

      @OverrideOnly @Nullable default @Nullable Storage<FluidVariant> getFluidStorage(@Nullable @Nullable 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 @Nullable default @Nullable Storage<ItemVariant> getItemStorage(@Nullable @Nullable 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.