Improve multi-dimension code

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-11-23 18:39:43 +11:00
parent 820ad30036
commit 3e7bd2643c
10 changed files with 157 additions and 167 deletions

View File

@@ -2,7 +2,7 @@ package org.bukkit.craftbukkit.util;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.World;
import net.minecraft.world.level.dimension.DimensionManager;
import net.minecraft.world.level.dimension.WorldDimension;
public class CraftDimensionUtil {
@@ -10,12 +10,12 @@ public class CraftDimensionUtil {
}
public static ResourceKey<World> getMainDimensionKey(World world) {
ResourceKey<DimensionManager> typeKey = world.getTypeKey();
if (typeKey == DimensionManager.OVERWORLD_LOCATION) {
ResourceKey<WorldDimension> typeKey = world.getTypeKey();
if (typeKey == WorldDimension.OVERWORLD) {
return World.OVERWORLD;
} else if (typeKey == DimensionManager.NETHER_LOCATION) {
} else if (typeKey == WorldDimension.NETHER) {
return World.NETHER;
} else if (typeKey == DimensionManager.END_LOCATION) {
} else if (typeKey == WorldDimension.END) {
return World.END;
}