Path-of-Terraria / PathOfTerraria

GNU General Public License v3.0
1 stars 3 forks source link

fix autoloading issue with manually added PoTItems #266

Closed GabeHasWon closed 4 months ago

GabeHasWon commented 4 months ago

### Link Issues Resolves: #265

Description of Work

Fixes an issue where manually loaded PoTItems, namely InstancedVanillaClones, would throw an error upon using /spawnitem in-game due to Activator.CreateInstance expecting a parameterless ctor. Reworked PoTItem.AllItems and all peripheral code to store item by ID instead of by Type, so a single Type can have more than one item. Fixed all item spawning code to take an ID instead of a Type, and properly cloned the item instead of using Activator.CreateInstance with manually loaded items.

Comments

I did rewrite a good portion of PoTItem's autoloading. This should not change anything as the IoC will do it all automatically, and using ItemSpawner.GetTypeFromId(int) will get you the Type from an item ID automatically if needed.