Generating with block IDs higher than Byte.Max_Value

Discussion in 'Plugin Help/Development/Requests' started by Jupitertree, Dec 12, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Jupitertree

    I never had a problem generating blocks with an ID past 127 but now when I'm using the updated version of Bukkit by MD_5 it just doesn't seem to work. If I put another number below 127 in for the setblock method it works perfectly. There are no errors in console.

    Code:
        public byte[][] generateBlockSections(World w, Random random, int cx, int cz, BiomeGrid biomeGrid) {
            byte[][] result = new byte[w.getMaxHeight() / 16][];
            for(int x = 0; x < 16; x++){
                for(int y = 1; y < 16; y++){
                    for (int z = 0; z < 16; z++){
                        if(y >= 1 && y <= 16){
                            setBlock(result, x, y, z, (byte) 159);//Problem here!!!
                        }
                    }
                }
            }
            return result;
        }
      
        private void setBlock(byte[][] result, int x, int y, int z, byte blkid) {
            if (result[y >> 4] == null) {
                result[y >> 4] = new byte[4096];
            }
            result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = blkid;
        }
     
  2. Offline

    Jupitertree

    It doesn't really work like that.
     
    Skionz likes this.
  3. Offline

    mrCookieSlime

    Moved to Alternatives Section.
     
  4. Offline

    Jupitertree

    Solved by using the generateExtBlockSections which takes a short instead of a byte.
     
Thread Status:
Not open for further replies.

Share This Page