package com.zivilon.cinder_loe.world.biome;

import lotr.common.LOTRDimension;
import lotr.common.entity.animal.*;
import lotr.common.world.biome.LOTRBiome;
import lotr.common.world.biome.LOTRBiomeDecorator;
import lotr.common.world.biome.LOTRMusicRegion;
import lotr.common.world.spawning.LOTREventSpawner;
import net.minecraft.entity.passive.*;
import net.minecraft.world.biome.BiomeGenBase;

public abstract class CinderBiome extends LOTRBiome {
    public static LOTRBiome mistyforest;

    public CinderBiome(int i, boolean major) {
        super(i, major, LOTRDimension.MIDDLE_EARTH);
    }

    public CinderBiome(int i, boolean major, LOTRDimension dim) {
        super(i, false);
        this.biomeDimension = dim;
        if (this.biomeDimension.biomeList[i] != null) {
            throw new IllegalArgumentException("LOTR biome already exists at index " + i + " for dimension " + this.biomeDimension.dimensionName + "!");
        }
        this.biomeDimension.biomeList[i] = this;
        if (major) {
            this.biomeDimension.majorBiomes.add(this);
        }
        this.decorator = new LOTRBiomeDecorator(this);
        this.spawnableCreatureList.clear();
        this.spawnableWaterCreatureList.clear();
        this.spawnableMonsterList.clear();
        this.spawnableCaveCreatureList.clear();
        if (this.hasDomesticAnimals()) {
            this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4));
            this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityPig.class, 10, 4, 4));
            this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityChicken.class, 10, 4, 4));
            this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityCow.class, 8, 4, 4));
            this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(LOTREntityDeer.class, 5, 4, 4));
        } else {
            this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4));
            this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(LOTREntityWildBoar.class, 10, 4, 4));
            this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityChicken.class, 8, 4, 4));
            this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(LOTREntityDeer.class, 10, 4, 4));
            this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(LOTREntityAurochs.class, 6, 4, 4));
        }
        this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(LOTREntityFish.class, 10, 4, 4));
        this.spawnableLOTRAmbientList.add(new BiomeGenBase.SpawnListEntry(LOTREntityButterfly.class, 8, 4, 4));
        this.spawnableLOTRAmbientList.add(new BiomeGenBase.SpawnListEntry(LOTREntityRabbit.class, 8, 4, 4));
        this.spawnableLOTRAmbientList.add(new BiomeGenBase.SpawnListEntry(LOTREntityBird.class, 10, 4, 4));
        this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8));
        this.setBanditChance(LOTREventSpawner.EventChance.NEVER);
    }

    @Override
    public abstract LOTRMusicRegion.Sub getBiomeMusic();
}
