Class SharedNetworkStoragesImpl
java.lang.Object
com.hammy275.immersivemc.server.api_impl.SharedNetworkStoragesImpl
- All Implemented Interfaces:
SharedNetworkStorages
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<S extends NetworkStorage>
Sget
(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>Get all storages stored that match some class; useful for marking storages as no longer dirty for client syncing.<S extends NetworkStorage>
SgetOrCreate
(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>
voidremove
(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.
-
Field Details
-
INSTANCE
-
-
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 interfaceSharedNetworkStorages
- 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
- TheImmersiveHandler
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 interfaceSharedNetworkStorages
- 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
- TheImmersiveHandler
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 interfaceSharedNetworkStorages
- 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
- TheImmersiveHandler
for the Immersive.
-
getAll
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 interfaceSharedNetworkStorages
- 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.
-