    001    package net.minecraft.src;
    002
    003    import java.util.List;
    004    import java.util.Random;
    005
    006    public class StructureMineshaftPieces
    007    {
    008        /** List of contents that can generate in Mineshafts. */
    009        public static final WeightedRandomChestContent[] mineshaftChestContents = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.ingotIron.shiftedIndex, 0, 1, 5, 10), new WeightedRandomChestContent(Item.ingotGold.shiftedIndex, 0, 1, 3, 5), new WeightedRandomChestContent(Item.redstone.shiftedIndex, 0, 4, 9, 5), new WeightedRandomChestContent(Item.dyePowder.shiftedIndex, 4, 4, 9, 5), new WeightedRandomChestContent(Item.diamond.shiftedIndex, 0, 1, 2, 3), new WeightedRandomChestContent(Item.coal.shiftedIndex, 0, 3, 8, 10), new WeightedRandomChestContent(Item.bread.shiftedIndex, 0, 1, 3, 15), new WeightedRandomChestContent(Item.pickaxeSteel.shiftedIndex, 0, 1, 1, 1), new WeightedRandomChestContent(Block.rail.blockID, 0, 4, 8, 1), new WeightedRandomChestContent(Item.melonSeeds.shiftedIndex, 0, 2, 4, 10), new WeightedRandomChestContent(Item.pumpkinSeeds.shiftedIndex, 0, 2, 4, 10)};
    010
    011        private static StructureComponent getRandomComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6)
    012        {
    013            int var7 = par1Random.nextInt(100);
    014            StructureBoundingBox var8;
    015
    016            if (var7 >= 80)
    017            {
    018                var8 = ComponentMineshaftCross.findValidPlacement(par0List, par1Random, par2, par3, par4, par5);
    019
    020                if (var8 != null)
    021                {
    022                    return new ComponentMineshaftCross(par6, par1Random, var8, par5);
    023                }
    024            }
    025            else if (var7 >= 70)
    026            {
    027                var8 = ComponentMineshaftStairs.findValidPlacement(par0List, par1Random, par2, par3, par4, par5);
    028
    029                if (var8 != null)
    030                {
    031                    return new ComponentMineshaftStairs(par6, par1Random, var8, par5);
    032                }
    033            }
    034            else
    035            {
    036                var8 = ComponentMineshaftCorridor.findValidPlacement(par0List, par1Random, par2, par3, par4, par5);
    037
    038                if (var8 != null)
    039                {
    040                    return new ComponentMineshaftCorridor(par6, par1Random, var8, par5);
    041                }
    042            }
    043
    044            return null;
    045        }
    046
    047        private static StructureComponent getNextMineShaftComponent(StructureComponent par0StructureComponent, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7)
    048        {
    049            if (par7 > 8)
    050            {
    051                return null;
    052            }
    053            else if (Math.abs(par3 - par0StructureComponent.getBoundingBox().minX) <= 80 && Math.abs(par5 - par0StructureComponent.getBoundingBox().minZ) <= 80)
    054            {
    055                StructureComponent var8 = getRandomComponent(par1List, par2Random, par3, par4, par5, par6, par7 + 1);
    056
    057                if (var8 != null)
    058                {
    059                    par1List.add(var8);
    060                    var8.buildComponent(par0StructureComponent, par1List, par2Random);
    061                }
    062
    063                return var8;
    064            }
    065            else
    066            {
    067                return null;
    068            }
    069        }
    070
    071        static StructureComponent getNextComponent(StructureComponent par0StructureComponent, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7)
    072        {
    073            return getNextMineShaftComponent(par0StructureComponent, par1List, par2Random, par3, par4, par5, par6, par7);
    074        }
    075
    076        static WeightedRandomChestContent[] func_78816_a()
    077        {
    078            return mineshaftChestContents;
    079        }
    080    }