Querz / NBT

A java implementation of the NBT protocol, including a way to implement custom tags.
MIT License
182 stars 48 forks source link

Fast-failing CompoundTag's and ListTag's getters #80

Closed HoldYourWaffle closed 1 year ago

HoldYourWaffle commented 2 years ago

Title says it all :)

I just spent hours debugging something that was ultimately caused by missing (and then later wrong-kind) tags, because CompoundTag and ListTag implicitly supply default values. In the interest of failing-fast instead of propagating corrupted data I have removed this behavior.

Note that the previous behavior is still possible with the explicit get*OrDefault methods. Failing-fast-checks are very tedious to write (and easy to forget!) with the current implementation on the other hand.