001    package net.minecraft.src;
002    
003    import java.util.Random;
004    
005    public class ComponentScatteredFeatureSwampHut extends ComponentScatteredFeature
006    {
007        private boolean field_82682_h;
008    
009        public ComponentScatteredFeatureSwampHut(Random par1Random, int par2, int par3)
010        {
011            super(par1Random, par2, 64, par3, 7, 5, 9);
012        }
013    
014        /**
015         * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
016         * the end, it adds Fences...
017         */
018        public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
019        {
020            if (!this.func_74935_a(par1World, par3StructureBoundingBox, 0))
021            {
022                return false;
023            }
024            else
025            {
026                this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 1, 1, 1, 5, 1, 7, Block.planks.blockID, 1, Block.planks.blockID, 1, false);
027                this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 1, 4, 2, 5, 4, 7, Block.planks.blockID, 1, Block.planks.blockID, 1, false);
028                this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 2, 1, 0, 4, 1, 0, Block.planks.blockID, 1, Block.planks.blockID, 1, false);
029                this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 2, 2, 2, 3, 3, 2, Block.planks.blockID, 1, Block.planks.blockID, 1, false);
030                this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 1, 2, 3, 1, 3, 6, Block.planks.blockID, 1, Block.planks.blockID, 1, false);
031                this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 5, 2, 3, 5, 3, 6, Block.planks.blockID, 1, Block.planks.blockID, 1, false);
032                this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 2, 2, 7, 4, 3, 7, Block.planks.blockID, 1, Block.planks.blockID, 1, false);
033                this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 2, 1, 3, 2, Block.wood.blockID, Block.wood.blockID, false);
034                this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 0, 2, 5, 3, 2, Block.wood.blockID, Block.wood.blockID, false);
035                this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 7, 1, 3, 7, Block.wood.blockID, Block.wood.blockID, false);
036                this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 0, 7, 5, 3, 7, Block.wood.blockID, Block.wood.blockID, false);
037                this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 2, 3, 2, par3StructureBoundingBox);
038                this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 3, 3, 7, par3StructureBoundingBox);
039                this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, 3, 4, par3StructureBoundingBox);
040                this.placeBlockAtCurrentPosition(par1World, 0, 0, 5, 3, 4, par3StructureBoundingBox);
041                this.placeBlockAtCurrentPosition(par1World, 0, 0, 5, 3, 5, par3StructureBoundingBox);
042                this.placeBlockAtCurrentPosition(par1World, Block.field_82516_cf.blockID, 7, 1, 3, 5, par3StructureBoundingBox);
043                this.placeBlockAtCurrentPosition(par1World, Block.workbench.blockID, 0, 3, 2, 6, par3StructureBoundingBox);
044                this.placeBlockAtCurrentPosition(par1World, Block.cauldron.blockID, 0, 4, 2, 6, par3StructureBoundingBox);
045                this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 2, 1, par3StructureBoundingBox);
046                this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 5, 2, 1, par3StructureBoundingBox);
047                int var4 = this.getMetadataWithOffset(Block.stairCompactPlanks.blockID, 3);
048                int var5 = this.getMetadataWithOffset(Block.stairCompactPlanks.blockID, 1);
049                int var6 = this.getMetadataWithOffset(Block.stairCompactPlanks.blockID, 0);
050                int var7 = this.getMetadataWithOffset(Block.stairCompactPlanks.blockID, 2);
051                this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 4, 1, 6, 4, 1, Block.stairsWoodSpruce.blockID, var4, Block.stairsWoodSpruce.blockID, var4, false);
052                this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 4, 2, 0, 4, 7, Block.stairsWoodSpruce.blockID, var6, Block.stairsWoodSpruce.blockID, var6, false);
053                this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 6, 4, 2, 6, 4, 7, Block.stairsWoodSpruce.blockID, var5, Block.stairsWoodSpruce.blockID, var5, false);
054                this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 4, 8, 6, 4, 8, Block.stairsWoodSpruce.blockID, var7, Block.stairsWoodSpruce.blockID, var7, false);
055                int var8;
056                int var9;
057    
058                for (var8 = 2; var8 <= 7; var8 += 5)
059                {
060                    for (var9 = 1; var9 <= 5; var9 += 4)
061                    {
062                        this.fillCurrentPositionBlocksDownwards(par1World, Block.wood.blockID, 0, var9, -1, var8, par3StructureBoundingBox);
063                    }
064                }
065    
066                if (!this.field_82682_h)
067                {
068                    var8 = this.getXWithOffset(2, 5);
069                    var9 = this.getYWithOffset(2);
070                    int var10 = this.getZWithOffset(2, 5);
071    
072                    if (par3StructureBoundingBox.isVecInside(var8, var9, var10))
073                    {
074                        this.field_82682_h = true;
075                        EntityWitch var11 = new EntityWitch(par1World);
076                        var11.setLocationAndAngles((double)var8 + 0.5D, (double)var9, (double)var10 + 0.5D, 0.0F, 0.0F);
077                        var11.func_82163_bD();
078                        par1World.spawnEntityInWorld(var11);
079                    }
080                }
081    
082                return true;
083            }
084        }
085    }