package net.minecraft.world.level.biome;

import java.util.OptionalInt;
import com.mojang.datafixers.kinds.Applicative;
import com.mojang.datafixers.kinds.App;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.sounds.Music;
import net.minecraft.sounds.SoundEvent;
import java.util.Optional;
import com.mojang.serialization.Codec;

public class BiomeSpecialEffects {
    public static final Codec<BiomeSpecialEffects> CODEC;
    private final int fogColor;
    private final int waterColor;
    private final int waterFogColor;
    private final Optional<AmbientParticleSettings> ambientParticleSettings;
    private final Optional<SoundEvent> ambientLoopSoundEvent;
    private final Optional<AmbientMoodSettings> ambientMoodSettings;
    private final Optional<AmbientAdditionsSettings> ambientAdditionsSettings;
    private final Optional<Music> backgroundMusic;
    
    private BiomeSpecialEffects(final int integer1, final int integer2, final int integer3, final Optional<AmbientParticleSettings> optional4, final Optional<SoundEvent> optional5, final Optional<AmbientMoodSettings> optional6, final Optional<AmbientAdditionsSettings> optional7, final Optional<Music> optional8) {
        this.fogColor = integer1;
        this.waterColor = integer2;
        this.waterFogColor = integer3;
        this.ambientParticleSettings = optional4;
        this.ambientLoopSoundEvent = optional5;
        this.ambientMoodSettings = optional6;
        this.ambientAdditionsSettings = optional7;
        this.backgroundMusic = optional8;
    }
    
    public int getFogColor() {
        return this.fogColor;
    }
    
    public int getWaterColor() {
        return this.waterColor;
    }
    
    public int getWaterFogColor() {
        return this.waterFogColor;
    }
    
    public Optional<AmbientParticleSettings> getAmbientParticleSettings() {
        return this.ambientParticleSettings;
    }
    
    public Optional<SoundEvent> getAmbientLoopSoundEvent() {
        return this.ambientLoopSoundEvent;
    }
    
    public Optional<AmbientMoodSettings> getAmbientMoodSettings() {
        return this.ambientMoodSettings;
    }
    
    public Optional<AmbientAdditionsSettings> getAmbientAdditionsSettings() {
        return this.ambientAdditionsSettings;
    }
    
    public Optional<Music> getBackgroundMusic() {
        return this.backgroundMusic;
    }
    
    static {
        CODEC = RecordCodecBuilder.create(instance -> ((RecordCodecBuilder.Instance)instance).group((App)Codec.INT.fieldOf("fog_color").forGetter(bri -> bri.fogColor), (App)Codec.INT.fieldOf("water_color").forGetter(bri -> bri.waterColor), (App)Codec.INT.fieldOf("water_fog_color").forGetter(bri -> bri.waterFogColor), (App)AmbientParticleSettings.CODEC.optionalFieldOf("particle").forGetter(bri -> bri.ambientParticleSettings), (App)SoundEvent.CODEC.optionalFieldOf("ambient_sound").forGetter(bri -> bri.ambientLoopSoundEvent), (App)AmbientMoodSettings.CODEC.optionalFieldOf("mood_sound").forGetter(bri -> bri.ambientMoodSettings), (App)AmbientAdditionsSettings.CODEC.optionalFieldOf("additions_sound").forGetter(bri -> bri.ambientAdditionsSettings), (App)Music.CODEC.optionalFieldOf("music").forGetter(bri -> bri.backgroundMusic)).apply(instance, BiomeSpecialEffects::new));
    }
    
    public static class Builder {
        private OptionalInt fogColor;
        private OptionalInt waterColor;
        private OptionalInt waterFogColor;
        private Optional<AmbientParticleSettings> ambientParticle;
        private Optional<SoundEvent> ambientLoopSoundEvent;
        private Optional<AmbientMoodSettings> ambientMoodSettings;
        private Optional<AmbientAdditionsSettings> ambientAdditionsSettings;
        private Optional<Music> backgroundMusic;
        
        public Builder() {
            this.fogColor = OptionalInt.empty();
            this.waterColor = OptionalInt.empty();
            this.waterFogColor = OptionalInt.empty();
            this.ambientParticle = Optional.<AmbientParticleSettings>empty();
            this.ambientLoopSoundEvent = Optional.<SoundEvent>empty();
            this.ambientMoodSettings = Optional.<AmbientMoodSettings>empty();
            this.ambientAdditionsSettings = Optional.<AmbientAdditionsSettings>empty();
            this.backgroundMusic = Optional.<Music>empty();
        }
        
        public Builder fogColor(final int integer) {
            this.fogColor = OptionalInt.of(integer);
            return this;
        }
        
        public Builder waterColor(final int integer) {
            this.waterColor = OptionalInt.of(integer);
            return this;
        }
        
        public Builder waterFogColor(final int integer) {
            this.waterFogColor = OptionalInt.of(integer);
            return this;
        }
        
        public Builder ambientParticle(final AmbientParticleSettings bqx) {
            this.ambientParticle = Optional.<AmbientParticleSettings>of(bqx);
            return this;
        }
        
        public Builder ambientLoopSound(final SoundEvent ack) {
            this.ambientLoopSoundEvent = Optional.<SoundEvent>of(ack);
            return this;
        }
        
        public Builder ambientMoodSound(final AmbientMoodSettings bqw) {
            this.ambientMoodSettings = Optional.<AmbientMoodSettings>of(bqw);
            return this;
        }
        
        public Builder ambientAdditionsSound(final AmbientAdditionsSettings bqv) {
            this.ambientAdditionsSettings = Optional.<AmbientAdditionsSettings>of(bqv);
            return this;
        }
        
        public Builder backgroundMusic(final Music aci) {
            this.backgroundMusic = Optional.<Music>of(aci);
            return this;
        }
        
        public BiomeSpecialEffects build() {
            return new BiomeSpecialEffects(this.fogColor.<Throwable>orElseThrow(() -> new IllegalStateException("Missing 'fog' color.")), this.waterColor.<Throwable>orElseThrow(() -> new IllegalStateException("Missing 'water' color.")), this.waterFogColor.<Throwable>orElseThrow(() -> new IllegalStateException("Missing 'water fog' color.")), this.ambientParticle, this.ambientLoopSoundEvent, this.ambientMoodSettings, this.ambientAdditionsSettings, this.backgroundMusic, null);
        }
    }
}
