Package net.nullved.pmweatherapi.data
Class PMWStorages
java.lang.Object
net.nullved.pmweatherapi.data.PMWStorages
A class holding maps of dimensions to different storages
- Since:
- 0.14.15.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Map<net.minecraft.resources.ResourceLocation, StorageInstance<?, ?>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StorageInstance<?, ?> get(net.minecraft.resources.ResourceLocation location) Get aStorageInstancefor a givenResourceLocationIDstatic <D extends StorageData,T extends IServerStorage<D>>
Optional<StorageInstance<D, T>> Casts theStorageInstanceto the specifiedIServerStorageclass after retrievalstatic Collection<? extends StorageInstance<?, ?>> getAll()Gets allStorageInstancesstatic Collection<? extends IServerStorage<?>> getForDimension(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension) Gets allIServerStorages for a given dimensionstatic voidloadDimension(net.minecraft.server.level.ServerLevel serverLevel) Loads a newServerLevelfor allStorageInstancesmetars()Gets the map ofMetarServerStoragesradars()Gets the map ofRadarServerStoragesstatic <D extends StorageData,S extends IServerStorage<D>>
voidregisterStorage(net.minecraft.resources.ResourceLocation id, Class<S> clazz, Function<net.minecraft.server.level.ServerLevel, S> creator) Register a newIServerStoragestatic voidremoveDimension(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension) Removes a dimension from allStorageInstancesstatic voidresetAll()Resets all data for allStorageInstancesstatic voidset(net.minecraft.resources.ResourceLocation location, StorageInstance<?, ?> instance) Overwrite aStorageInstancewsrs()Gets the map ofWSRServerStorages
-
Field Details
-
STORAGE_INSTANCES
public static final Map<net.minecraft.resources.ResourceLocation,StorageInstance<?, STORAGE_INSTANCES?>>
-
-
Constructor Details
-
PMWStorages
public PMWStorages()
-
-
Method Details
-
radars
Gets the map ofRadarServerStorages- Returns:
- The associated dimension's
RadarServerStorage - Since:
- 0.14.15.3
-
metars
Gets the map ofMetarServerStorages- Returns:
- The associated dimension's
MetarServerStorage - Since:
- 0.15.3.3
-
wsrs
Gets the map ofWSRServerStorages- Returns:
- The associated dimension's
WSRServerStorage - Since:
- 0.15.3.3
-
get
Get aStorageInstancefor a givenResourceLocationID- Parameters:
location- The ID of the storage- Returns:
- A
StorageInstance - Since:
- 0.15.3.3
-
set
public static void set(net.minecraft.resources.ResourceLocation location, StorageInstance<?, ?> instance) Overwrite aStorageInstance- Parameters:
location- The IDResourceLocationinstance- The newStorageInstance- Since:
- 0.15.3.3
-
get
public static <D extends StorageData,T extends IServerStorage<D>> Optional<StorageInstance<D,T>> get(net.minecraft.resources.ResourceLocation location, Class<T> clazz) Casts theStorageInstanceto the specifiedIServerStorageclass after retrieval- Type Parameters:
D- TheIStorageDataof theIServerStorageT- TheIServerStorage- Parameters:
location- The IDResourceLocationclazz- TheClassof anIServerStorageto cast to- Returns:
- The casted
StorageInstance - Since:
- 0.15.3.3
-
resetAll
public static void resetAll()Resets all data for allStorageInstances- Since:
- 0.15.3.3
-
getAll
Gets allStorageInstances- Returns:
- A
Collectionof allStorageInstances - Since:
- 0.15.3.3
-
getForDimension
public static Collection<? extends IServerStorage<?>> getForDimension(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension) Gets allIServerStorages for a given dimension- Parameters:
dimension- TheResourceKeyof the dimension to get- Returns:
- A
CollectionofIServerStoragefor the given dimension - Since:
- 0.15.3.3
-
loadDimension
public static void loadDimension(net.minecraft.server.level.ServerLevel serverLevel) Loads a newServerLevelfor allStorageInstances- Parameters:
serverLevel- The newServerLevelto load- Since:
- 0.15.3.3
-
removeDimension
public static void removeDimension(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension) Removes a dimension from allStorageInstances- Parameters:
dimension- TheResourceKeyof the dimension to remove- Since:
- 0.15.3.3
-
registerStorage
public static <D extends StorageData,S extends IServerStorage<D>> void registerStorage(net.minecraft.resources.ResourceLocation id, Class<S> clazz, Function<net.minecraft.server.level.ServerLevel, S> creator) Register a newIServerStorage- Type Parameters:
D- TheIStorageDataof theIServerStorageS- TheIServerStorage- Parameters:
id- TheResourceLocationto save thisIServerStorageasclazz- TheClassof theIServerStoragecreator- A function creating anotherIServerStoragefor the givenServerLevel- Since:
- 0.15.3.3
-