protected void fillWithBlocks(World world, StructureBoundingBox structureboundingbox, int i, int j, int k, int l, int i1, 
                int j1, int k1, int l1, bool flag)
        {
            for(int i2 = j; i2 <= i1; i2++)
            {
                for(int j2 = i; j2 <= l; j2++)
                {
                    for(int k2 = k; k2 <= j1; k2++)
                    {
                        if(flag && func_35297_a(world, j2, i2, k2, structureboundingbox) == 0)
                        {
                            continue;
                        }
                        if(i2 == j || i2 == i1 || j2 == i || j2 == l || k2 == k || k2 == j1)
                        {
                            func_35309_a(world, k1, 0, j2, i2, k2, structureboundingbox);
                        } else
                        {
                            func_35309_a(world, l1, 0, j2, i2, k2, structureboundingbox);
                        }
                    }

                }

            }
        }
Exemplo n.º 2
0
 public StructureBoundingBox(StructureBoundingBox structureboundingbox)
 {
     x1 = structureboundingbox.x1;
     y1 = structureboundingbox.y1;
     z1 = structureboundingbox.z1;
     x2 = structureboundingbox.x2;
     y2 = structureboundingbox.y2;
     z2 = structureboundingbox.z2;
 }
        public static StructureComponent canFitInside(List<StructureComponent> list, StructureBoundingBox structureboundingbox)
        {
            for(IEnumerator<StructureComponent> iterator = list.GetEnumerator(); iterator.MoveNext();)
            {
                StructureComponent structurecomponent = (StructureComponent)iterator.Current;
                if(structurecomponent.getStructureBoundingBox() != null && structurecomponent.getStructureBoundingBox().canFitInside(structureboundingbox))
                {
                    return structurecomponent;
                }
            }

            return null;
        }
Exemplo n.º 4
0
 public void generateStructure(World world, java.util.Random random, StructureBoundingBox structureboundingbox)
 {
     IEnumerator<StructureComponent> iterator = new LinkedList<StructureComponent>(components).GetEnumerator();
     do
     {
         if (!iterator.MoveNext())
         {
             break;
         }
         StructureComponent structurecomponent = (StructureComponent)iterator.Current;
         if (structurecomponent.getStructureBoundingBox().canFitInside(structureboundingbox) && !structurecomponent.addComponentParts(world, random, structureboundingbox))
         {
             components.Remove(iterator.Current);
         }
     } while (true);
 }
        protected void func_35307_a(World world, StructureBoundingBox structureboundingbox, int i, int j, int k, int l, int i1, int j1, bool flag, java.util.Random random, StructurePieceBlockSelector structurepieceblockselector)
        {
            for(int k1 = j; k1 <= i1; k1++)
            {
                for(int l1 = i; l1 <= l; l1++)
                {
                    for(int i2 = k; i2 <= j1; i2++)
                    {
                        if(!flag || func_35297_a(world, l1, k1, i2, structureboundingbox) != 0)
                        {
                            structurepieceblockselector.selectBlocks(random, l1, k1, i2, k1 == j || k1 == i1 || l1 == i || l1 == l || i2 == k || i2 == j1);
                            func_35309_a(world, structurepieceblockselector.func_35566_a(), structurepieceblockselector.func_35567_b(), l1, k1, i2, structureboundingbox);
                        }
                    }

                }

            }
        }
 public abstract bool addComponentParts(World world, java.util.Random random, StructureBoundingBox structureboundingbox);
        protected void func_35304_a(World world, StructureBoundingBox structureboundingbox, int i, int j, int k, int l, int i1, int j1, int k1, bool flag)
        {
            float f = (l - i) + 1;
            float f1 = (i1 - j) + 1;
            float f2 = (j1 - k) + 1;
            float f3 = (float)i + f / 2.0F;
            float f4 = (float)k + f2 / 2.0F;
            for(int l1 = j; l1 <= i1; l1++)
            {
                float f5 = (float)(l1 - j) / f1;
                for(int i2 = i; i2 <= l; i2++)
                {
                    float f6 = ((float)i2 - f3) / (f * 0.5F);
                    for(int j2 = k; j2 <= j1; j2++)
                    {
                        float f7 = ((float)j2 - f4) / (f2 * 0.5F);
                        if(flag && func_35297_a(world, i2, l1, j2, structureboundingbox) == 0)
                        {
                            continue;
                        }
                        float f8 = f6 * f6 + f5 * f5 + f7 * f7;
                        if(f8 <= 1.05F)
                        {
                            func_35309_a(world, k1, 0, i2, l1, j2, structureboundingbox);
                        }
                    }

                }

            }
        }
 public bool canFitInside(StructureBoundingBox structureboundingbox)
 {
     return(x2 >= structureboundingbox.x1 && x1 <= structureboundingbox.x2 && z2 >= structureboundingbox.z1 && z1 <= structureboundingbox.z2 && y2 >= structureboundingbox.y1 && y1 <= structureboundingbox.y2);
 }
