Layers and IC2 Tunnel #2565

Merged
merged 3 commits into from Nov 4, 2016

Projects

None yet

2 participants

@shartte
Contributor
shartte commented Nov 4, 2016

Refactored layers and implemented IC2 Tunnel on top of it

shartte added some commits Oct 31, 2016
@shartte shartte Re-Activated the IC2 layers to implement an IC2 P2P tunnel. 62a891a
@shartte shartte Set the source tier of the P2P output side to 4 (EV) because initiall…
…y -1 was returned, causing the ENet to ignore the P2P output side. Sadly, the tier cannot be changed once the tile is registered, so we're going with the highest there is. The effect of this is not quite clear at this point... kaboom?
09e28a2
@@ -28,7 +28,6 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-
import javax.annotation.Nonnull;
@orod-org
orod-org Nov 4, 2016

MINOR 'javax.annotation.Nonnull' should be separated from previous imports. rule

+ return cache.getUnchecked( new CacheKey( baseClass, this.desc ) );
+ }
+
+ private Class<? extends AEBaseTile> generateCombinedClass( CacheKey cacheKey )
@orod-org
orod-org Nov 4, 2016

MINOR Move this method into the anonymous class declared at line 71. rule

@@ -222,8 +225,15 @@ String getUnlocalizedName()
}
},
- // P2PTunnelEU( 465, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelEU ), EnumSet.of( IntegrationType.IC2 ),
- // PartP2PIC2Power.class, GuiText.EUTunnel ),
+ P2PTunnelEU( 465, "p2p_tunnel_ic2", EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelEU ), EnumSet.of( IntegrationType.IC2 ),
@orod-org
orod-org Nov 4, 2016

CRITICAL Rename this constant name to match the regular expression '^[A-Z][A-Z0-9]([A-Z0-9]+)_$'. rule

+ }
+
+ @Override
+ public double injectEnergy( EnumFacing directionFrom, double amount, double voltage )
@orod-org
orod-org Nov 4, 2016

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

+ }
+ }
+ }
+ catch( GridAccessException e )
@orod-org
orod-org Nov 4, 2016

MAJOR Either log or rethrow this exception. rule

+ {
+ outs = this.getOutputs();
+ }
+ catch( GridAccessException e )
@orod-org
orod-org Nov 4, 2016

MAJOR Either log or rethrow this exception. rule

@shartte shartte Code Style fixes.
cf98654
+ }
+
+ // Buffer the energy + voltage for two IC2 ENET packets
+ private double bufferedEnergy1;
@orod-org
orod-org Nov 4, 2016

MINOR Move this variable to comply with Java Code Conventions. rule

+
+ // Buffer the energy + voltage for two IC2 ENET packets
+ private double bufferedEnergy1;
+ private double bufferedVoltage1;
@orod-org
orod-org Nov 4, 2016

MINOR Move this variable to comply with Java Code Conventions. rule

+ // Buffer the energy + voltage for two IC2 ENET packets
+ private double bufferedEnergy1;
+ private double bufferedVoltage1;
+ private double bufferedEnergy2;
@orod-org
orod-org Nov 4, 2016

MINOR Move this variable to comply with Java Code Conventions. rule

+ private double bufferedEnergy1;
+ private double bufferedVoltage1;
+ private double bufferedEnergy2;
+ private double bufferedVoltage2;
@orod-org
orod-org Nov 4, 2016

MINOR Move this variable to comply with Java Code Conventions. rule

+ private double bufferedEnergy2;
+ private double bufferedVoltage2;
+
+ public PartP2PIC2Power( ItemStack is )
@orod-org
orod-org Nov 4, 2016

MINOR Move this constructor to comply with Java Code Conventions. rule

@orod-org
orod-org commented Nov 4, 2016

SonarQube analysis reported 16 issues

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

Watch the comments in this conversation to review them.

5 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 ApiPart.java#L190: Method appeng.core.api.ApiPart.getClassByDesc(Class, String) passes constant String of length 1 to character overridden method rule
  2. MAJOR ApiPart.java#L238: Method appeng.core.api.ApiPart.getReader(String) passes constant String of length 1 to character overridden method 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
@shartte shartte merged commit f5e4a20 into master Nov 4, 2016

3 of 4 checks passed

sonarqube SonarQube reported 16 issues, with 2 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
@shartte shartte deleted the ic2-p2p branch Nov 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment