StellarWind22 / Fabric-Shield-Lib

Library for easily adding new shields, shield enchantments, and enabling you to enchant shields in general without worry of conflictions.
https://www.curseforge.com/minecraft/mc-mods/fabric-shield-lib
GNU Lesser General Public License v2.1
40 stars 19 forks source link

Refactor code #123

Closed muhammedesadcomert closed 1 year ago

muhammedesadcomert commented 1 year ago

Contains;

StellarWind22 commented 1 year ago

Why did you split ItemRepairType into two classes?

muhammedesadcomert commented 1 year ago

Why did you split ItemRepairType into two classes?

Because the same logic was used in 2 different classes (FabricShieldItem and FabricBannerShieldItem), I reduced code duplication by converting it to a single static function.

FabricShieldItem, line 167, FabricBannerShieldItem, line 178.

muhammedesadcomert commented 1 year ago

@CringeStar All the variables I marked as final were assigned only once in their constructor. Since they are not assigned in a different place, they can be final. You can of course remove the final keyword if you ever want to change them later.

CringeStar commented 1 year ago

@CringeStar All the variables I marked as final were assigned only once in their constructor. Since they are not assigned in a different place, they can be final. You can of course remove the final keyword if you ever want to change them later.

Oh, I thought that there were setter methods for cooldownticks and enchantibility. Ill merge this PR and add those setters tommorow and make CoolDownTicks and enchantibility non final again