The-Aether
The-Aether copied to clipboard
improv: Change accessories to hold their own accessory slot identifie…
The way the specific accessories handled getting their slot identifiers involved plenty of identical code with minor variations depending on the item. This is resolved in the PR by introducing two things:
- An interface, which is used in cases where
instanceof
checks were used to identify identifiers, and provides one method, which provides the identifier it is trying to retrieve, and provides the benefit of needing fewerif
statements to retrieve the same results. - A static method for each implementation of the interface to retrieve the identifier without needing to access an instance, but without requiring more repeated code. If, for whatever reason, the identifier was changed for an item, all usages, barring a few, would be changed just by changing this method.
I agree to the Contributor License Agreement (CLA).