Class SharedNetworkStoragesImpl

java.lang.Object
com.hammy275.immersivemc.server.api_impl.SharedNetworkStoragesImpl
All Implemented Interfaces:
SharedNetworkStorages

public class SharedNetworkStoragesImpl extends Object implements SharedNetworkStorages
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <S extends NetworkStorage>
    S
    get(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, ImmersiveHandler<S> handler)
    Gets the NetworkStorage saved at the specified position, or returns null if one isn't already there.
    <S extends NetworkStorage>
    List<S>
    getAll(Class<S> storageClass)
    Get all storages stored that match some class; useful for marking storages as no longer dirty for client syncing.
    <S extends NetworkStorage>
    S
    getOrCreate(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, ImmersiveHandler<S> handler)
    Gets the NetworkStorage saved at the specified position, or creates a new one if one isn't already there.
    <S extends NetworkStorage>
    void
    remove(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, ImmersiveHandler<S> handler)
    Removes the NetworkStorage saved at the specified position, or does nothing if one isn't there or doesn't match the storage type of the handler provided.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • SharedNetworkStoragesImpl

      public SharedNetworkStoragesImpl()
  • Method Details

    • getOrCreate

      public <S extends NetworkStorage> S getOrCreate(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, ImmersiveHandler<S> handler)
      Description copied from interface: SharedNetworkStorages
      Gets the NetworkStorage saved at the specified position, or creates a new one if one isn't already there.
      Specified by:
      getOrCreate in interface SharedNetworkStorages
      Type Parameters:
      S - The type of storage used by the ImmersiveHandler.
      Parameters:
      level - The level to get the storage from. This should be the level the Immersive is in.
      pos - The position to get the storage from. This should be the block position the Immersive is at.
      handler - The ImmersiveHandler for the Immersive.
      Returns:
      An instance of S, which is the NetworkStorage at that position. It may have been freshly created via ImmersiveHandler.getEmptyNetworkStorage(), so it may need initializing.
    • get

      @Nullable public <S extends NetworkStorage> S get(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, ImmersiveHandler<S> handler)
      Description copied from interface: SharedNetworkStorages
      Gets the NetworkStorage saved at the specified position, or returns null if one isn't already there.
      Specified by:
      get in interface SharedNetworkStorages
      Type Parameters:
      S - The type of storage used by the ImmersiveHandler.
      Parameters:
      level - The level to get the storage from. This should be the level the Immersive is in.
      pos - The position to get the storage from. This should be the block position the Immersive is at.
      handler - The ImmersiveHandler for the Immersive.
      Returns:
      An instance of S, which is the NetworkStorage at that position, or null if a NetworkStorage either wasn't there, or did not match the type of your handler.
    • remove

      public <S extends NetworkStorage> void remove(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, ImmersiveHandler<S> handler)
      Description copied from interface: SharedNetworkStorages
      Removes the NetworkStorage saved at the specified position, or does nothing if one isn't there or doesn't match the storage type of the handler provided.
      Specified by:
      remove in interface SharedNetworkStorages
      Type Parameters:
      S - The type of storage used by the ImmersiveHandler.
      Parameters:
      level - The level to remove the storage from. This should be the level the Immersive is in.
      pos - The position to remove the storage from. This should be the block position the Immersive is at.
      handler - The ImmersiveHandler for the Immersive.
    • getAll

      public <S extends NetworkStorage> List<S> getAll(Class<S> storageClass)
      Description copied from interface: SharedNetworkStorages
      Get all storages stored that match some class; useful for marking storages as no longer dirty for client syncing. Note that the returned list is not guaranteed to be mutable.
      Specified by:
      getAll in interface SharedNetworkStorages
      Type Parameters:
      S - The type of storage to get a list of.
      Parameters:
      storageClass - The class of storages to get.
      Returns:
      A list of all storages matching the provided class. The list is not guaranteed to be mutable.