Closed gottsch closed 6 years ago
Hi Hmm yeah it looks like you're right. Both of those should be int fullnessBits = (metadata >> 2); or more robustly (i.e. in case metadata is > 0x0f, for some reason) either int fullnessBits = (metadata >> 2) & 0x03; or int fullnessBits = (metadata & 0x0c) >> 2;
Thanks for that, I'll update them next time I'm working on the mod.
Cheers TGG
Hi again I just looked at the code and I remembered that I'm using 5 bits in total, not 4, i.e. fullness can be 0, 1, 2, 3, or 4. The metadata for items is allowed to be more than 4 bits, unlike blocks. Cheers TGG
Hi. I was looking at your ItemsVariants class for the bitwise operations to get/set metadata and I noticed that you were using 0x07 for the upper 2 bits of data (fullnessBits):
But this is unnecessary, as you could use 0x03 as you did for the lower 2 bits in the getUnlocalizedName() method, since you right-shifted the bits: