Closed Offroaders123 closed 1 year ago
I essentially created the Issue for this feature after I finished working on this, so that's how I added it so fast, haha. I thought of adding support for this a little while ago, but I didn't make an Issue for it to track it yet. Seeing this on the list of things completed will be more helpful to track all of the changes together, that's why I still made this Issue, even though I finished implementing it already.
Accept a
CompoundTag
compliant object as a value to write to the buffer, when using eitherNBT.write()
orNBTWriter.write()
. This makes it so you don't have to construct anNBTData
object every time you simply want to write some data to a buffer. Currently, you have to wrap your NBT dataCompoundTag
object in anNBTData
object in order to write it to a buffer. This seems like an extra step to need to do if you don't already have anNBTData
object that you are working with. You can pass the same options in to the write methods that theNBTData
object would define, so you don't lose anything by doing that either, as you can just manually add the configuration there instead of on theNBTData
object. Functional and class-based programming! I think? Haha.This will eventually make things really nice when I get to JSON and SNBT support (#5, #4), since you might just have a plain JavaScript object (JSON serializable) that you would want to save as NBT, and maybe you aren't using any of the custom NBT primitives at all.