package net.minecraft.world.level.newbiome.layer;

import org.apache.logging.log4j.LogManager;
import net.minecraft.world.level.biome.Biomes;
import net.minecraft.Util;
import net.minecraft.SharedConstants;
import net.minecraft.core.Registry;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.newbiome.area.AreaFactory;
import net.minecraft.world.level.newbiome.area.LazyArea;
import org.apache.logging.log4j.Logger;

public class Layer {
    private static final Logger LOGGER;
    private final LazyArea area;
    
    public Layer(final AreaFactory<LazyArea> cxj) {
        this.area = cxj.make();
    }
    
    private Biome getBiome(final int integer) {
        final Biome bre3 = Registry.BIOME.byId(integer);
        if (bre3 != null) {
            return bre3;
        }
        if (SharedConstants.IS_RUNNING_IN_IDE) {
            throw Util.<IllegalStateException>pauseInIde(new IllegalStateException("Unknown biome id: " + integer));
        }
        Layer.LOGGER.warn("Unknown biome id: ", integer);
        return Biomes.DEFAULT;
    }
    
    public Biome get(final int integer1, final int integer2) {
        return this.getBiome(this.area.get(integer1, integer2));
    }
    
    static {
        LOGGER = LogManager.getLogger();
    }
}
