public void getPart(ByteArrayDataInputWrapper buf, Part p){
         try {
             c.chunksloaded = true;
             int bits = buf.readUnsignedByte(); //bits per block in the data array, if 0 the palette length and palette field are omitted and the global palette is used
             
             p.bitsPerEntry = bits;
             p.entryMask = (1 << bits) - 1;
             if(bits != 0){
                 int palettelength = Packet.readVarInt(buf);
                 //int[] palette = new int[palettelength];
                 List<Integer> palette = new ArrayList<Integer>();
                 for(int i = 0; i < palettelength; i++){
                     palette.add(Packet.readVarInt(buf));
                     int id = (palette.get(i) >> 4) & 0x0F;
                     int damage = palette.get(i) & 0x0F;
                     System.out.println("Id " + i + " pal " + palette.get(i) + " is id:" + id + " damage:" + damage);                     
                 }
                 p.palette = palette;
             }else{
                 bits = 13;
             }            
             int datasize = Packet.readVarInt(buf);
             long[] data = new long[datasize];
             System.out.println("Data size is: " + datasize + " and our bits are: " + bits);
             for(int i = 0; i < datasize; i++){
                 data[i] = buf.readLong();
                 for(int z = 0; z < Long.numberOfLeadingZeros((long)data[i]); z++) {
                     //System.out.print('0');
                 }
                 //System.out.println(Long.toBinaryString((long)data[i]));
             }
             p.blocks = data;
             p.unpack();
             buf.skipBytes(2048); //skip the stupid block light
             if(c.whandle.getWorld().getDimension() == 0){
                 buf.skipBytes(2048); //if in overworld skip sky light
             }
             //System.out.println("Y: " + p.y + " " + p.blocks.length);
           } catch (IOException e) {
             e.printStackTrace();
           }
     }