Exemplo n.º 9
0
        public static StructureComponent canFitInside(List <StructureComponent> list, StructureBoundingBox structureboundingbox)
        {
            for (IEnumerator <StructureComponent> iterator = list.GetEnumerator(); iterator.MoveNext();)
            {
                StructureComponent structurecomponent = (StructureComponent)iterator.Current;
                if (structurecomponent.getStructureBoundingBox() != null && structurecomponent.getStructureBoundingBox().canFitInside(structureboundingbox))
                {
                    return(structurecomponent);
                }
            }

            return(null);
        }
        protected bool isLiquidInStructureBoundingBox(World world, StructureBoundingBox structureboundingbox)
        {
            int i = Math.Max(boundingBox.x1 - 1, structureboundingbox.x1);
            int j = Math.Max(boundingBox.y1 - 1, structureboundingbox.y1);
            int k = Math.Max(boundingBox.z1 - 1, structureboundingbox.z1);
            int l = Math.Min(boundingBox.x2 + 1, structureboundingbox.x2);
            int i1 = Math.Min(boundingBox.y2 + 1, structureboundingbox.y2);
            int j1 = Math.Min(boundingBox.z2 + 1, structureboundingbox.z2);
            for(int k1 = i; k1 <= l; k1++)
            {
                for(int j2 = k; j2 <= j1; j2++)
                {
                    int i3 = world.GetBlock(k1, j, j2);
                    if (i3 > 0 && BlockData.IsLiquid((byte)i3))
                    {
                        return true;
                    }
                    i3 = world.GetBlock(k1, i1, j2);
                    if (i3 > 0 && BlockData.IsLiquid((byte)i3))
                    {
                        return true;
                    }
                }

            }

            for(int l1 = i; l1 <= l; l1++)
            {
                for(int k2 = j; k2 <= i1; k2++)
                {
                    int j3 = world.GetBlock(l1, k2, k);
                    if (j3 > 0 && BlockData.IsLiquid((byte)j3))
                    {
                        return true;
                    }
                    j3 = world.GetBlock(l1, k2, j1);
                    if (j3 > 0 && BlockData.IsLiquid((byte)j3))
                    {
                        return true;
                    }
                }

            }

            for(int i2 = k; i2 <= j1; i2++)
            {
                for(int l2 = j; l2 <= i1; l2++)
                {
                    int k3 = world.GetBlock(i, l2, i2);
                    if (k3 > 0 && BlockData.IsLiquid((byte)k3))
                    {
                        return true;
                    }
                    k3 = world.GetBlock(l, l2, i2);
                    if (k3 > 0 && BlockData.IsLiquid((byte)k3))
                    {
                        return true;
                    }
                }

            }

            return false;
        }
 protected int func_35297_a(World world, int i, int j, int k, StructureBoundingBox structureboundingbox)
 {
     int l = func_35306_a(i, k);
     int i1 = func_35300_a(j);
     int j1 = func_35296_b(i, k);
     if(!structureboundingbox.isInBbVolume(l, i1, j1))
     {
         return 0;
     } else
     {
         return world.GetBlock(l, i1, j1);
     }
 }
