EnderCore
EnderCore copied to clipboard
Ported annotation-based NBT handling
This is what I've been using in Ender IO Addon for ages. No changes other than Java 1.6 and Minecraft 1.8.9 compatibility and a different package name.
The changes to the TileEntity are a bit different because we don't need compatibility with an existing Ender IO class hierarchy. It may need some changes once we port over classes that actually use it.
In a nutshell: There are no callbacks for world saving/loading and description packet handling anymore. Instead fields that should be saved are annotated (see EIOA for examples). There are two tool methods to read/write data from/to an item's NBT. A subclass that wants to do that, needs to call them.
one quick question, is ti still easy to add special NBT handling code? The situation I am thinking of is migrating a change in TEs. In the past when I have changed a field, added new ones etc, I have added code that would read the old tags and transform them into the new object.
yes, it is. For one, that "final" on those methods doesn't mean we cannot add a new "handleMigrateNbt()" call to the read methods (I put the final there to help us not miss a method when migrating), and on the other hand we can easily add handlers for specific TEs.
And in general, do we really expect people to migrate their modded 1.7.10 worlds to 1.8.9?
Is this still viable in 1.10.2?
This has been put into Ender IO during porting to 1.8.9 and is in use there.