-
-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the PotionID when creating the DataContainer (Close #1276) #1712
Conversation
I've marked this API8/needs updating because it is changing the contract of a DataContainer. However, my guess is that since it's a bug fix, and it's only changing the serialization behavior, that the deserialization is currently correct so this doesn't round trip correctly? With the assumption that it's a bug, I think it's safe for Milestone 7.1 to immediately fix the issue for people. If it's even remotely possible that it's currently useful to someone in it's current state, I suggest bumping the content version number and making a migrator. I suggest waiting for feedback though, but my suspicion this is safe to move to 7.1 as is. |
@ryantheleach I don't see a point in versioning as it is failing to deserialize already. I mean we could fix the current deserializer through some for loop using the name, which is probably the translation id to properly deserialize, but that's a pain, not guaranteed to work in all cases, and of course was failing already. |
@Meronat good enough for me. This should be ok for merge then, pending review. |
@Meronat @ryantheleach In my opinion, bumping the content version would resolve the issue while providing the upgrader to automatically fix the potion name -> id usage. This will maintain functionality in legacy data input without injecting a "fixer" in the deserializer. That's what I'd prefer to see happen here. |
Sorry for the delay. I missed the notification. Thanks to @Meronat for helping me out yesterday |
cbc23a0
to
d393871
Compare
~qa |
92dc9d9
to
b637e02
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor organizational changes.
|
||
@Override | ||
public int getInputVersion() { | ||
return 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should make this a DataVersions
constant so it's more understandable the differences between said versions.
|
||
@Override | ||
public int getOutputVersion() { | ||
return 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. Should likely be DataVersions.Potions.CURRENT_VERSION
@@ -48,7 +48,7 @@ | |||
private boolean showParticles; | |||
|
|||
public SpongePotionBuilder() { | |||
super(PotionEffect.class, 1); | |||
super(PotionEffect.class, 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And reference said constants.
Give me a final word on this one. |
|
||
@Override | ||
public int getOutputVersion() { | ||
return DataVersions.Potion.CURRENT_VERSION; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we later create a version 3, won’t this break any really old data being migrated, as the migrator would then mislabel version 2 data as version 3?
This should just be version 2 or its own constant, separate from the CURRENT_VERSION
constant to avoid this mistake later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, we can have two pointers, one being the constant 2
for using the proper id, and the "current version" that points to version 2
.
@Zidane ready to merge. Looks good. |
Squash to one commit and I can quickly merge this. Thanks! |
Add DataContentUpdater. (Close SpongePowered#1276)
7abc3e4
to
610a3a8
Compare
Done. |
Uses a DataContentUpdater to update the outdated data containers (Closes SpongePowered#1276)
When creating a
DataContainer
from aPotionEffect
, we are using its name as theDataQueries.POTION_TYPE
. However if you pass the container to the PotionBuilder it uses theDataQueries.POTION_TYPE
to search for thePotionEffect
in the registry (which requires the PotionEffect id).Fix #1276