Ported annotation-based NBT handling#34
Open
HenryLoenwind wants to merge 1 commit intoSleepyTrousers:1.8.9from
Open
Ported annotation-based NBT handling#34HenryLoenwind wants to merge 1 commit intoSleepyTrousers:1.8.9from
HenryLoenwind wants to merge 1 commit intoSleepyTrousers:1.8.9from
Conversation
fcd816c to
14ecdde
Compare
Member
|
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. |
Member
Author
|
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? |
Member
Author
|
This has been put into Ender IO during porting to 1.8.9 and is in use there. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.