Interface WorldStorages

All Known Implementing Classes:
WorldStoragesImpl

@Beta public interface WorldStorages
Contains methods for interacting with ImmersiveMC's WorldStorage system. See WorldStorage for more info.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable WorldStorage
    get(net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerLevel level)
    Gets the WorldStorage already present at the given location.
    getOrCreate(net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerLevel level)
    Gets the WorldStorage at the given location, or creates a new one if not found or the one found isn't of the expected type for the block.
    @Nullable WorldStorage
    getWithoutVerification(net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerLevel level)
    Gets the WorldStorage already present at the given location even if it doesn't match the present block.
     
    void
    markDirty(net.minecraft.server.level.ServerLevel level)
    Marks the WorldStorage for the given level as dirty, meaning on next world save, the WorldStorage instances will be saved.
    remove(net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerLevel level)
    Remove the WorldStorage at the given location.
  • Method Details

    • instance

      static WorldStorages instance()
      Returns:
      A WorldStorages instance to access API functions. All details of this object not mentioned in this file are assumed to be an implementation detail, and may change at any time.
    • getOrCreate

      WorldStorage getOrCreate(net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerLevel level)
      Gets the WorldStorage at the given location, or creates a new one if not found or the one found isn't of the expected type for the block.
      Parameters:
      pos - Position of block with a WorldStorage and/or associated with a handler.
      level - Level the block is in.
      Returns:
      A WorldStorage instance for the given block position, or null if the block isn't associated with any WorldStorageHandler instances.
    • get

      @Nullable @Nullable WorldStorage get(net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerLevel level)
      Gets the WorldStorage already present at the given location.
      Parameters:
      pos - Position of block with a WorldStorage and/or associated with a handler.
      level - Level the block is in.
      Returns:
      A WorldStorage instance for the given block position, or null if the block isn't associated with any WorldStorageHandler instances or if there isn't a WorldStorage already there.
    • getWithoutVerification

      @Nullable @Nullable WorldStorage getWithoutVerification(net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerLevel level)
      Gets the WorldStorage already present at the given location even if it doesn't match the present block.
      Parameters:
      pos - Position of block with a WorldStorage and/or associated with a handler.
      level - Level the block is in.
      Returns:
      A WorldStorage instance for the given block position, or null if the block isn't associated with any WorldStorageHandler instances or if there isn't a WorldStorage already there.
    • remove

      WorldStorage remove(net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerLevel level)
      Remove the WorldStorage at the given location.
      Parameters:
      pos - Position of block potentially with a WorldStorage.
      level - Level the block is in.
      Returns:
      The WorldStorage instance that was removed, or null if nothing was removed.
    • markDirty

      void markDirty(net.minecraft.server.level.ServerLevel level)
      Marks the WorldStorage for the given level as dirty, meaning on next world save, the WorldStorage instances will be saved.
      Parameters:
      level - Level that had a WorldStorage change.