Examples of Chunk


Examples of entagged.audioformats.asf.data.Chunk

  public static Chunk readChunckHeader(RandomAccessFile input)
      throws IOException {
    long pos = input.getFilePointer();
    GUID guid = Utils.readGUID(input);
    BigInteger chunkLength = Utils.readBig64(input);
    return new Chunk(guid, pos, chunkLength);
  }
View Full Code Here

Examples of entagged.audioformats.asf.data.Chunk

        // Create byte[] for the asf file.
        byte[] asfContent = description.getBytes();
        // write content
        rafTemp.write(asfContent);
        // Create chunk information
        return new Chunk(GUID.GUID_CONTENTDESCRIPTION, chunkStart, BigInteger
                .valueOf(asfContent.length));
    }
View Full Code Here

Examples of entagged.audioformats.asf.data.Chunk

         * Now perform the creation of the extended content description
         */
        byte[] asfBytes = tagChunk.getBytes();
        rafTemp.write(asfBytes);

        return new Chunk(GUID.GUID_EXTENDED_CONTENT_DESCRIPTION, chunkStart,
                BigInteger.valueOf(asfBytes.length));
    }
View Full Code Here

Examples of entagged.audioformats.asf.data.Chunk

      /*
       * Now reading header of chuncks.
       */
      ArrayList chunks = new ArrayList();
      while (chunkLen.compareTo(BigInteger.valueOf(in.getFilePointer())) > 0) {
        Chunk chunk = ChunkHeaderReader.readChunckHeader(in);
        chunks.add(chunk);
        in.seek(chunk.getChunckEnd());
      }

      /*
       * Creating the resulting object because streamchunks will be added.
       */
      result = new AsfHeader(chunkStart, chunkLen, chunkCount);
      /*
       * Now we know all positions and guids of chunks which are contained
       * whithin asf header. Further we need to identify the type of those
       * chunks and parse the interesting ones.
       */
      FileHeader fileHeader = null;
      ExtendedContentDescription extendedDescription = null;
      EncodingChunk encodingChunk = null;
      StreamChunk streamChunk = null;
      ContentDescription contentDescription = null;
      StreamBitratePropertiesChunk bitratePropertiesChunk = null;

      Iterator iterator = chunks.iterator();
      while (iterator.hasNext()) {
        Chunk currentChunk = (Chunk) iterator.next();
        if (fileHeader == null
            && (fileHeader = FileHeaderReader
                .read(in, currentChunk)) != null) {
          continue;
        }
View Full Code Here

Examples of entagged.audioformats.asf.data.Chunk

   * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
   */
  public int compare(Object o1, Object o2) {
    int result = 0;
    if (o1 instanceof Chunk && o2 instanceof Chunk) {
      Chunk c1 = (Chunk) o1;
      Chunk c2 = (Chunk) o2;
      result = (int) (c1.getPosition() - c2.getPosition());
    }
    return result;
  }
View Full Code Here

Examples of m33.entities.Chunk

    // Level size is fixed for now, it may become dynamic
    level = new char[1000][2000];
    anchor = 990;

    loadSingleFile("chunkTest");
    Chunk ch = new Chunk();

    totRow = tempRow;
    totCol = 0;

    /*
     * for now it load all the chunks in series, from 1 to 4, and it compose
     * them in a single level
     */
    for (int i = 0; i < 10; i++) {

      int j = rand.nextInt(6) + 1;
      //int j = 2; // to test a single chunk
      if(i == 0){
        ch = cm.getChunk(0);
       
        // Chunk 0 MUST define a spawn point
        spawnX = (totCol + ch.getSpawnX()) * TILE_SIZE;
        spawnY = (anchor - ch.getAnchorIn() + ch.getSpawnY()) * TILE_SIZE;
      } else {
        ch = cm.getChunk(j);
      }
     
      char[][] a = ch.getArray();

      for (int r = 0; r < a.length; r++) {
        for (int c = 0; c < a[0].length; c++) {
          level[r + anchor - ch.getAnchorIn()][c + totCol] = a[r][c];
        }
      }

      // create entities
      for (int k = 0; k < ch.getMovNum(); k++) {
        int sx = (ch.sx[k] + totCol) * TILE_SIZE;
        int ex = (ch.ex[k] + totCol) * TILE_SIZE;
        int sy = (ch.sy[k] + anchor - ch.getAnchorIn()) * TILE_SIZE;
        int ey = (ch.ey[k] + anchor - ch.getAnchorIn()) * TILE_SIZE;
        Platform p = new Platform(sx, ex, sy, ey);
        p.setId(1);
        p.setNumWH(ch.getNumW(), ch.getNumH());
     
        em.add(p);
      }

      anchor = anchor - (ch.getAnchorIn() - ch.getAnchorOut());

      totCol += a[0].length;
    }
   
    // Level ends before the last chunk
    endLevel = totCol;
   
    ch = cm.getChunk(0);
    char[][] a = ch.getArray();

    for (int r = 0; r < a.length; r++) {
      for (int c = 0; c < a[0].length; c++) {
        level[r + anchor - ch.getAnchorIn()][c + totCol] = a[r][c];
      }
    }
    totCol += a[0].length;

    ROWS = totRow;
View Full Code Here

Examples of net.lightstone.model.Chunk

    if (!region.hasChunk(regionX, regionZ)) {
      return null;
    }

    DataInputStream in = region.getChunkDataInputStream(regionX, regionZ);
    Chunk chunk = new Chunk(x, z);

    NBTInputStream nbt = new NBTInputStream(in, false);
    CompoundTag tag = (CompoundTag) nbt.readTag();
    Map<String, Tag> levelTags = ((CompoundTag) tag.getValue().get("Level")).getValue();

    byte[] tileData = ((ByteArrayTag) levelTags.get("Blocks")).getValue();
    chunk.setTypes(tileData);

    byte[] skyLightData = ((ByteArrayTag) levelTags.get("SkyLight")).getValue();
    byte[] blockLightData = ((ByteArrayTag) levelTags.get("BlockLight")).getValue();
    byte[] metaData = ((ByteArrayTag) levelTags.get("Data")).getValue();

    for (int cx = 0; cx < Chunk.WIDTH; cx++) {
      for (int cz = 0; cz < Chunk.HEIGHT; cz++) {
        for (int cy = 0; cy < Chunk.DEPTH; cy++) {
          boolean mostSignificantNibble = ((cx * Chunk.HEIGHT + cz) * Chunk.DEPTH + cy) % 2 == 1;
          int offset = ((cx * Chunk.HEIGHT + cz) * Chunk.DEPTH + cy) / 2;

          int skyLight, blockLight, meta;
          if (mostSignificantNibble) {
            skyLight = (skyLightData[offset] & 0xF0) >> 4;
            blockLight = (blockLightData[offset] & 0xF0) >> 4;
            meta = (metaData[offset] & 0xF0) >> 4;
          } else {
            skyLight = skyLightData[offset] & 0x0F;
            blockLight = blockLightData[offset] & 0x0F;
            meta = metaData[offset] & 0x0F;
          }

          chunk.setSkyLight(cx, cz, cy, skyLight);
          chunk.setBlockLight(cx, cz, cy, blockLight);
          chunk.setMetaData(cx, cz, cy, meta);
        }
      }
    }
    nbt.close();
    return chunk;
View Full Code Here

Examples of net.minecraft.server.Chunk

    // Only do this replacement logic for Entities that are already spawned
    if (this.isSpawned()) {
      // Now proceed to replace this NMS Entity in all places imaginable.
      // First load the chunk so we can at least work on something
      Chunk chunk = CommonNMS.getNative(getWorld().getChunkAt(getChunkX(), getChunkZ()));

      // *** Entities By ID Map ***
      final IntHashMap<Object> entitiesById = WorldServerRef.entitiesById.get(oldInstance.world);
      if (entitiesById.remove(oldInstance.getId()) == null) {
        CommonUtil.nextTick(new Runnable() {
View Full Code Here

Examples of net.minecraft.server.v1_6_R1.Chunk

    CraftWorld craftWorld = (CraftWorld)world;
    WorldServer worldServer = craftWorld.getHandle();
   
    BiomeBase bb = BiomeBase.biomes[id];
    if (craftWorld.loadChunk(x >> 4, z >> 4, false)) {
      Chunk chunk = worldServer.getChunkAtWorldCoords(x, z);

      if (chunk != null) {
        byte[] biomevals = chunk.m();
        biomevals[((z & 0xF) << 4) | (x & 0xF)] = (byte)bb.id;
      }
    }
  }
View Full Code Here

Examples of net.minecraft.src.Chunk

  public static SpoutcraftChunk getChunkAt(World world, int x, int y, int z) {
    return getChunk(world, x >> 4, z >> 4);
  }

  public static SpoutcraftChunk getChunk(World world, int chunkX, int chunkZ) {
    Chunk chunk = world.getChunkFromChunkCoords(chunkX, chunkZ);
    if (chunk != null) {
      return chunk.spoutChunk;
    }
    return null;
  }
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.