001package net.minecraft.world.gen.structure;
002
003import java.util.Iterator;
004import java.util.Map;
005import java.util.Map.Entry;
006import net.minecraft.util.MathHelper;
007
008public class MapGenMineshaft extends MapGenStructure
009{
010    private double field_82673_e = 0.01D;
011
012    public MapGenMineshaft() {}
013
014    public MapGenMineshaft(Map par1Map)
015    {
016        Iterator iterator = par1Map.entrySet().iterator();
017
018        while (iterator.hasNext())
019        {
020            Entry entry = (Entry)iterator.next();
021
022            if (((String)entry.getKey()).equals("chance"))
023            {
024                this.field_82673_e = MathHelper.parseDoubleWithDefault((String)entry.getValue(), this.field_82673_e);
025            }
026        }
027    }
028
029    protected boolean canSpawnStructureAtCoords(int par1, int par2)
030    {
031        return this.rand.nextDouble() < this.field_82673_e && this.rand.nextInt(80) < Math.max(Math.abs(par1), Math.abs(par2));
032    }
033
034    protected StructureStart getStructureStart(int par1, int par2)
035    {
036        return new StructureMineshaftStart(this.worldObj, this.rand, par1, par2);
037    }
038}