001package net.minecraft.world.gen.structure;
002
003import java.util.List;
004import java.util.Random;
005import net.minecraft.block.Block;
006import net.minecraft.world.World;
007
008public class ComponentNetherBridgeNetherStalkRoom extends ComponentNetherBridgePiece
009{
010    public ComponentNetherBridgeNetherStalkRoom(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4)
011    {
012        super(par1);
013        this.coordBaseMode = par4;
014        this.boundingBox = par3StructureBoundingBox;
015    }
016
017    /**
018     * Initiates construction of the Structure Component picked, at the current Location of StructGen
019     */
020    public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random)
021    {
022        this.getNextComponentNormal((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 5, 3, true);
023        this.getNextComponentNormal((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 5, 11, true);
024    }
025
026    /**
027     * Creates and returns a new component piece. Or null if it could not find enough room to place it.
028     */
029    public static ComponentNetherBridgeNetherStalkRoom createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6)
030    {
031        StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -5, -3, 0, 13, 14, 13, par5);
032        return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(par0List, structureboundingbox) == null ? new ComponentNetherBridgeNetherStalkRoom(par6, par1Random, structureboundingbox, par5) : null;
033    }
034
035    /**
036     * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
037     * the end, it adds Fences...
038     */
039    public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
040    {
041        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 0, 12, 4, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
042        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 12, 13, 12, 0, 0, false);
043        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 1, 12, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
044        this.fillWithBlocks(par1World, par3StructureBoundingBox, 11, 5, 0, 12, 12, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
045        this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 5, 11, 4, 12, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
046        this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 5, 11, 10, 12, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
047        this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 9, 11, 7, 12, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
048        this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 5, 0, 4, 12, 1, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
049        this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 5, 0, 10, 12, 1, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
050        this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 9, 0, 7, 12, 1, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
051        this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 11, 2, 10, 12, 10, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
052        int i;
053
054        for (i = 1; i <= 11; i += 2)
055        {
056            this.fillWithBlocks(par1World, par3StructureBoundingBox, i, 10, 0, i, 11, 0, Block.netherFence.blockID, Block.netherFence.blockID, false);
057            this.fillWithBlocks(par1World, par3StructureBoundingBox, i, 10, 12, i, 11, 12, Block.netherFence.blockID, Block.netherFence.blockID, false);
058            this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 10, i, 0, 11, i, Block.netherFence.blockID, Block.netherFence.blockID, false);
059            this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 10, i, 12, 11, i, Block.netherFence.blockID, Block.netherFence.blockID, false);
060            this.placeBlockAtCurrentPosition(par1World, Block.netherBrick.blockID, 0, i, 13, 0, par3StructureBoundingBox);
061            this.placeBlockAtCurrentPosition(par1World, Block.netherBrick.blockID, 0, i, 13, 12, par3StructureBoundingBox);
062            this.placeBlockAtCurrentPosition(par1World, Block.netherBrick.blockID, 0, 0, 13, i, par3StructureBoundingBox);
063            this.placeBlockAtCurrentPosition(par1World, Block.netherBrick.blockID, 0, 12, 13, i, par3StructureBoundingBox);
064            this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, i + 1, 13, 0, par3StructureBoundingBox);
065            this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, i + 1, 13, 12, par3StructureBoundingBox);
066            this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 0, 13, i + 1, par3StructureBoundingBox);
067            this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 12, 13, i + 1, par3StructureBoundingBox);
068        }
069
070        this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 0, 13, 0, par3StructureBoundingBox);
071        this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 0, 13, 12, par3StructureBoundingBox);
072        this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 0, 13, 0, par3StructureBoundingBox);
073        this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 12, 13, 0, par3StructureBoundingBox);
074
075        for (i = 3; i <= 9; i += 2)
076        {
077            this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 7, i, 1, 8, i, Block.netherFence.blockID, Block.netherFence.blockID, false);
078            this.fillWithBlocks(par1World, par3StructureBoundingBox, 11, 7, i, 11, 8, i, Block.netherFence.blockID, Block.netherFence.blockID, false);
079        }
080
081        i = this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 3);
082        int j;
083        int k;
084        int l;
085
086        for (j = 0; j <= 6; ++j)
087        {
088            k = j + 4;
089
090            for (l = 5; l <= 7; ++l)
091            {
092                this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, i, l, 5 + j, k, par3StructureBoundingBox);
093            }
094
095            if (k >= 5 && k <= 8)
096            {
097                this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 5, k, 7, j + 4, k, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
098            }
099            else if (k >= 9 && k <= 10)
100            {
101                this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 8, k, 7, j + 4, k, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
102            }
103
104            if (j >= 1)
105            {
106                this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 6 + j, k, 7, 9 + j, k, 0, 0, false);
107            }
108        }
109
110        for (j = 5; j <= 7; ++j)
111        {
112            this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, i, j, 12, 11, par3StructureBoundingBox);
113        }
114
115        this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 6, 7, 5, 7, 7, Block.netherFence.blockID, Block.netherFence.blockID, false);
116        this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 6, 7, 7, 7, 7, Block.netherFence.blockID, Block.netherFence.blockID, false);
117        this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 13, 12, 7, 13, 12, 0, 0, false);
118        this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 5, 2, 3, 5, 3, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
119        this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 5, 9, 3, 5, 10, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
120        this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 5, 4, 2, 5, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
121        this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 5, 2, 10, 5, 3, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
122        this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 5, 9, 10, 5, 10, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
123        this.fillWithBlocks(par1World, par3StructureBoundingBox, 10, 5, 4, 10, 5, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
124        j = this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 0);
125        k = this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 1);
126        this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, k, 4, 5, 2, par3StructureBoundingBox);
127        this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, k, 4, 5, 3, par3StructureBoundingBox);
128        this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, k, 4, 5, 9, par3StructureBoundingBox);
129        this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, k, 4, 5, 10, par3StructureBoundingBox);
130        this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, j, 8, 5, 2, par3StructureBoundingBox);
131        this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, j, 8, 5, 3, par3StructureBoundingBox);
132        this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, j, 8, 5, 9, par3StructureBoundingBox);
133        this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, j, 8, 5, 10, par3StructureBoundingBox);
134        this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 4, 4, 4, 4, 8, Block.slowSand.blockID, Block.slowSand.blockID, false);
135        this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 4, 4, 9, 4, 8, Block.slowSand.blockID, Block.slowSand.blockID, false);
136        this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 5, 4, 4, 5, 8, Block.netherStalk.blockID, Block.netherStalk.blockID, false);
137        this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 5, 4, 9, 5, 8, Block.netherStalk.blockID, Block.netherStalk.blockID, false);
138        this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 2, 0, 8, 2, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
139        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 4, 12, 2, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
140        this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 0, 8, 1, 3, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
141        this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 9, 8, 1, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
142        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 4, 3, 1, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
143        this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 0, 4, 12, 1, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
144        int i1;
145
146        for (l = 4; l <= 8; ++l)
147        {
148            for (i1 = 0; i1 <= 2; ++i1)
149            {
150                this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, l, -1, i1, par3StructureBoundingBox);
151                this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, l, -1, 12 - i1, par3StructureBoundingBox);
152            }
153        }
154
155        for (l = 0; l <= 2; ++l)
156        {
157            for (i1 = 4; i1 <= 8; ++i1)
158            {
159                this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, l, -1, i1, par3StructureBoundingBox);
160                this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, 12 - l, -1, i1, par3StructureBoundingBox);
161            }
162        }
163
164        return true;
165    }
166}