Search in sources :

Example 1 with LevelSettingsAccessor

use of org.spongepowered.common.accessor.world.level.LevelSettingsAccessor in project SpongeCommon by SpongePowered.

the class PrimaryLevelDataMixin method bridge$populateFromDimension.

@Override
public void bridge$populateFromDimension(final LevelStem dimension) {
    final LevelStemBridge levelStemBridge = (LevelStemBridge) (Object) dimension;
    this.impl$key = ((ResourceKeyBridge) (Object) dimension).bridge$getKey();
    this.impl$dimensionType = dimension.type();
    this.impl$displayName = levelStemBridge.bridge$displayName().orElse(null);
    levelStemBridge.bridge$difficulty().ifPresent(v -> {
        ((LevelSettingsAccessor) (Object) this.settings).accessor$difficulty(RegistryTypes.DIFFICULTY.get().value((ResourceKey) (Object) v));
        this.impl$customDifficulty = true;
    });
    levelStemBridge.bridge$gameMode().ifPresent(v -> {
        ((LevelSettingsAccessor) (Object) this.settings).accessor$gameType(RegistryTypes.GAME_MODE.get().value((ResourceKey) (Object) v));
        this.impl$customGameType = true;
    });
    levelStemBridge.bridge$spawnPosition().ifPresent(v -> {
        this.setSpawn(VecHelper.toBlockPos(v), this.spawnAngle);
        this.impl$customSpawnPosition = true;
    });
    levelStemBridge.bridge$hardcore().ifPresent(v -> ((LevelSettingsAccessor) (Object) this.settings).accessor$hardcode(v));
    this.impl$serializationBehavior = levelStemBridge.bridge$serializationBehavior().orElse(null);
    this.impl$pvp = levelStemBridge.bridge$pvp().orElse(null);
    this.impl$loadOnStartup = levelStemBridge.bridge$loadOnStartup();
    this.impl$performsSpawnLogic = levelStemBridge.bridge$performsSpawnLogic();
    this.impl$viewDistance = levelStemBridge.bridge$viewDistance().orElse(null);
}
Also used : LevelStemBridge(org.spongepowered.common.bridge.world.level.dimension.LevelStemBridge) LevelSettingsAccessor(org.spongepowered.common.accessor.world.level.LevelSettingsAccessor) ResourceKey(org.spongepowered.api.ResourceKey)

Aggregations

ResourceKey (org.spongepowered.api.ResourceKey)1 LevelSettingsAccessor (org.spongepowered.common.accessor.world.level.LevelSettingsAccessor)1 LevelStemBridge (org.spongepowered.common.bridge.world.level.dimension.LevelStemBridge)1