Package net.minecraft.world.chunk.storage

Examples of net.minecraft.world.chunk.storage.ExtendedBlockStorage


  public Chunk provideChunk(int par1, int par2) {
    Chunk chunk = new Chunk(this.worldObj, par1, par2);

    for (int k = 0; k < this.cachedBlockIDs.length; ++k) {
      int l = k >> 4;
      ExtendedBlockStorage extendedblockstorage = chunk.getBlockStorageArray()[l];

      if (extendedblockstorage == null) {
        extendedblockstorage = new ExtendedBlockStorage(k, !this.worldObj.provider.hasNoSky);
        chunk.getBlockStorageArray()[l] = extendedblockstorage;
      }

      for (int i1 = 0; i1 < 16; ++i1) {
        for (int j1 = 0; j1 < 16; ++j1) {
          extendedblockstorage.func_150818_a(i1, k & 15, j1, Block.getBlockById(this.cachedBlockIDs[k] & 255));
          extendedblockstorage.setExtBlockMetadata(i1, k & 15, j1, this.cachedBlockMetadata[k]);
        }
      }
    }

    chunk.generateSkylightMap();
View Full Code Here


                    {
                        int k1 = y >> 4;

                        if (storage[k1] == null)
                        {
                            storage[k1] = new ExtendedBlockStorage(k1 << 4, !world.provider.hasNoSky);
                        }

                        storage[k1].func_150818_a(x, y & 15, z, id);
                    }
                }
