CivClassic / ItemExchange

ItemExchange is a Minecraft plugin that allows players to make shops to physically buy and sell items. Built for Paper 1.16.5
Other
0 stars 10 forks source link

Potions now work. #4

Closed ghost closed 5 years ago

ghost commented 5 years ago

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.

Gjum commented 5 years ago

Does this work for brews too?

How difficult will it be to update this to 1.13/14 down the line?

ghost commented 5 years ago

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.

Maxopoly commented 5 years ago

Would probably be good to eventually centralize potion naming in CivModCore. Until then (if ever) this is good, decent code.

ghost commented 5 years ago

The potion name switch is pulled from my MinemanUtilities library. It might be worth just copying the most of it.