Exemplo n.º 12
0
 public void expandTo(StructureBoundingBox structureboundingbox)
 {
     x1 = Math.Min(x1, structureboundingbox.x1);
     y1 = Math.Min(y1, structureboundingbox.y1);
     z1 = Math.Min(z1, structureboundingbox.z1);
     x2 = Math.Max(x2, structureboundingbox.x2);
     y2 = Math.Max(y2, structureboundingbox.y2);
     z2 = Math.Max(z2, structureboundingbox.z2);
 }
Exemplo n.º 13
0
 public bool canFitInside(StructureBoundingBox structureboundingbox)
 {
     return x2 >= structureboundingbox.x1 && x1 <= structureboundingbox.x2 && z2 >= structureboundingbox.z1 && z1 <= structureboundingbox.z2 && y2 >= structureboundingbox.y1 && y1 <= structureboundingbox.y2;
 }
Exemplo n.º 14
0
 protected void updateBoundingBox()
 {
     boundingBox = StructureBoundingBox.func_35672_a();
     StructureComponent structurecomponent;
     for (IEnumerator<StructureComponent> iterator = components.GetEnumerator(); iterator.MoveNext(); boundingBox.expandTo(structurecomponent.getStructureBoundingBox()))
     {
         structurecomponent = (StructureComponent)iterator.Current;
     }
 }
 protected void func_35309_a(World world, int i, int j, int k, int l, int i1, StructureBoundingBox structureboundingbox)
 {
     int j1 = func_35306_a(k, i1);
     int k1 = func_35300_a(l);
     int l1 = func_35296_b(k, i1);
     if(!structureboundingbox.isInBbVolume(j1, k1, l1))
     {
         return;
     } else
     {
         world.SetBlock(j1, k1, l1, (byte)i, (byte)j);
         return;
     }
 }
 protected void func_35314_b(World world, int i, int j, int k, StructureBoundingBox structureboundingbox)
 {
     int l = func_35306_a(i, k);
     int i1 = func_35300_a(j);
     int j1 = func_35296_b(i, k);
     if(!structureboundingbox.isInBbVolume(l, i1, j1))
     {
         return;
     }
     for(; !world.IsAirBlock(l, i1, j1) && i1 < world.worldYMask; i1++)
     {
         world.SetBlock(l, i1, j1, 0, 0);
     }
 }
 protected void func_35298_a(World world, StructureBoundingBox structureboundingbox, java.util.Random random, int i, int j, int k, int l)
 {
     int i1 = func_35306_a(i, k);
     int j1 = func_35300_a(j);
     int k1 = func_35296_b(i, k);
     if(structureboundingbox.isInBbVolume(i1, j1, k1))
     {
         BlockHelper.PlaceDoor(world, i1, j1, k1, l, (byte)Blocks.DoorWooden);
     }
 }
 protected void randomlyPlaceBlock(World world, StructureBoundingBox structureboundingbox, java.util.Random random, float f, int i, int j, int k, 
         int l, int i1)
 {
     if(random.nextFloat() < f)
     {
         func_35309_a(world, l, i1, i, j, k, structureboundingbox);
     }
 }
 protected void func_35299_a(World world, StructureBoundingBox structureboundingbox, java.util.Random random, int i, int j, int k, StructurePieceTreasure[] astructurepiecetreasure, 
         int l)
 {
     int i1 = func_35306_a(i, k);
     int j1 = func_35300_a(j);
     int k1 = func_35296_b(i, k);
     if(structureboundingbox.isInBbVolume(i1, j1, k1) && world.GetBlock(i1, j1, k1) != (byte)Blocks.Chest)
     {
         world.SetBlock(i1, j1, k1, (byte)Blocks.Chest);
         Container tileentitychest = world.GetBlockContainer(i1, j1, k1);
         if (tileentitychest != null && tileentitychest is ContainerChest)
         {
             func_35311_a(random, astructurepiecetreasure, (ContainerChest)tileentitychest, l);
         }
     }
 }
