The Block.blocksList array is created with 256 elements. The problem is that block IDs are stored in a signed byte array, so when values are popped several arrays try to be accessed with a negative index if you stored a block ID > 127. You can overcome this limitation quite easily with a few fixes here and there and use the full 0-255 range and have up to 256 different blocks without needing more memory or creating incompatibilites with existing saves.
The trick is that you can easily convert signed byte values to unsigned ints ranging 0-255 using casting and a bitwise AND. Type casting a negative byte to an int extends bit 7 (the sign). After that, a & 0xFF
will clear all bits but those in the least significant byte, so you get your 0-255 value back!
You have to change these bits of code: