Examples of NibbleArray


Examples of net.glowstone.util.NibbleArray

        /**
         * Create a new, empty ChunkSection.
         */
        public ChunkSection() {
            types = new char[ARRAY_SIZE];
            skyLight = new NibbleArray(ARRAY_SIZE);
            blockLight = new NibbleArray(ARRAY_SIZE);
            skyLight.fill((byte) 0xf);
        }
View Full Code Here

Examples of net.glowstone.util.NibbleArray

        List<CompoundTag> sectionList = levelTag.getCompoundList("Sections");
        ChunkSection[] sections = new ChunkSection[16];
        for (CompoundTag sectionTag : sectionList) {
            int y = sectionTag.getByte("Y");
            byte[] rawTypes = sectionTag.getByteArray("Blocks");
            NibbleArray extTypes = sectionTag.containsKey("Add") ? new NibbleArray(sectionTag.getByteArray("Add")) : null;
            NibbleArray data = new NibbleArray(sectionTag.getByteArray("Data"));
            NibbleArray blockLight = new NibbleArray(sectionTag.getByteArray("BlockLight"));
            NibbleArray skyLight = new NibbleArray(sectionTag.getByteArray("SkyLight"));

            char[] types = new char[rawTypes.length];
            for (int i = 0; i < rawTypes.length; i++) {
                types[i] = (char) (((extTypes == null ? 0 : extTypes.get(i)) << 12) | ((rawTypes[i] & 0xff) << 4) | data.get(i));
            }
View Full Code Here

Examples of net.glowstone.util.NibbleArray

            CompoundTag sectionTag = new CompoundTag();
            sectionTag.putByte("Y", i);

            byte[] rawTypes = new byte[sec.types.length];
            NibbleArray extTypes = null;
            NibbleArray data = new NibbleArray(sec.types.length);
            for (int j = 0; j < sec.types.length; j++) {
                rawTypes[j] = (byte) ((sec.types[j] >> 4) & 0xFF);
                byte extType = (byte) (sec.types[j] >> 12);
                if (extType > 0) {
                    if (extTypes == null) {
                        extTypes = new NibbleArray(sec.types.length);
                    }
                    extTypes.set(j, extType);
                }
                data.set(j, (byte) (sec.types[j] & 0xF));
            }
            sectionTag.putByteArray("Blocks", rawTypes);
            if (extTypes != null) {
                sectionTag.putByteArray("Add", extTypes.getRawData());
            }
            sectionTag.putByteArray("Data", data.getRawData());
            sectionTag.putByteArray("BlockLight", sec.blockLight.getRawData());
            sectionTag.putByteArray("SkyLight", sec.skyLight.getRawData());

            sectionTags.add(sectionTag);
        }
View Full Code Here

Examples of net.minecraft.server.NibbleArray

   * Data is still referenced through
   *
   * @return handle
   */
  public Object toHandle() {
    return new NibbleArray(this.getData(), this.getBitCount());
  }
View Full Code Here

Examples of net.minecraft.world.chunk.NibbleArray

                {
                    blockids[j] = (short)(baseids[j] & 0xFF);
                }

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

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

View Full Code Here

Examples of net.minecraft.world.chunk.NibbleArray

      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;
    }
View Full Code Here

Examples of rakama.worldtools.util.NibbleArray

    {
        super(-1, -1);
       
        tempLights = new NibbleArray[num_sections];
        for(int i=0; i<num_sections; i++)
            tempLights[i] = new NibbleArray(Section.volume);
    }
View Full Code Here

Examples of rakama.worldtools.util.NibbleArray

    public Section(int y)
    {
        this.y = y;

        blockid = new byte[volume];
        metadata = new NibbleArray(volume);
        blocklight = new NibbleArray(volume);
        skylight = new NibbleArray(volume);
    }
View Full Code Here

Examples of rakama.worldtools.util.NibbleArray

        ByteArrayTag tagSkylight = (ByteArrayTag) tag.get("SkyLight");
        ByteArrayTag tagBlocklight = (ByteArrayTag) tag.get("BlockLight");

        int y = tagY.data;

        NibbleArray metadata = new NibbleArray(tagMetadata.data);
        NibbleArray skylight = new NibbleArray(tagSkylight.data);
        NibbleArray blocklight = new NibbleArray(tagBlocklight.data);

        return new Section(y, tagBlockid.data, metadata, blocklight, skylight);
    }
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.