Refactored GrinderRegistry. #2644

Merged
merged 3 commits into from Dec 2, 2016

Projects

None yet

2 participants

@yueh
Member
yueh commented Nov 21, 2016 edited

Waiting on config PR for further features.

Changed IGrinderRegistry#getRecipes to return an unmodifiable collection.
Added a way to remove recipes explicitly instead the internal list.
Added a cache to lookup recipes instead of iterating a list.
Added an option to define custom ore to dust ratios.

Renamed IGrinderEntry to IGrinderRecipe
Made IGrindRecipe immutable for easy caching.

Improved GrinderLogging and Exception Handling
JEI Workaround as it expects a List instead Collection.

+ Preconditions.checkNotNull( input );
+ Preconditions.checkNotNull( input.getItem() );
+
+ this.item = input.getItem();
@orod-org
orod-org Nov 27, 2016

MAJOR Method new appeng.core.features.registries.GrinderRecipeManager$CacheKey(ItemStack) appears to call the same method on the same object redundantly rule

yueh added some commits Nov 21, 2016
@yueh yueh Refactored GrinderRegistry.
Changed IGrinderRegistry#getRecipes to return an unmodifiable collection.
Added a way to remove recipes explicitly instead the internal list.
Added a cache to lookup recipes instead of iterating a list.

Renamed IGrinderEntry to IGrinderRecipe
Made IGrindRecipe immutable for easy caching.

Improved GrinderLogging and Exception Handling
JEI Workaround as it expects a List instead Collection.
83fc69f
@yueh yueh Added blacklist of explicit oredict names for the grindstone.
This can be used should the automatic recipe generation create unintended
loopholes.
b417df1
@@ -153,8 +157,16 @@ private AEConfig( final File configFile )
this.removeCrashingItemsOnLoad = this.get( "general", "removeCrashingItemsOnLoad", false,
"Will auto-remove items that crash when being loaded from storage. This will destroy those items instead of crashing the game!" ).getBoolean();
- this.grinderOres = this.get( "GrindStone", "grinderOres", this.grinderOres ).getStringList();
- this.oreDoublePercentage = this.get( "GrindStone", "oreDoublePercentage", this.oreDoublePercentage ).getDouble( this.oreDoublePercentage );
+ this.setCategoryComment( "GrindStone",
@orod-org
orod-org Dec 2, 2016

CRITICAL Define a constant instead of duplicating this literal "GrindStone" 4 times. rule

@yueh yueh Fixup
c30d06a
@orod-org
orod-org commented Dec 2, 2016

SonarQube analysis reported 4 issues

  • CRITICAL 1 critical
  • MAJOR 2 major
  • MINOR 1 minor

Watch the comments in this conversation to review them.

2 extra issues

Note: The following issues were found on lines that were not modified in the pull request. Because these issues can't be reported as line comments, they are summarized here:

  1. MAJOR JEIPlugin.java#L98: Method appeng.integration.modules.jei.JEIPlugin.registerDescriptions(IDefinitions, IModRegistry) appears to call the same method on the same object redundantly rule
  2. MINOR TileGrinder.java#L54: Remove this use of "neighborChanged"; it is deprecated. rule
@yueh yueh merged commit eb1e86c into master Dec 2, 2016

3 of 4 checks passed

sonarqube SonarQube reported 4 issues, with 1 critical
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
jenkins Success
Details
@yueh yueh deleted the feature-grindstone-refactoring branch Dec 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment