    001    package net.minecraft.src;
    002
    003    import java.util.Iterator;
    004    import java.util.List;
    005    import java.util.Random;
    006
    007    public abstract class StructureComponent
    008    {
    009        protected StructureBoundingBox boundingBox;
    010
    011        /** switches the Coordinate System base off the Bounding Box */
    012        protected int coordBaseMode;
    013
    014        /** The type ID of this component. */
    015        protected int componentType;
    016
    017        protected StructureComponent(int par1)
    018        {
    019            this.componentType = par1;
    020            this.coordBaseMode = -1;
    021        }
    022
    023        /**
    024         * Initiates construction of the Structure Component picked, at the current Location of StructGen
    025         */
    026        public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) {}
    027
    028        /**
    029         * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
    030         * the end, it adds Fences...
    031         */
    032        public abstract boolean addComponentParts(World var1, Random var2, StructureBoundingBox var3);
    033
    034        public StructureBoundingBox getBoundingBox()
    035        {
    036            return this.boundingBox;
    037        }
    038
    039        /**
    040         * Returns the component type ID of this component.
    041         */
    042        public int getComponentType()
    043        {
    044            return this.componentType;
    045        }
    046
    047        /**
    048         * Discover if bounding box can fit within the current bounding box object.
    049         */
    050        public static StructureComponent findIntersecting(List par0List, StructureBoundingBox par1StructureBoundingBox)
    051        {
    052            Iterator var2 = par0List.iterator();
    053            StructureComponent var3;
    054
    055            do
    056            {
    057                if (!var2.hasNext())
    058                {
    059                    return null;
    060                }
    061
    062                var3 = (StructureComponent)var2.next();
    063            }
    064            while (var3.getBoundingBox() == null || !var3.getBoundingBox().intersectsWith(par1StructureBoundingBox));
    065
    066            return var3;
    067        }
    068
    069        public ChunkPosition getCenter()
    070        {
    071            return new ChunkPosition(this.boundingBox.getCenterX(), this.boundingBox.getCenterY(), this.boundingBox.getCenterZ());
    072        }
    073
    074        /**
    075         * checks the entire StructureBoundingBox for Liquids
    076         */
    077        protected boolean isLiquidInStructureBoundingBox(World par1World, StructureBoundingBox par2StructureBoundingBox)
    078        {
    079            int var3 = Math.max(this.boundingBox.minX - 1, par2StructureBoundingBox.minX);
    080            int var4 = Math.max(this.boundingBox.minY - 1, par2StructureBoundingBox.minY);
    081            int var5 = Math.max(this.boundingBox.minZ - 1, par2StructureBoundingBox.minZ);
    082            int var6 = Math.min(this.boundingBox.maxX + 1, par2StructureBoundingBox.maxX);
    083            int var7 = Math.min(this.boundingBox.maxY + 1, par2StructureBoundingBox.maxY);
    084            int var8 = Math.min(this.boundingBox.maxZ + 1, par2StructureBoundingBox.maxZ);
    085            int var9;
    086            int var10;
    087            int var11;
    088
    089            for (var9 = var3; var9 <= var6; ++var9)
    090            {
    091                for (var10 = var5; var10 <= var8; ++var10)
    092                {
    093                    var11 = par1World.getBlockId(var9, var4, var10);
    094
    095                    if (var11 > 0 && Block.blocksList[var11].blockMaterial.isLiquid())
    096                    {
    097                        return true;
    098                    }
    099
    100                    var11 = par1World.getBlockId(var9, var7, var10);
    101
    102                    if (var11 > 0 && Block.blocksList[var11].blockMaterial.isLiquid())
    103                    {
    104                        return true;
    105                    }
    106                }
    107            }
    108
    109            for (var9 = var3; var9 <= var6; ++var9)
    110            {
    111                for (var10 = var4; var10 <= var7; ++var10)
    112                {
    113                    var11 = par1World.getBlockId(var9, var10, var5);
    114
    115                    if (var11 > 0 && Block.blocksList[var11].blockMaterial.isLiquid())
    116                    {
    117                        return true;
    118                    }
    119
    120                    var11 = par1World.getBlockId(var9, var10, var8);
    121
    122                    if (var11 > 0 && Block.blocksList[var11].blockMaterial.isLiquid())
    123                    {
    124                        return true;
    125                    }
    126                }
    127            }
    128
    129            for (var9 = var5; var9 <= var8; ++var9)
    130            {
    131                for (var10 = var4; var10 <= var7; ++var10)
    132                {
    133                    var11 = par1World.getBlockId(var3, var10, var9);
    134
    135                    if (var11 > 0 && Block.blocksList[var11].blockMaterial.isLiquid())
    136                    {
    137                        return true;
    138                    }
    139
    140                    var11 = par1World.getBlockId(var6, var10, var9);
    141
    142                    if (var11 > 0 && Block.blocksList[var11].blockMaterial.isLiquid())
    143                    {
    144                        return true;
    145                    }
    146                }
    147            }
    148
    149            return false;
    150        }
    151
    152        protected int getXWithOffset(int par1, int par2)
    153        {
    154            switch (this.coordBaseMode)
    155            {
    156                case 0:
    157                case 2:
    158                    return this.boundingBox.minX + par1;
    159                case 1:
    160                    return this.boundingBox.maxX - par2;
    161                case 3:
    162                    return this.boundingBox.minX + par2;
    163                default:
    164                    return par1;
    165            }
    166        }
    167
    168        protected int getYWithOffset(int par1)
    169        {
    170            return this.coordBaseMode == -1 ? par1 : par1 + this.boundingBox.minY;
    171        }
    172
    173        protected int getZWithOffset(int par1, int par2)
    174        {
    175            switch (this.coordBaseMode)
    176            {
    177                case 0:
    178                    return this.boundingBox.minZ + par2;
    179                case 1:
    180                case 3:
    181                    return this.boundingBox.minZ + par1;
    182                case 2:
    183                    return this.boundingBox.maxZ - par2;
    184                default:
    185                    return par2;
    186            }
    187        }
    188
    189        /**
    190         * Returns the direction-shifted metadata for blocks that require orientation, e.g. doors, stairs, ladders.
    191         * Parameters: block ID, original metadata
    192         */
    193        protected int getMetadataWithOffset(int par1, int par2)
    194        {
    195            if (par1 == Block.rail.blockID)
    196            {
    197                if (this.coordBaseMode == 1 || this.coordBaseMode == 3)
    198                {
    199                    if (par2 == 1)
    200                    {
    201                        return 0;
    202                    }
    203
    204                    return 1;
    205                }
    206            }
    207            else if (par1 != Block.doorWood.blockID && par1 != Block.doorSteel.blockID)
    208            {
    209                if (par1 != Block.stairCompactCobblestone.blockID && par1 != Block.stairCompactPlanks.blockID && par1 != Block.stairsNetherBrick.blockID && par1 != Block.stairsStoneBrickSmooth.blockID && par1 != Block.stairsSandStone.blockID)
    210                {
    211                    if (par1 == Block.ladder.blockID)
    212                    {
    213                        if (this.coordBaseMode == 0)
    214                        {
    215                            if (par2 == 2)
    216                            {
    217                                return 3;
    218                            }
    219
    220                            if (par2 == 3)
    221                            {
    222                                return 2;
    223                            }
    224                        }
    225                        else if (this.coordBaseMode == 1)
    226                        {
    227                            if (par2 == 2)
    228                            {
    229                                return 4;
    230                            }
    231
    232                            if (par2 == 3)
    233                            {
    234                                return 5;
    235                            }
    236
    237                            if (par2 == 4)
    238                            {
    239                                return 2;
    240                            }
    241
    242                            if (par2 == 5)
    243                            {
    244                                return 3;
    245                            }
    246                        }
    247                        else if (this.coordBaseMode == 3)
    248                        {
    249                            if (par2 == 2)
    250                            {
    251                                return 5;
    252                            }
    253
    254                            if (par2 == 3)
    255                            {
    256                                return 4;
    257                            }
    258
    259                            if (par2 == 4)
    260                            {
    261                                return 2;
    262                            }
    263
    264                            if (par2 == 5)
    265                            {
    266                                return 3;
    267                            }
    268                        }
    269                    }
    270                    else if (par1 == Block.button.blockID)
    271                    {
    272                        if (this.coordBaseMode == 0)
    273                        {
    274                            if (par2 == 3)
    275                            {
    276                                return 4;
    277                            }
    278
    279                            if (par2 == 4)
    280                            {
    281                                return 3;
    282                            }
    283                        }
    284                        else if (this.coordBaseMode == 1)
    285                        {
    286                            if (par2 == 3)
    287                            {
    288                                return 1;
    289                            }
    290
    291                            if (par2 == 4)
    292                            {
    293                                return 2;
    294                            }
    295
    296                            if (par2 == 2)
    297                            {
    298                                return 3;
    299                            }
    300
    301                            if (par2 == 1)
    302                            {
    303                                return 4;
    304                            }
    305                        }
    306                        else if (this.coordBaseMode == 3)
    307                        {
    308                            if (par2 == 3)
    309                            {
    310                                return 2;
    311                            }
    312
    313                            if (par2 == 4)
    314                            {
    315                                return 1;
    316                            }
    317
    318                            if (par2 == 2)
    319                            {
    320                                return 3;
    321                            }
    322
    323                            if (par2 == 1)
    324                            {
    325                                return 4;
    326                            }
    327                        }
    328                    }
    329                    else if (par1 != Block.tripWireSource.blockID && (Block.blocksList[par1] == null || !(Block.blocksList[par1] instanceof BlockDirectional)))
    330                    {
    331                        if (par1 == Block.pistonBase.blockID || par1 == Block.pistonStickyBase.blockID || par1 == Block.lever.blockID || par1 == Block.dispenser.blockID)
    332                        {
    333                            if (this.coordBaseMode == 0)
    334                            {
    335                                if (par2 == 2 || par2 == 3)
    336                                {
    337                                    return Facing.faceToSide[par2];
    338                                }
    339                            }
    340                            else if (this.coordBaseMode == 1)
    341                            {
    342                                if (par2 == 2)
    343                                {
    344                                    return 4;
    345                                }
    346
    347                                if (par2 == 3)
    348                                {
    349                                    return 5;
    350                                }
    351
    352                                if (par2 == 4)
    353                                {
    354                                    return 2;
    355                                }
    356
    357                                if (par2 == 5)
    358                                {
    359                                    return 3;
    360                                }
    361                            }
    362                            else if (this.coordBaseMode == 3)
    363                            {
    364                                if (par2 == 2)
    365                                {
    366                                    return 5;
    367                                }
    368
    369                                if (par2 == 3)
    370                                {
    371                                    return 4;
    372                                }
    373
    374                                if (par2 == 4)
    375                                {
    376                                    return 2;
    377                                }
    378
    379                                if (par2 == 5)
    380                                {
    381                                    return 3;
    382                                }
    383                            }
    384                        }
    385                    }
    386                    else if (this.coordBaseMode == 0)
    387                    {
    388                        if (par2 == 0 || par2 == 2)
    389                        {
    390                            return Direction.footInvisibleFaceRemap[par2];
    391                        }
    392                    }
    393                    else if (this.coordBaseMode == 1)
    394                    {
    395                        if (par2 == 2)
    396                        {
    397                            return 1;
    398                        }
    399
    400                        if (par2 == 0)
    401                        {
    402                            return 3;
    403                        }
    404
    405                        if (par2 == 1)
    406                        {
    407                            return 2;
    408                        }
    409
    410                        if (par2 == 3)
    411                        {
    412                            return 0;
    413                        }
    414                    }
    415                    else if (this.coordBaseMode == 3)
    416                    {
    417                        if (par2 == 2)
    418                        {
    419                            return 3;
    420                        }
    421
    422                        if (par2 == 0)
    423                        {
    424                            return 1;
    425                        }
    426
    427                        if (par2 == 1)
    428                        {
    429                            return 2;
    430                        }
    431
    432                        if (par2 == 3)
    433                        {
    434                            return 0;
    435                        }
    436                    }
    437                }
    438                else if (this.coordBaseMode == 0)
    439                {
    440                    if (par2 == 2)
    441                    {
    442                        return 3;
    443                    }
    444
    445                    if (par2 == 3)
    446                    {
    447                        return 2;
    448                    }
    449                }
    450                else if (this.coordBaseMode == 1)
    451                {
    452                    if (par2 == 0)
    453                    {
    454                        return 2;
    455                    }
    456
    457                    if (par2 == 1)
    458                    {
    459                        return 3;
    460                    }
    461
    462                    if (par2 == 2)
    463                    {
    464                        return 0;
    465                    }
    466
    467                    if (par2 == 3)
    468                    {
    469                        return 1;
    470                    }
    471                }
    472                else if (this.coordBaseMode == 3)
    473                {
    474                    if (par2 == 0)
    475                    {
    476                        return 2;
    477                    }
    478
    479                    if (par2 == 1)
    480                    {
    481                        return 3;
    482                    }
    483
    484                    if (par2 == 2)
    485                    {
    486                        return 1;
    487                    }
    488
    489                    if (par2 == 3)
    490                    {
    491                        return 0;
    492                    }
    493                }
    494            }
    495            else if (this.coordBaseMode == 0)
    496            {
    497                if (par2 == 0)
    498                {
    499                    return 2;
    500                }
    501
    502                if (par2 == 2)
    503                {
    504                    return 0;
    505                }
    506            }
    507            else
    508            {
    509                if (this.coordBaseMode == 1)
    510                {
    511                    return par2 + 1 & 3;
    512                }
    513
    514                if (this.coordBaseMode == 3)
    515                {
    516                    return par2 + 3 & 3;
    517                }
    518            }
    519
    520            return par2;
    521        }
    522
    523        /**
    524         * current Position depends on currently set Coordinates mode, is computed here
    525         */
    526        protected void placeBlockAtCurrentPosition(World par1World, int par2, int par3, int par4, int par5, int par6, StructureBoundingBox par7StructureBoundingBox)
    527        {
    528            int var8 = this.getXWithOffset(par4, par6);
    529            int var9 = this.getYWithOffset(par5);
    530            int var10 = this.getZWithOffset(par4, par6);
    531
    532            if (par7StructureBoundingBox.isVecInside(var8, var9, var10))
    533            {
    534                par1World.setBlockAndMetadata(var8, var9, var10, par2, par3);
    535            }
    536        }
    537
    538        protected int getBlockIdAtCurrentPosition(World par1World, int par2, int par3, int par4, StructureBoundingBox par5StructureBoundingBox)
    539        {
    540            int var6 = this.getXWithOffset(par2, par4);
    541            int var7 = this.getYWithOffset(par3);
    542            int var8 = this.getZWithOffset(par2, par4);
    543            return !par5StructureBoundingBox.isVecInside(var6, var7, var8) ? 0 : par1World.getBlockId(var6, var7, var8);
    544        }
    545
    546        /**
    547         * arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int
    548         * maxZ)
    549         */
    550        protected void fillWithAir(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6, int par7, int par8)
    551        {
    552            for (int var9 = par4; var9 <= par7; ++var9)
    553            {
    554                for (int var10 = par3; var10 <= par6; ++var10)
    555                {
    556                    for (int var11 = par5; var11 <= par8; ++var11)
    557                    {
    558                        this.placeBlockAtCurrentPosition(par1World, 0, 0, var10, var9, var11, par2StructureBoundingBox);
    559                    }
    560                }
    561            }
    562        }
    563
    564        /**
    565         * arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int
    566         * maxZ, int placeBlockId, int replaceBlockId, boolean alwaysreplace)
    567         */
    568        protected void fillWithBlocks(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6, int par7, int par8, int par9, int par10, boolean par11)
    569        {
    570            for (int var12 = par4; var12 <= par7; ++var12)
    571            {
    572                for (int var13 = par3; var13 <= par6; ++var13)
    573                {
    574                    for (int var14 = par5; var14 <= par8; ++var14)
    575                    {
    576                        if (!par11 || this.getBlockIdAtCurrentPosition(par1World, var13, var12, var14, par2StructureBoundingBox) != 0)
    577                        {
    578                            if (var12 != par4 && var12 != par7 && var13 != par3 && var13 != par6 && var14 != par5 && var14 != par8)
    579                            {
    580                                this.placeBlockAtCurrentPosition(par1World, par10, 0, var13, var12, var14, par2StructureBoundingBox);
    581                            }
    582                            else
    583                            {
    584                                this.placeBlockAtCurrentPosition(par1World, par9, 0, var13, var12, var14, par2StructureBoundingBox);
    585                            }
    586                        }
    587                    }
    588                }
    589            }
    590        }
    591
    592        /**
    593         * arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int
    594         * maxZ, int placeBlockId, int placeBlockMetadata, int replaceBlockId, int replaceBlockMetadata, boolean
    595         * alwaysreplace)
    596         */
    597        protected void fillWithMetadataBlocks(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6, int par7, int par8, int par9, int par10, int par11, int par12, boolean par13)
    598        {
    599            for (int var14 = par4; var14 <= par7; ++var14)
    600            {
    601                for (int var15 = par3; var15 <= par6; ++var15)
    602                {
    603                    for (int var16 = par5; var16 <= par8; ++var16)
    604                    {
    605                        if (!par13 || this.getBlockIdAtCurrentPosition(par1World, var15, var14, var16, par2StructureBoundingBox) != 0)
    606                        {
    607                            if (var14 != par4 && var14 != par7 && var15 != par3 && var15 != par6 && var16 != par5 && var16 != par8)
    608                            {
    609                                this.placeBlockAtCurrentPosition(par1World, par11, par12, var15, var14, var16, par2StructureBoundingBox);
    610                            }
    611                            else
    612                            {
    613                                this.placeBlockAtCurrentPosition(par1World, par9, par10, var15, var14, var16, par2StructureBoundingBox);
    614                            }
    615                        }
    616                    }
    617                }
    618            }
    619        }
    620
    621        /**
    622         * arguments: World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int
    623         * maxZ, boolean alwaysreplace, Random rand, StructurePieceBlockSelector blockselector
    624         */
    625        protected void fillWithRandomizedBlocks(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6, int par7, int par8, boolean par9, Random par10Random, StructurePieceBlockSelector par11StructurePieceBlockSelector)
    626        {
    627            for (int var12 = par4; var12 <= par7; ++var12)
    628            {
    629                for (int var13 = par3; var13 <= par6; ++var13)
    630                {
    631                    for (int var14 = par5; var14 <= par8; ++var14)
    632                    {
    633                        if (!par9 || this.getBlockIdAtCurrentPosition(par1World, var13, var12, var14, par2StructureBoundingBox) != 0)
    634                        {
    635                            par11StructurePieceBlockSelector.selectBlocks(par10Random, var13, var12, var14, var12 == par4 || var12 == par7 || var13 == par3 || var13 == par6 || var14 == par5 || var14 == par8);
    636                            this.placeBlockAtCurrentPosition(par1World, par11StructurePieceBlockSelector.getSelectedBlockId(), par11StructurePieceBlockSelector.getSelectedBlockMetaData(), var13, var12, var14, par2StructureBoundingBox);
    637                        }
    638                    }
    639                }
    640            }
    641        }
    642
    643        /**
    644         * arguments: World worldObj, StructureBoundingBox structBB, Random rand, float randLimit, int minX, int minY, int
    645         * minZ, int maxX, int maxY, int maxZ, int olaceBlockId, int replaceBlockId, boolean alwaysreplace
    646         */
    647        protected void randomlyFillWithBlocks(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, float par4, int par5, int par6, int par7, int par8, int par9, int par10, int par11, int par12, boolean par13)
    648        {
    649            for (int var14 = par6; var14 <= par9; ++var14)
    650            {
    651                for (int var15 = par5; var15 <= par8; ++var15)
    652                {
    653                    for (int var16 = par7; var16 <= par10; ++var16)
    654                    {
    655                        if (par3Random.nextFloat() <= par4 && (!par13 || this.getBlockIdAtCurrentPosition(par1World, var15, var14, var16, par2StructureBoundingBox) != 0))
    656                        {
    657                            if (var14 != par6 && var14 != par9 && var15 != par5 && var15 != par8 && var16 != par7 && var16 != par10)
    658                            {
    659                                this.placeBlockAtCurrentPosition(par1World, par12, 0, var15, var14, var16, par2StructureBoundingBox);
    660                            }
    661                            else
    662                            {
    663                                this.placeBlockAtCurrentPosition(par1World, par11, 0, var15, var14, var16, par2StructureBoundingBox);
    664                            }
    665                        }
    666                    }
    667                }
    668            }
    669        }
    670
    671        /**
    672         * Randomly decides if placing or not. Used for Decoration such as Torches and Spiderwebs
    673         */
    674        protected void randomlyPlaceBlock(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, float par4, int par5, int par6, int par7, int par8, int par9)
    675        {
    676            if (par3Random.nextFloat() < par4)
    677            {
    678                this.placeBlockAtCurrentPosition(par1World, par8, par9, par5, par6, par7, par2StructureBoundingBox);
    679            }
    680        }
    681
    682        /**
    683         * arguments: World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int
    684         * maxZ, int placeBlockId, boolean alwaysreplace
    685         */
    686        protected void randomlyRareFillWithBlocks(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6, int par7, int par8, int par9, boolean par10)
    687        {
    688            float var11 = (float)(par6 - par3 + 1);
    689            float var12 = (float)(par7 - par4 + 1);
    690            float var13 = (float)(par8 - par5 + 1);
    691            float var14 = (float)par3 + var11 / 2.0F;
    692            float var15 = (float)par5 + var13 / 2.0F;
    693
    694            for (int var16 = par4; var16 <= par7; ++var16)
    695            {
    696                float var17 = (float)(var16 - par4) / var12;
    697
    698                for (int var18 = par3; var18 <= par6; ++var18)
    699                {
    700                    float var19 = ((float)var18 - var14) / (var11 * 0.5F);
    701
    702                    for (int var20 = par5; var20 <= par8; ++var20)
    703                    {
    704                        float var21 = ((float)var20 - var15) / (var13 * 0.5F);
    705
    706                        if (!par10 || this.getBlockIdAtCurrentPosition(par1World, var18, var16, var20, par2StructureBoundingBox) != 0)
    707                        {
    708                            float var22 = var19 * var19 + var17 * var17 + var21 * var21;
    709
    710                            if (var22 <= 1.05F)
    711                            {
    712                                this.placeBlockAtCurrentPosition(par1World, par9, 0, var18, var16, var20, par2StructureBoundingBox);
    713                            }
    714                        }
    715                    }
    716                }
    717            }
    718        }
    719
    720        /**
    721         * Deletes all continuous blocks from selected position upwards. Stops at hitting air.
    722         */
    723        protected void clearCurrentPositionBlocksUpwards(World par1World, int par2, int par3, int par4, StructureBoundingBox par5StructureBoundingBox)
    724        {
    725            int var6 = this.getXWithOffset(par2, par4);
    726            int var7 = this.getYWithOffset(par3);
    727            int var8 = this.getZWithOffset(par2, par4);
    728
    729            if (par5StructureBoundingBox.isVecInside(var6, var7, var8))
    730            {
    731                while (!par1World.isAirBlock(var6, var7, var8) && var7 < 255)
    732                {
    733                    par1World.setBlockAndMetadata(var6, var7, var8, 0, 0);
    734                    ++var7;
    735                }
    736            }
    737        }
    738
    739        /**
    740         * Overwrites air and liquids from selected position downwards, stops at hitting anything else.
    741         */
    742        protected void fillCurrentPositionBlocksDownwards(World par1World, int par2, int par3, int par4, int par5, int par6, StructureBoundingBox par7StructureBoundingBox)
    743        {
    744            int var8 = this.getXWithOffset(par4, par6);
    745            int var9 = this.getYWithOffset(par5);
    746            int var10 = this.getZWithOffset(par4, par6);
    747
    748            if (par7StructureBoundingBox.isVecInside(var8, var9, var10))
    749            {
    750                while ((par1World.isAirBlock(var8, var9, var10) || par1World.getBlockMaterial(var8, var9, var10).isLiquid()) && var9 > 1)
    751                {
    752                    par1World.setBlockAndMetadata(var8, var9, var10, par2, par3);
    753                    --var9;
    754                }
    755            }
    756        }
    757
    758        /**
    759         * Used to generate chests with items in it. ex: Temple Chests, Village Blacksmith Chests, Mineshaft Chests.
    760         */
    761        protected boolean generateStructureChestContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, WeightedRandomChestContent[] par7ArrayOfWeightedRandomChestContent, int par8)
    762        {
    763            int var9 = this.getXWithOffset(par4, par6);
    764            int var10 = this.getYWithOffset(par5);
    765            int var11 = this.getZWithOffset(par4, par6);
    766
    767            if (par2StructureBoundingBox.isVecInside(var9, var10, var11) && par1World.getBlockId(var9, var10, var11) != Block.chest.blockID)
    768            {
    769                par1World.setBlockWithNotify(var9, var10, var11, Block.chest.blockID);
    770                TileEntityChest var12 = (TileEntityChest)par1World.getBlockTileEntity(var9, var10, var11);
    771
    772                if (var12 != null)
    773                {
    774                    WeightedRandomChestContent.generateChestContents(par3Random, par7ArrayOfWeightedRandomChestContent, var12, par8);
    775                }
    776
    777                return true;
    778            }
    779            else
    780            {
    781                return false;
    782            }
    783        }
    784
    785        /**
    786         * Used to generate dispenser contents for structures. ex: Jungle Temples.
    787         */
    788        protected boolean generateStructureDispenserContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, int par7, WeightedRandomChestContent[] par8ArrayOfWeightedRandomChestContent, int par9)
    789        {
    790            int var10 = this.getXWithOffset(par4, par6);
    791            int var11 = this.getYWithOffset(par5);
    792            int var12 = this.getZWithOffset(par4, par6);
    793
    794            if (par2StructureBoundingBox.isVecInside(var10, var11, var12) && par1World.getBlockId(var10, var11, var12) != Block.dispenser.blockID)
    795            {
    796                par1World.setBlockAndMetadataWithNotify(var10, var11, var12, Block.dispenser.blockID, this.getMetadataWithOffset(Block.dispenser.blockID, par7));
    797                TileEntityDispenser var13 = (TileEntityDispenser)par1World.getBlockTileEntity(var10, var11, var12);
    798
    799                if (var13 != null)
    800                {
    801                    WeightedRandomChestContent.generateDispenserContents(par3Random, par8ArrayOfWeightedRandomChestContent, var13, par9);
    802                }
    803
    804                return true;
    805            }
    806            else
    807            {
    808                return false;
    809            }
    810        }
    811
    812        protected void placeDoorAtCurrentPosition(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, int par7)
    813        {
    814            int var8 = this.getXWithOffset(par4, par6);
    815            int var9 = this.getYWithOffset(par5);
    816            int var10 = this.getZWithOffset(par4, par6);
    817
    818            if (par2StructureBoundingBox.isVecInside(var8, var9, var10))
    819            {
    820                ItemDoor.placeDoorBlock(par1World, var8, var9, var10, par7, Block.doorWood);
    821            }
    822        }
    823    }