Exemplo n.º 20
0
 public abstract bool addComponentParts(World world, java.util.Random random, StructureBoundingBox structureboundingbox);
 protected void func_35303_b(World world, int i, int j, int k, int l, int i1, StructureBoundingBox structureboundingbox)
 {
     int j1 = func_35306_a(k, i1);
     int k1 = func_35300_a(l);
     int l1 = func_35296_b(k, i1);
     if(!structureboundingbox.isInBbVolume(j1, k1, l1))
     {
         return;
     }
     for(; (world.IsAirBlock(j1, k1, l1) || BlockData.IsLiquid(world.GetBlock(j1, k1, l1))) && k1 > 1; k1--)
     {
         world.SetBlock(j1, k1, l1, (byte)i, (byte)j);
     }
 }
Exemplo n.º 22
0
        protected bool isLiquidInStructureBoundingBox(World world, StructureBoundingBox structureboundingbox)
        {
            int i  = Math.Max(boundingBox.x1 - 1, structureboundingbox.x1);
            int j  = Math.Max(boundingBox.y1 - 1, structureboundingbox.y1);
            int k  = Math.Max(boundingBox.z1 - 1, structureboundingbox.z1);
            int l  = Math.Min(boundingBox.x2 + 1, structureboundingbox.x2);
            int i1 = Math.Min(boundingBox.y2 + 1, structureboundingbox.y2);
            int j1 = Math.Min(boundingBox.z2 + 1, structureboundingbox.z2);

            for (int k1 = i; k1 <= l; k1++)
            {
                for (int j2 = k; j2 <= j1; j2++)
                {
                    int i3 = world.GetBlock(k1, j, j2);
                    if (i3 > 0 && BlockData.IsLiquid((byte)i3))
                    {
                        return(true);
                    }
                    i3 = world.GetBlock(k1, i1, j2);
                    if (i3 > 0 && BlockData.IsLiquid((byte)i3))
                    {
                        return(true);
                    }
                }
            }

            for (int l1 = i; l1 <= l; l1++)
            {
                for (int k2 = j; k2 <= i1; k2++)
                {
                    int j3 = world.GetBlock(l1, k2, k);
                    if (j3 > 0 && BlockData.IsLiquid((byte)j3))
                    {
                        return(true);
                    }
                    j3 = world.GetBlock(l1, k2, j1);
                    if (j3 > 0 && BlockData.IsLiquid((byte)j3))
                    {
                        return(true);
                    }
                }
            }

            for (int i2 = k; i2 <= j1; i2++)
            {
                for (int l2 = j; l2 <= i1; l2++)
                {
                    int k3 = world.GetBlock(i, l2, i2);
                    if (k3 > 0 && BlockData.IsLiquid((byte)k3))
                    {
                        return(true);
                    }
                    k3 = world.GetBlock(l, l2, i2);
                    if (k3 > 0 && BlockData.IsLiquid((byte)k3))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 23
0
 protected void func_35299_a(World world, StructureBoundingBox structureboundingbox, java.util.Random random, int i, int j, int k, StructurePieceTreasure[] astructurepiecetreasure, 
         int l)
 {
     int i1 = func_35306_a(i, k);
     int j1 = func_35300_a(j);
     int k1 = func_35296_b(i, k);
     if(structureboundingbox.isInBbVolume(i1, j1, k1) && world.GetBlock(i1, j1, k1) != (byte)Blocks.Chest)
     {
         world.SetBlock(i1, j1, k1, (byte)Blocks.Chest);
         // TODO
         /*TileEntityChest tileentitychest = (TileEntityChest)world.getBlockTileEntity(i1, j1, k1);
         if(tileentitychest != null)
         {
             func_35311_a(random, astructurepiecetreasure, tileentitychest, l);
         }*/
     }
 }