Expose an API for data models.
ProjectET opened this issue ยท 5 comments
Hi, I'm making an addon mod for Deep Mob Learning and I need to get the data amount from the data models, would it be possible to expose that as an API or would there be another way to do that without having to expose an API?
Hello, I will keep this as a feature request for the 1.17 update.
For now, you can simply use the NBT of the ItemStack.
It may be a good idea to import the mod in your compile time and use this method: https://github.com/NathanPB/DeepMobLearning-Refabricated/blob/70f74739fd9458a019c9e615d68395aa60a269ed/src/main/kotlin/dev/nathanpb/dml/data/DataModelData.kt#L43
So you can do something like: stack.dataModel.dataAmount = foobar
.
To manage the NBT I'm using this little library I made: https://github.com/NathanPB/KtDataTagLib