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