16 lines
No EOL
624 B
Kotlin
16 lines
No EOL
624 B
Kotlin
package com.beemer.essentials.util
|
|
|
|
import net.minecraft.core.registries.Registries
|
|
import net.minecraft.resources.ResourceKey
|
|
import net.minecraft.resources.ResourceLocation
|
|
import net.minecraft.server.MinecraftServer
|
|
import net.minecraft.server.level.ServerLevel
|
|
import net.minecraft.world.level.Level
|
|
|
|
object DimensionUtils {
|
|
fun getLevelById(server: MinecraftServer, dimensionId: String): ServerLevel? {
|
|
val rl = ResourceLocation.tryParse(dimensionId) ?: return null
|
|
val key: ResourceKey<Level> = ResourceKey.create(Registries.DIMENSION, rl)
|
|
return server.getLevel(key)
|
|
}
|
|
} |