Examples of ExtendedBlockStorage


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

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

      ExtendedBlockStorage ebs = storageArrays[y >> 4];
      boolean changedHeightMap = false;

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

        ebs = storageArrays[y >> 4] = new ExtendedBlockStorage(y >> 4 << 4, !worldObj.provider.hasNoSky);
        changedHeightMap = y >= height;
      }

      int wX = xPosition * 16 + x;
      int wZ = zPosition * 16 + z;
      Block oldBlock = oldId > 0 ? Block.blocksList[oldId] : null;

      if (oldBlock != null && !worldObj.isRemote) {
        oldBlock.onBlockPreDestroy(worldObj, wX, y, wZ, oldMeta);
      }

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

      if (oldBlock != null) {
        if (!worldObj.isRemote) {
          oldBlock.breakBlock(worldObj, wX, y, wZ, oldId, oldMeta);
        } else if (oldBlock.hasTileEntity(oldMeta)) {
          TileEntity te = worldObj.getBlockTileEntity(wX, y, wZ);
          if (te != null && te.shouldRefresh(oldId, id, oldMeta, meta, worldObj, wX, y, wZ)) {
            worldObj.removeBlockTileEntity(wX, y, wZ);
          }
        }
      }

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

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

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

      ExtendedBlockStorage[] var19 = chunk.getBlockStorageArray();
      var9 = var19.length;

      for (var10 = 0; var10 < var9; ++var10) {
        ExtendedBlockStorage ebs = var19[var10];

        if (ebs != null && ebs.getNeedsRandomTick()) {
          for (int i = 0; i < 3; ++i) {
            updateLCG = updateLCG * 1664525 + 1013904223;
            blockID = updateLCG >> 2;
            int x = blockID & 15;
            int y = blockID >> 8 & 15;
            int z = blockID >> 16 & 15;
            Block var18 = Block.blocksList[ebs.getExtBlockID(x, z, y)];

            if (var18 != null && var18.getTickRandomly()) {
              try {
                var18.updateTick(this, x + xPos, z + ebs.getYLocation(), y + zPos, rand);
              } catch (Exception e) {
                Log.severe("Exception ticking block " + var18 + " at x" + x + xPos + 'y' + z + ebs.getYLocation() + 'z' + y + zPos + " in " + this.getName(), e);
              }
            }
          }
        }
      }
View Full Code Here

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

    boolean flag = !par2World.provider.hasNoSky;
    int i = aextendedblockstorage.length;
    NBTTagCompound nbttagcompound1;

    for (int j = 0; j < i; ++j) {
      ExtendedBlockStorage extendedblockstorage = aextendedblockstorage[j];

      if (extendedblockstorage != null) {
        nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.setByte("Y", (byte) (extendedblockstorage.getYLocation() >> 4 & 255));
        nbttagcompound1.setByteArray("Blocks", extendedblockstorage.getBlockLSBArray());

        if (extendedblockstorage.getBlockMSBArray() != null) {
          nbttagcompound1.setByteArray("Add", extendedblockstorage.getBlockMSBArray().getValueArray()); // Spigot
        }

        nbttagcompound1.setByteArray("Data", extendedblockstorage.getMetadataArray().getValueArray()); // Spigot
        nbttagcompound1.setByteArray("BlockLight", extendedblockstorage.getBlocklightArray().getValueArray()); // Spigot

        if (flag) {
          nbttagcompound1.setByteArray("SkyLight", extendedblockstorage.getSkylightArray().getValueArray()); // Spigot
        } else {
          nbttagcompound1.setByteArray("SkyLight", new byte[extendedblockstorage.getBlocklightArray().getValueArray().length]); // Spigot
        }

        nbttaglist.appendTag(nbttagcompound1);
      }
    }
View Full Code Here

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

    boolean flag = !world.provider.hasNoSky;

    for (int k = 0; k < nbttaglist.tagCount(); ++k) {
      NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(k);
      byte b1 = nbttagcompound1.getByte("Y");
      ExtendedBlockStorage extendedblockstorage = new ExtendedBlockStorage(b1 << 4, flag);
      extendedblockstorage.setBlockLSBArray(nbttagcompound1.getByteArray("Blocks"));

      if (nbttagcompound1.hasKey("Add")) {
        extendedblockstorage.setBlockMSBArray(new NibbleArray(nbttagcompound1.getByteArray("Add"), 4));
      }

      extendedblockstorage.setBlockMetadataArray(new NibbleArray(nbttagcompound1.getByteArray("Data"), 4));
      extendedblockstorage.setBlocklightArray(new NibbleArray(nbttagcompound1.getByteArray("BlockLight"), 4));

      if (flag) {
        extendedblockstorage.setSkylightArray(new NibbleArray(nbttagcompound1.getByteArray("SkyLight"), 4));
      }

      extendedblockstorage.removeInvalidBlocks();
      aextendedblockstorage[b1] = extendedblockstorage;
    }

    chunk.setStorageArrays(aextendedblockstorage);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.