View Full Code Here

         boolean flagXZUChunk = w.getChunkProvider().chunkExists(cx - 1, cz + 1);
      boolean flagXZDChunk = w.getChunkProvider().chunkExists(cx - 1, cz - 1);

      for (int j = 0; j < 16; j++)
      {
        if (chunk.getBlockStorageArray()[j] == null) chunk.getBlockStorageArray()[j] = new ExtendedBlockStorage(j, false);
      }

      int i = chunk.getTopFilledSegment();
      chunk.heightMapMinimum = Integer.MAX_VALUE;

      for (int j = 0; j < 16; ++j)
      {
        int k = 0;

        while (k < 16)
        {
          chunk.precipitationHeightMap[j + (k << 4)] = -999;
          int y = i + 15;

          while (true)
          {
            if (y > 0)
            {
              if (chunk.func_150808_b(j, y - 1, k) == 0)
              {
                --y;
                continue;
              }

              chunk.heightMap[k << 4 | j] = y;

              if (y < chunk.heightMapMinimum)
              {
                chunk.heightMapMinimum = y;
              }
            }

            ++k;
            break;
          }
        }
      }
       
       for (AsteroidData a : this.largeAsteroids)
      {
        int yMin = a.asteroidYArray - a.asteroidSizeArray;
        int yMax = a.asteroidYArray + a.asteroidSizeArray;
        int xMin = a.xMinArray;
        if (yMin < 0) yMin = 0;
        if (yMax > 255) yMax = 255;
        if (xMin == 0) xMin = 1;
        for (int x = a.xMax - 1; x >= xMin; x--)
        {
          for (int z = a.zMinArray; z < a.zMax; z++)
          {
            for (int y = yMin; y < yMax; y++)
            {
              if (chunk.getBlock(x - 1, y, z) instanceof BlockAir && !(chunk.getBlock(x, y, z) instanceof BlockAir))
              {
                int count = 2;
                
                if (x > 1)
                {
                  if ((chunk.getBlock(x - 2, y, z) instanceof BlockAir)) count+=2;
                }
                if (x > 2)
                {
                  if ((chunk.getBlock(x - 3, y, z) instanceof BlockAir)) count+=2;
                  if ((chunk.getBlock(x - 3, y + 1, z) instanceof BlockAir)) count++;
                  if ((chunk.getBlock(x - 3, y + 1, z) instanceof BlockAir)) count++;
                  if ((z > 0 /*|| ((xPos & 15) > 2 ? flagZDChunk : flagXZDChunk)*/) && (chunk.getBlock(x - 3, y, z - 1) instanceof BlockAir)) count++;
                  if ((z < 15/* || ((xPos & 15) > 2 ? flagZUChunk : flagXZUChunk)*/) && (chunk.getBlock(x - 3, y, z + 1) instanceof BlockAir)) count++;
                }
                if (/*flagXChunk || */x > 3)
                {
                  if ((chunk.getBlock(x - 4, y, z) instanceof BlockAir)) count+=2;
                  if ((chunk.getBlock(x - 4, y + 1, z) instanceof BlockAir)) count++;
                  if ((chunk.getBlock(x - 4, y + 1, z) instanceof BlockAir)) count++;
                  if ((z > 0/* || ((xPos & 15) > 3 ? flagZDChunk : flagXZDChunk)*/) && !(chunk.getBlock(x - 4, y, z - 1) instanceof BlockAir)) count++;
                  if ((z < 15/* || ((xPos & 15) > 3 ? flagZUChunk : flagXZUChunk)*/) && !(chunk.getBlock(x - 4, y, z + 1) instanceof BlockAir)) count++;
                }
                if (count > 12) count = 12;
                chunk.func_150807_a(x - 1, y & 15, z, GCBlocks.brightAir, 15 - count);
                            ExtendedBlockStorage extendedblockstorage = chunk.getBlockStorageArray()[y >> 4];
                            if (extendedblockstorage != null)
                            {
                                extendedblockstorage.setExtBlocklightValue(x - 1, y & 15, z, count);
                            }
               }
            }
          }
        }
View Full Code Here

        ExtendedBlockStorage[] ebs = chunk.getBlockStorageArray();

        /* Copy sections */
        for (int i = 0; i < this.sectionCnt; i++)
        {
            ExtendedBlockStorage eb = (i < ebs.length) ? ebs[i] : null;

            if ((eb != null) && (eb.isEmpty() == false))
            {
                this.empty[i] = false;
                /* Copy base IDs */
                byte[] baseids = eb.getBlockLSBArray();
                short blockids[] = new short[BLOCKS_PER_SECTION];

                for (int j = 0; j < BLOCKS_PER_SECTION; j++)
                {
                    blockids[j] = (short)(baseids[j] & 0xFF);
                }

                /* Add MSB data, if section has any */
                NibbleArray msb = eb.getBlockMSBArray();

                if (msb != null)
                {
                    byte[] extids = getValueArray(msb);

                    for (int j = 0; j < extids.length; j++)
                    {
                        short b = (short)(extids[j] & 0xFF);

                        if (b == 0)
                        {
                            continue;
                        }

                        blockids[j << 1] |= (b & 0x0F) << 8;
                        blockids[(j << 1) + 1] |= (b & 0xF0) << 4;
                    }
                }

                this.blockids[i] = blockids;
                /* Copy block data */
                this.blockdata[i] = new byte[BLOCKS_PER_SECTION / 2];
                System.arraycopy(getValueArray(eb.getMetadataArray()), 0, this.blockdata[i], 0, BLOCKS_PER_SECTION / 2);
                /* Copy block lighting data */
                this.emitlight[i] = new byte[BLOCKS_PER_SECTION / 2];
                System.arraycopy(getValueArray(eb.getBlocklightArray()), 0, this.emitlight[i], 0, BLOCKS_PER_SECTION / 2);
                /* Copy sky lighting data */
                if(eb.getSkylightArray() != null) {
                  this.skylight[i] = new byte[BLOCKS_PER_SECTION / 2];
                  System.arraycopy(getValueArray(eb.getSkylightArray()), 0, this.skylight[i], 0, BLOCKS_PER_SECTION / 2);
                }
                else {
                  this.skylight[i] = ChunkSnapshot.emptyData;
                }
            }
View Full Code Here

        int k1 = chunk.getBlockMetadata(x, y, z);

        if (block1 == dense_ore_blocks && k1 == id) {
            return false;
        } else {
            ExtendedBlockStorage extendedblockstorage = chunk.getBlockStorageArray()[y >> 4];

            if (extendedblockstorage == null)
                return false;   //should never happen as we are replacing an existing block

            extendedblockstorage.func_150818_a(x, y & 15, z, dense_ore_blocks);
            extendedblockstorage.setExtBlockMetadata(x, y & 15, z, id);

            if (block1.hasTileEntity(k1)) {
                TileEntity te = chunk.getTileEntityUnsafe(x & 0x0F, y, z & 0x0F);
                if (te != null) {
                    ChunkPosition chunkposition = new ChunkPosition(x & 0x0F, y, z & 0x0F);
                    te = (TileEntity) chunk.chunkTileEntityMap.remove(chunkposition);
                    te.invalidate(); //urk hopefully this doesn't explode anything
                }
            }

            return extendedblockstorage.getBlockByExtId(x, y & 15, z) == dense_ore_blocks;
        }
    }
View Full Code Here

      // make sure storage exists before hand...
      for (int ay = 0; ay < chunkHeight; ay++)
      {
        int by = (ay + cy);
        ExtendedBlockStorage extendedblockstorage = storage[by];
        if ( extendedblockstorage == null )
          extendedblockstorage = storage[by] = new ExtendedBlockStorage( by << 4, !c.worldObj.provider.hasNoSky );
      }
    }
