Package de.z0rdak.yawp.api.core
Class RegionManager
java.lang.Object
de.z0rdak.yawp.api.core.RegionManager
- All Implemented Interfaces:
IRegionManager
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbooleancreateDimRegion(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Creates a new DimensionalRegionCache (and DimensionalRegion) for the specified dimension.static RegionManagerget()net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level>getDimApiKey(String dimKey) Create the corresponding ResourceKey for the provided resource key string (e.g.getDimensionalRegion(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) You can safely cast the returned instance of to DimensionalRegion, but it doesn't provide any benefit.getDimRegionApi(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Gets the DimensionalRegion API for the specified dimension key.getDimRegionApiByKey(String dimKey) Gets the DimensionalRegion API for the specified dimension key (E.g.getLevelRegionData(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Gets the LevelRegionData for the specified dimension.Set<net.minecraft.resources.ResourceLocation>Returns a set of resource keys for all created Dimensional RegionsbooleanhasLevelData(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Check whether a DimensionalRegion for the specified dimension already exists.voidThis only resets the Global Region, not its child regions.voidresetLevelData(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Resets the DimensionalRegion as well as all LocalRegions of the corresponding level.voidsave()Flag the scheduler to save the region data.
-
Method Details
-
get
-
getGlobalRegion
- Specified by:
getGlobalRegionin interfaceIRegionManager
-
resetGlobal
public void resetGlobal()Description copied from interface:IRegionManagerThis only resets the Global Region, not its child regions.- Specified by:
resetGlobalin interfaceIRegionManager
-
getDimensionalRegion
public Optional<IProtectedRegion> getDimensionalRegion(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Description copied from interface:IRegionManagerYou can safely cast the returned instance of to DimensionalRegion, but it doesn't provide any benefit.- Specified by:
getDimensionalRegionin interfaceIRegionManager- Parameters:
dim- the resource key of the dimension/level * @return the LevelRegionData corresponding to dim
-
getLevelRegionData
public Optional<LevelRegionData> getLevelRegionData(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Description copied from interface:IRegionManagerGets the LevelRegionData for the specified dimension. A LevelRegionData manages the DimensionalRegion and all Local Regions of the corresponding dimensions.- Specified by:
getLevelRegionDatain interfaceIRegionManager- Parameters:
dim- the resource key of the dimension/level- Returns:
- the LevelRegionData corresponding to dim
-
save
public void save()Description copied from interface:IRegionManagerFlag the scheduler to save the region data. This usually happens either - cyclic (when enabled) - when leaving the world (in single player) - shutting down the server gracefully - or executing the '/save-all' command.- Specified by:
savein interfaceIRegionManager
-
getDimRegionApi
public Optional<IDimensionRegionApi> getDimRegionApi(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Gets the DimensionalRegion API for the specified dimension key.- Specified by:
getDimRegionApiin interfaceIRegionManager- Parameters:
dim- the dimension key to get the API for- Returns:
- the DimensionalRegionApi for the specified dimension key if it exists, otherwise Optional.Empty
-
getDimRegionApiByKey
Gets the DimensionalRegion API for the specified dimension key (E.g. "minecraft:overworld").- Specified by:
getDimRegionApiByKeyin interfaceIRegionManager- Parameters:
dimKey- the dimension key to get the API for- Returns:
- the DimensionalRegionApi for the specified dimension key if it exists, otherwise Optional.Empty
-
getDimApiKey
public net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> getDimApiKey(String dimKey) Description copied from interface:IRegionManagerCreate the corresponding ResourceKey for the provided resource key string (e.g. 'minecraft:overworld') Basically a wrapper around `ResourceKey.create(Registries.DIMENSION, ResourceLocation.parse(dimKey));`- Specified by:
getDimApiKeyin interfaceIRegionManager- Parameters:
dimKey- resource key of the level/dimension- Returns:
- the corresponding ResourceKey for the level/dimension
-
hasLevelData
public boolean hasLevelData(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Description copied from interface:IRegionManagerCheck whether a DimensionalRegion for the specified dimension already exists.- Specified by:
hasLevelDatain interfaceIRegionManager- Parameters:
dim- the dimension key to check for- Returns:
- true if a DimensionalRegion exists, false otherwise
-
createDimRegion
public boolean createDimRegion(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Description copied from interface:IRegionManagerCreates a new DimensionalRegionCache (and DimensionalRegion) for the specified dimension.- Specified by:
createDimRegionin interfaceIRegionManager- Parameters:
dim- the dimension identifier of the dimension- Returns:
- true if a new DimensionalRegionCache was created, false if it already existed
-
getLevels
Description copied from interface:IRegionManagerReturns a set of resource keys for all created Dimensional Regions- Specified by:
getLevelsin interfaceIRegionManager- Returns:
- a set of resource keys corresponding to registered DimensionalRegions
-
getLevelNames
-
resetLevelData
public void resetLevelData(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Description copied from interface:IRegionManagerResets the DimensionalRegion as well as all LocalRegions of the corresponding level.- Specified by:
resetLevelDatain interfaceIRegionManager- Parameters:
dim- the resource key of the level/dimension you want to reset its corresponding data for.
-