Interface IRegionManager
- All Known Implementing Classes:
RegionManager
public interface IRegionManager
-
Method Summary
Modifier and TypeMethodDescriptionnet.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.Identifier> 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(IProtectedRegion region) voidsave(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> levelKey) voidsave(net.minecraft.server.level.ServerLevel level) voidsaveAll()Flag the scheduler to save the region data.trackLevel(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Creates a DimensionalRegion for the specified dimension keyvoiduntrackLevel(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim)
-
Method Details
-
getGlobalRegion
GlobalRegion getGlobalRegion() -
resetGlobal
void resetGlobal()This only resets the Global Region, not its child regions. -
getDimensionalRegion
Optional<IProtectedRegion> 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.- Parameters:
dim- the resource key of the dimension/level * @return the LevelRegionData corresponding to dim
-
getLevelRegionData
Optional<LevelRegionData> getLevelRegionData(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Gets the LevelRegionData for the specified dimension. A LevelRegionData manages the DimensionalRegion and all Local Regions of the corresponding dimensions.- Parameters:
dim- the resource key of the dimension/level- Returns:
- the LevelRegionData corresponding to dim
-
saveAll
void saveAll()Flag 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. -
save
void save(net.minecraft.server.level.ServerLevel level) -
save
-
save
void save(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> levelKey) -
getDimRegionApi
Optional<ILevelRegionApi> getDimRegionApi(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Gets the DimensionalRegion API for the specified dimension key.- 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").- 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
Create the corresponding ResourceKey for the provided resource key string (e.g. 'minecraft:overworld') Basically a wrapper around `ResourceKey.create(Registries.DIMENSION, Identifier.parse(dimKey));`- Parameters:
dimKey- resource key of the level/dimension- Returns:
- the corresponding ResourceKey for the level/dimension
-
hasLevelData
boolean hasLevelData(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Check whether a DimensionalRegion for the specified dimension already exists.- Parameters:
dim- the dimension key to check for- Returns:
- true if a DimensionalRegion exists, false otherwise
-
trackLevel
LevelRegionData trackLevel(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Creates a DimensionalRegion for the specified dimension key- Parameters:
dim- the dimension identifier of the dimension- Returns:
- the LevelRegionData for the specified dimension, newly created or the already existing
-
untrackLevel
void untrackLevel(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) -
getLevels
Set<net.minecraft.resources.Identifier> getLevels()Returns a set of resource keys for all created Dimensional Regions- Returns:
- a set of resource keys corresponding to registered DimensionalRegions
-
resetLevelData
void resetLevelData(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim) Resets the DimensionalRegion as well as all LocalRegions of the corresponding level.- Parameters:
dim- the resource key of the level/dimension you want to reset its corresponding data for.
-