View Full Code Here

    public void setBlockIDWithMetadata(int y, Object[] blk)
    {
      if ( blk[0] == matrixFrame )
        blk[0] = Platform.air;

      ExtendedBlockStorage extendedBlockStorage = storage[y >> 4];
      extendedBlockStorage.func_150818_a( x, y & 15, z, (Block) blk[0] );
      // extendedBlockStorage.setExtBlockID( x, y & 15, z, blk[0] );
      extendedBlockStorage.setExtBlockMetadata( x, y & 15, z, (Integer) blk[1] );
      extendedBlockStorage.setExtBlocklightValue( x, y & 15, z, (Integer) blk[2] );
    }
View Full Code Here

      extendedBlockStorage.setExtBlocklightValue( x, y & 15, z, (Integer) blk[2] );
    }

    public Object[] getDetails(int y)
    {
      ExtendedBlockStorage extendedblockstorage = storage[y >> 4];
      ch[0] = extendedblockstorage.getBlockByExtId( x, y & 15, z );
      ch[1] = extendedblockstorage.getExtBlockMetadata( x, y & 15, z );
      ch[2] = extendedblockstorage.getExtBlocklightValue( x, y & 15, z );
      return ch;
    }
View Full Code Here

      return ch;
    }

    public boolean doNotSkip(int y)
    {
      ExtendedBlockStorage extendedblockstorage = storage[y >> 4];
      if ( reg.isBlacklisted( extendedblockstorage.getBlockByExtId( x, y & 15, z ) ) )
        return false;

      return skipThese == null || !skipThese.contains( y );
    }
View Full Code Here

    } else {
      if (y >> 4 >= storageArrays.length || y >> 4 < 0) {
        return false;
      }

      ExtendedBlockStorage var10 = storageArrays[y >> 4];
      boolean var11 = false;

      if (var10 == null) {
        if (id == 0) {
          return false;
        }

        var10 = storageArrays[y >> 4] = new ExtendedBlockStorage(y >> 4 << 4, !worldObj.provider.hasNoSky);
        var11 = y >= var7;
      }

      int var12 = xPosition * 16 + x;
      int var13 = zPosition * 16 + z;

      var10.setExtBlockID(x, y & 15, z, id);

      if (var8 != 0) {
        if (Block.blocksList[var8] != null && Block.blocksList[var8].hasTileEntity(var9)) {
          TileEntity te = worldObj.getBlockTileEntity(var12, y, var13);
          if (te != null && te.shouldRefresh(var8, id, var9, meta, worldObj, var12, y, var13)) {
            worldObj.removeBlockTileEntity(var12, y, var13);
          }
        }
      }

      if (var10.getExtBlockID(x, y & 15, z) != id) {
        return false;
      } else {
        var10.setExtBlockMetadata(x, y & 15, z, meta);

        if (var11) {
          generateSkylightMap();
        } else {
          if (getBlockLightOpacity(x, y, z) > 0) {
View Full Code Here

TOP

Related Classes of net.minecraft.world.chunk.storage.ExtendedBlockStorage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.