Replaces old fluid handlers with the new capability based ones. #2727

Merged
merged 3 commits into from Dec 31, 2016

Projects

None yet

2 participants

@yueh
Member
yueh commented Dec 31, 2016

Also renamed liquid to fluid as this is an old artifact from the old forge liquid system.

yueh added some commits Dec 31, 2016
@yueh yueh Changed ME Chest and P2P tunnels to use fluid capabilities. 1c25766
@yueh yueh Renamed all occurrences of liquid to fluids.
Liquids is an artifact from the old forge liquids, which were replaced by
forge fluids, thus a rename to avoid confusion.
adb3508
}
return s;
}
- private List<PartP2PLiquids> getOutputs( final Fluid input )
+ private List<PartP2PFluids> getOutputs( final Fluid input )
@orod-org
orod-org Dec 31, 2016

MAJOR Remove this unused method parameter "input". rule

+ {
+ return MODELS.getModels();
+ }
+
public float getPowerDrainPerTick()
{
return 2.0f;
@orod-org
orod-org Dec 31, 2016

MINOR Remove this method and declare a constant for this value. rule

+ }
+
+ @Override
+ public int fill( FluidStack resource, boolean doFill )
@orod-org
orod-org Dec 31, 2016

CRITICAL The Cyclomatic Complexity of this method "fill" is 20 which is greater than 10 authorized. rule

+ }
+ this.accessor = new Accessor();
+
+ if( this.fluidCell != null )
@orod-org
orod-org Dec 31, 2016

CRITICAL Refactor this code to not nest more than 3 if/for/while/switch/try statements. rule

@@ -98,7 +99,7 @@
import appeng.util.item.AEFluidStack;
-public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHandler, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile, ITickable
+public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile, ITickable
@orod-org
orod-org Dec 31, 2016

MAJOR The Cyclomatic Complexity of this class is 202 which is greater than 200 authorized. rule

@@ -228,6 +233,17 @@ else if( fluidCell != null )
this.itemCell = this.wrap( itemCell );
this.fluidCell = this.wrap( fluidCell );
+
+ if( this.itemCell != null )
@orod-org
orod-org Dec 31, 2016

CRITICAL Refactor this code to not nest more than 3 if/for/while/switch/try statements. rule

@yueh yueh Further cleanup.
cf3c00a
- {
- // :(
- }
+ return this.cachedTank = te.getCapability( CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY,
@orod-org
orod-org Dec 31, 2016

MAJOR Extract the assignment out of this expression. rule

if( s == null )
{
- DEPTH.set( s = new Stack<PartP2PLiquids>() );
+ DEPTH.set( s = new LinkedList<>() );
@orod-org
orod-org Dec 31, 2016

MAJOR Extract the assignment out of this expression. rule

@orod-org

SonarQube analysis reported 20 issues

  • CRITICAL 4 critical
  • MAJOR 9 major
  • MINOR 5 minor
  • INFO 2 info

Watch the comments in this conversation to review them.

Top 10 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. CRITICAL PartP2PFluids.java#L181: Define a constant instead of duplicating this literal "Invalid Recursion detected." 3 times. rule
  2. MAJOR PartP2PFluids.java#L275: Either log or rethrow this exception. rule
  3. MAJOR PartP2PTunnel.java#L171: Method appeng.parts.p2p.PartP2PTunnel.onPartActivate(EntityPlayer, EnumHand, Vec3d) appears to call the same method on the same object redundantly rule
  4. MAJOR PartP2PTunnel.java#L181: Method appeng.parts.p2p.PartP2PTunnel.onPartActivate(EntityPlayer, EnumHand, Vec3d) appears to call the same method on the same object redundantly rule
  5. MAJOR PartP2PTunnel.java#L308: Method appeng.parts.p2p.PartP2PTunnel.onPartShiftActivate(EntityPlayer, EnumHand, Vec3d) appears to call the same method on the same object redundantly rule
  6. MAJOR TileChest.java#L742: Remove this unused method parameter "side". rule
  7. MINOR TileChest.java#L424: Rename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'. rule
  8. MINOR TileChest.java#L465: Rename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'. rule
  9. MINOR TileChest.java#L492: Rename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'. rule
  10. MINOR TileChest.java#L503: Rename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'. rule
@yueh yueh merged commit ab89278 into master Dec 31, 2016

3 of 4 checks passed

sonarqube SonarQube reported 20 issues, with 4 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-fluidhandlers branch Dec 31, 2016
@phit phit added a commit to Stonebound/Applied-Energistics-2 that referenced this pull request Jan 1, 2017
@yueh @phit yueh + phit Replaces old fluid handlers with the new capability based ones. (#2727)
* Changed ME Chest and P2P tunnels to use fluid capabilities.
* Renamed all occurrences of liquid to fluids.
08f7823
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment