New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registration rework #3018

Merged
merged 10 commits into from Aug 12, 2017

Conversation

Projects
None yet
3 participants
@fscan
Member

fscan commented Aug 8, 2017

Splits up the IBootstrapComponent interface into single interfaces per event type and registers the component at the correct forge event.
Still needs some restructuring probably, but it's a start.


Edit /yueh
Fixes #3008

}
else if( block instanceof AEBaseTileBlock )
{
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
// extended props
factory.modelOverrideComponent.addOverride( block.getRegistryName().getResourcePath(), ( l, m ) -> new AutoRotatingModel( m ) );
factory.addModelOverride( block.getRegistryName().getResourcePath(), ( l, m ) -> new AutoRotatingModel( m ) );
}
// TODO : 1.12

This comment has been minimized.

@orod-org

orod-org Aug 8, 2017

INFO Complete the task associated to this TODO comment. rule

@orod-org

orod-org Aug 8, 2017

INFO Complete the task associated to this TODO comment. rule

RecipeSorter.register( "AE2-Facade", FacadeRecipe.class, Category.SHAPED, "" );
RecipeSorter.register( "AE2-Shaped", ShapedRecipe.class, Category.SHAPED, "" );
RecipeSorter.register( "AE2-Shapeless", ShapelessRecipe.class, Category.SHAPELESS, "" );
// RecipeSorter.register( "AE2-Facade", FacadeRecipe.class, Category.SHAPED, "" );

This comment has been minimized.

@orod-org

orod-org Aug 8, 2017

MAJOR This block of commented-out lines of code should be removed. rule

@orod-org

orod-org Aug 8, 2017

MAJOR This block of commented-out lines of code should be removed. rule

@@ -302,7 +229,8 @@ public void initialize( @Nonnull final FMLInitializationEvent event, @Nonnull fi
final IRegistryContainer registries = api.registries();
ApiDefinitions definitions = api.definitions();
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.initialize( event.getSide() ) );
definitions.getRegistry().getBootstrapComponents( IInitComponent.class ).forEachRemaining( b -> b.initialize( event.getSide() ) );
//
// // Perform ore camouflage!
// ItemMaterial.instance.makeUnique();

This comment has been minimized.

@orod-org

orod-org Aug 8, 2017

MAJOR This block of commented-out lines of code should be removed. rule

@orod-org

orod-org Aug 8, 2017

MAJOR This block of commented-out lines of code should be removed. rule

if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_DISASSEMBLY_CRAFTING ) )
{
DisassembleRecipe r = new DisassembleRecipe();
// TODO : 1.12 Improve
addRecipeToRegister( r.setRegistryName( AppEng.MOD_ID.toLowerCase(), "disassemble" ) );
registry.register( r.setRegistryName( AppEng.MOD_ID.toLowerCase(), "disassemble" ) );
// RecipeSorter.register( "appliedenergistics2:disassemble", DisassembleRecipe.class, Category.SHAPELESS,
// "after:minecraft:shapeless" );

This comment has been minimized.

@orod-org

orod-org Aug 8, 2017

MAJOR This block of commented-out lines of code should be removed. rule

@orod-org

orod-org Aug 8, 2017

MAJOR This block of commented-out lines of code should be removed. rule

@@ -122,16 +124,11 @@
import appeng.worldgen.QuartzWorldGen;
public final class Registration
final class Registration

This comment has been minimized.

@orod-org

orod-org Aug 8, 2017

MAJOR Add a constructor to the class. rule

@orod-org

orod-org Aug 8, 2017

MAJOR Add a constructor to the class. rule

@@ -556,7 +460,7 @@ void postInit( final FMLPostInitializationEvent event )
if( AEConfig.instance().isFeatureEnabled( AEFeature.VILLAGER_TRADING ) )
{
// TODO: VILLAGER TRADING
// VillagerRegistry.instance().getRegisteredVillagers()..registerVillageTradeHandler( 3, new AETrading() );
// VillagerRegistry.instance().getRegisteredVillagers().registerVillageTradeHandler( 3, new AETrading() );

This comment has been minimized.

@orod-org

orod-org Aug 8, 2017

MAJOR This block of commented-out lines of code should be removed. rule

@orod-org

orod-org Aug 8, 2017

MAJOR This block of commented-out lines of code should be removed. rule

@@ -19,28 +19,9 @@
package appeng.bootstrap;
import net.minecraftforge.fml.relauncher.Side;
/**
* Bootstrap components can be registered to take part in the various initialization phases of Forge.

This comment has been minimized.

@yueh

yueh Aug 9, 2017

Member

This should probable state something like See the individual subclasses for a specific forge initalization event.

@yueh

yueh Aug 9, 2017

Member

This should probable state something like See the individual subclasses for a specific forge initalization event.

@@ -51,7 +51,7 @@ public Chunk generateChunk( final int x, final int z )
final Chunk chunk = new Chunk( this.world, x, z );
final byte[] biomes = chunk.getBiomeArray();
Biome biome = AppEng.instance().getRegistration().getStorageBiome();
Biome biome = AppEng.instance().getStorageBiome();

This comment has been minimized.

@yueh

yueh Aug 9, 2017

Member

This might be a good candidate for the API. Having a explicit source instead of trying to infer it somehow might be beneficial for certain mods.

@yueh

yueh Aug 9, 2017

Member

This might be a good candidate for the API. Having a explicit source instead of trying to infer it somehow might be beneficial for certain mods.

@@ -101,7 +101,7 @@ public boolean doesXZShowFog( final int par1, final int par2 )
@Override
public DimensionType getDimensionType()
{
return AppEng.instance().getRegistration().getStorageDimensionType();
return AppEng.instance().getStorageDimensionType();

This comment has been minimized.

@yueh

yueh Aug 9, 2017

Member

Also API candidate.

@yueh

yueh Aug 9, 2017

Member

Also API candidate.

@@ -268,7 +237,7 @@ private void customizeForClient( BlockRenderingCustomizer callback )
if( block instanceof AEBaseTileBlock )
{
this.factory.addPreInit( side ->
this.factory.addBootstrapComponent( (IPreInitComponent) side ->
{

This comment has been minimized.

@orod-org

orod-org Aug 11, 2017

MINOR Remove useless curly braces around statement rule

@orod-org

orod-org Aug 11, 2017

MINOR Remove useless curly braces around statement rule

{
( (BlockCableBus) block ).setupTile();
} )
// TODO: why the custom registration?

This comment has been minimized.

@orod-org

orod-org Aug 11, 2017

INFO Complete the task associated to this TODO comment. rule

@orod-org

orod-org Aug 11, 2017

INFO Complete the task associated to this TODO comment. rule

{
this.bootstrapComponents.add( component );
Arrays.stream( component.getClass().getInterfaces() )
.filter( i -> IBootstrapComponent.class.isAssignableFrom( i ) )

This comment has been minimized.

@orod-org

orod-org Aug 11, 2017

MINOR Replace this lambda with a method reference. rule

@orod-org

orod-org Aug 11, 2017

MINOR Replace this lambda with a method reference. rule

@orod-org

This comment has been minimized.

Show comment
Hide comment
@orod-org

orod-org Aug 11, 2017

SonarQube analysis reported 43 issues

  • BLOCKER 4 blocker
  • CRITICAL 5 critical
  • MAJOR 9 major
  • MINOR 22 minor
  • INFO 3 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. BLOCKER IBlockRegistrationComponent.java: Add or update the header of this file. rule
  2. BLOCKER IItemRegistrationComponent.java: Add or update the header of this file. rule
  3. BLOCKER IRecipeRegistrationComponent.java: Add or update the header of this file. rule
  4. BLOCKER IC2.java: Add or update the header of this file. rule
  5. CRITICAL BlockDefinitionBuilder.java#L180: The Cyclomatic Complexity of this method "build" is 12 which is greater than 10 authorized. rule
  6. CRITICAL ApiBlocks.java#L284: Define a constant instead of duplicating this literal "sky_stone_chest" 3 times. rule
  7. CRITICAL ApiBlocks.java#L343: Define a constant instead of duplicating this literal "quantum_ring" 3 times. rule
  8. CRITICAL ApiBlocks.java#L428: Define a constant instead of duplicating this literal "crafting_unit" 4 times. rule
  9. CRITICAL ApiBlocks.java#L440: Define a constant instead of duplicating this literal "crafting_storage" 4 times. rule
  10. MAJOR Registration.java#L240: This block of commented-out lines of code should be removed. rule

orod-org commented Aug 11, 2017

SonarQube analysis reported 43 issues

  • BLOCKER 4 blocker
  • CRITICAL 5 critical
  • MAJOR 9 major
  • MINOR 22 minor
  • INFO 3 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. BLOCKER IBlockRegistrationComponent.java: Add or update the header of this file. rule
  2. BLOCKER IItemRegistrationComponent.java: Add or update the header of this file. rule
  3. BLOCKER IRecipeRegistrationComponent.java: Add or update the header of this file. rule
  4. BLOCKER IC2.java: Add or update the header of this file. rule
  5. CRITICAL BlockDefinitionBuilder.java#L180: The Cyclomatic Complexity of this method "build" is 12 which is greater than 10 authorized. rule
  6. CRITICAL ApiBlocks.java#L284: Define a constant instead of duplicating this literal "sky_stone_chest" 3 times. rule
  7. CRITICAL ApiBlocks.java#L343: Define a constant instead of duplicating this literal "quantum_ring" 3 times. rule
  8. CRITICAL ApiBlocks.java#L428: Define a constant instead of duplicating this literal "crafting_unit" 4 times. rule
  9. CRITICAL ApiBlocks.java#L440: Define a constant instead of duplicating this literal "crafting_storage" 4 times. rule
  10. MAJOR Registration.java#L240: This block of commented-out lines of code should be removed. rule

@yueh yueh merged commit 95b48b9 into AppliedEnergistics:rv5-1.12 Aug 12, 2017

2 of 3 checks passed

sonarqube SonarQube reported 43 issues, with 5 critical and 4 blocker
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins Success
Details

@yueh yueh added this to the rv5.alpha - 1.12 milestone Aug 12, 2017

yueh added a commit that referenced this pull request Aug 12, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment