Closed ghost closed 5 years ago
Does this work for brews too?
How difficult will it be to update this to 1.13/14 down the line?
It works with brews :) as said in note four. As for upgrades, unless potion data has been changed wildly, it would only require minor modifications to serialisation/deserialisation.
Would probably be good to eventually centralize potion naming in CivModCore. Until then (if ever) this is good, decent code.
The potion name switch is pulled from my MinemanUtilities library. It might be worth just copying the most of it.
ItemExchange will now support the exchange of potions without the need for systemic changes or upgrades.
Notes:
1) The display name will technically be stored twice in a potion's exchange rule data, but as AdditionalMetadata classes only receive the item's metadata, it's impossible to receive the already parsed display name without further changes.
2) The display info will not output the specifics of a potion's effects. It can be added back if necessary, but no other kind of metadata displays such intimate information, except perhaps books where knowing the author and title is necessary.
3) The hard coded potions names are necessary as ItemExchange doesn't use CivModCore and so doesn't use various APIs to deduce a vanilla potion's name by its base effect, at least not without systemic changes outside the scope of this update.
4) Tested with vanilla potions and potions resulting from brewing.