Search in sources :

Example 1 with ServerLevelData

use of net.minecraft.world.level.storage.ServerLevelData in project SpongeCommon by SpongePowered.

the class PrimaryLevelDataMixin method bridge$world.

@Override
@Nullable
public ServerLevel bridge$world() {
    if (!Sponge.isServerAvailable()) {
        return null;
    }
    final ServerLevel world = SpongeCommon.server().getLevel(SpongeWorldManager.createRegistryKey(this.impl$key));
    if (world == null) {
        return null;
    }
    final ServerLevelData levelData = (ServerLevelData) world.getLevelData();
    if (levelData != this) {
        return null;
    }
    return world;
}
Also used : ServerLevel(net.minecraft.server.level.ServerLevel) ServerLevelData(net.minecraft.world.level.storage.ServerLevelData) Nullable(org.checkerframework.checker.nullness.qual.Nullable)

Aggregations

ServerLevel (net.minecraft.server.level.ServerLevel)1 ServerLevelData (net.minecraft.world.level.storage.ServerLevelData)1 Nullable (org.checkerframework.checker.nullness.qual.Nullable)1