Format sourcecode

This commit is contained in:
yueh
2017-07-20 21:17:10 +02:00
parent 66437897be
commit 621910df91
295 changed files with 2142 additions and 1562 deletions
+23 -16
View File
@@ -64,28 +64,35 @@ import appeng.tile.networking.TileCableBus;
public class ApiPart implements IPartHelper
{
private final LoadingCache<CacheKey, Class<? extends AEBaseTile>> cache = CacheBuilder.newBuilder().build( new CacheLoader<CacheKey, Class<? extends AEBaseTile>>()
{
@Override
public Class<? extends AEBaseTile> load( CacheKey key ) throws Exception
{
return generateCombinedClass( key );
}
} );
private final LoadingCache<CacheKey, Class<? extends AEBaseTile>> cache = CacheBuilder.newBuilder()
.build( new CacheLoader<CacheKey, Class<? extends AEBaseTile>>()
{
@Override
public Class<? extends AEBaseTile> load( CacheKey key ) throws Exception
{
return generateCombinedClass( key );
}
} );
private final Map<Class<?>, String> interfaces2Layer = new HashMap<>();
private final List<String> desc = new LinkedList<String>();
/**
* Conceptually this method will build a new class hierarchy that is rooted at the given base class, and includes a chain of all registered layers.
* Conceptually this method will build a new class hierarchy that is rooted at the given base class, and includes a
* chain of all registered layers.
* <p/>
* To accomplish this, it takes the first registered layer, replaces it's inheritance from LayerBase with an inheritance from the given baseClass,
* and uses the resulting class as the parent class for the next registered layer, for which it repeats this process. This process is then repeated
* until a class hierarchy of all layers is formed. While janking out the inheritance from LayerBase, it'll make also sure that calls to that
* To accomplish this, it takes the first registered layer, replaces it's inheritance from LayerBase with an
* inheritance from the given baseClass,
* and uses the resulting class as the parent class for the next registered layer, for which it repeats this
* process. This process is then repeated
* until a class hierarchy of all layers is formed. While janking out the inheritance from LayerBase, it'll make
* also sure that calls to that
* classes method will instead be forwarded to the superclass that was inserted as part of the described process.
* <p/>
* Example: If layers A and B are registered, and TileCableBus is passed in as the baseClass, a synthetic class A_B_TileCableBus should be returned,
* which has A_B_TileCableBus -extends-> B_TileCableBus -extends-> TileCableBus as it's class hierarchy, where A_B_TileCableBus has been generated
* Example: If layers A and B are registered, and TileCableBus is passed in as the baseClass, a synthetic class
* A_B_TileCableBus should be returned,
* which has A_B_TileCableBus -extends-> B_TileCableBus -extends-> TileCableBus as it's class hierarchy, where
* A_B_TileCableBus has been generated
* from A, and B_TileCableBus has been generated from B.
*/
public Class<? extends AEBaseTile> getCombinedInstance( final Class<? extends AEBaseTile> baseClass )
@@ -122,7 +129,8 @@ public class ApiPart implements IPartHelper
try
{
// This is the particular interface that this layer was registered for. Loading the class may fail if i.e. an API is broken or not present
// This is the particular interface that this layer was registered for. Loading the class may fail if i.e.
// an API is broken or not present
// and in this case, the layer will be skipped!
Class<?> interfaceClass = Class.forName( interfaceName );
String layerImpl = this.interfaces2Layer.get( interfaceClass );
@@ -348,7 +356,6 @@ public class ApiPart implements IPartHelper
}
}
private static class CacheKey
{
private final Class<? extends AEBaseTile> baseClass;
@@ -155,6 +155,7 @@ import appeng.decorative.solid.BlockSkyStone.SkystoneType;
import appeng.decorative.stair.BlockStairCommon;
import appeng.hooks.DispenserBehaviorTinyTNT;
/**
* Internal implementation for the API blocks
*/
@@ -397,7 +398,7 @@ public final class ApiBlocks implements IBlocks
.build();
this.condenser = registry.block( "condenser", BlockCondenser::new )
.features( AEFeature.CONDENSER )
.tileEntity( new TileEntityDefinition( TileCondenser.class ) )
.tileEntity( new TileEntityDefinition( TileCondenser.class ) )
.build();
this.energyAcceptor = registry.block( "energy_acceptor", BlockEnergyAcceptor::new )
.features( AEFeature.ENERGY_ACCEPTOR )
@@ -515,17 +516,17 @@ public final class ApiBlocks implements IBlocks
this.itemGen = registry.block( "debug_item_gen", BlockItemGen::new )
.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
.tileEntity( new TileEntityDefinition ( TileItemGen.class ) )
.tileEntity( new TileEntityDefinition( TileItemGen.class ) )
.useCustomItemModel()
.build();
this.chunkLoader = registry.block( "debug_chunk_loader", BlockChunkloader::new )
.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
.tileEntity( new TileEntityDefinition ( TileChunkLoader.class ) )
.tileEntity( new TileEntityDefinition( TileChunkLoader.class ) )
.useCustomItemModel()
.build();
this.phantomNode = registry.block( "debug_phantom_node", BlockPhantomNode::new )
.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
.tileEntity( new TileEntityDefinition ( TilePhantomNode.class ) )
.tileEntity( new TileEntityDefinition( TilePhantomNode.class ) )
.useCustomItemModel()
.build();
this.cubeGenerator = registry.block( "debug_cube_gen", BlockCubeGenerator::new )
@@ -137,15 +137,21 @@ public final class ApiMaterials implements IMaterials
this.silicon = new DamagedItemDefinition( "material.silicon", materials.createMaterial( MaterialType.SILICON ) );
this.skyDust = new DamagedItemDefinition( "material.dust.sky_stone", materials.createMaterial( MaterialType.SKY_DUST ) );
this.calcProcessorPress = new DamagedItemDefinition( "material.press.processor.calculation", materials.createMaterial( MaterialType.CALCULATION_PROCESSOR_PRESS ) );
this.engProcessorPress = new DamagedItemDefinition( "material.press.processor.engineering", materials.createMaterial( MaterialType.ENGINEERING_PROCESSOR_PRESS ) );
this.logicProcessorPress = new DamagedItemDefinition( "material.press.processor.logic", materials.createMaterial( MaterialType.LOGIC_PROCESSOR_PRESS ) );
this.calcProcessorPress = new DamagedItemDefinition( "material.press.processor.calculation", materials
.createMaterial( MaterialType.CALCULATION_PROCESSOR_PRESS ) );
this.engProcessorPress = new DamagedItemDefinition( "material.press.processor.engineering", materials
.createMaterial( MaterialType.ENGINEERING_PROCESSOR_PRESS ) );
this.logicProcessorPress = new DamagedItemDefinition( "material.press.processor.logic", materials
.createMaterial( MaterialType.LOGIC_PROCESSOR_PRESS ) );
this.siliconPress = new DamagedItemDefinition( "material.press.silicon", materials.createMaterial( MaterialType.SILICON_PRESS ) );
this.namePress = new DamagedItemDefinition( "material.press.name", materials.createMaterial( MaterialType.NAME_PRESS ) );
this.calcProcessorPrint = new DamagedItemDefinition( "material.print.processor.calculation", materials.createMaterial( MaterialType.CALCULATION_PROCESSOR_PRINT ) );
this.engProcessorPrint = new DamagedItemDefinition( "material.print.processor.engineering", materials.createMaterial( MaterialType.ENGINEERING_PROCESSOR_PRINT ) );
this.logicProcessorPrint = new DamagedItemDefinition( "material.print.processor.logic", materials.createMaterial( MaterialType.LOGIC_PROCESSOR_PRINT ) );
this.calcProcessorPrint = new DamagedItemDefinition( "material.print.processor.calculation", materials
.createMaterial( MaterialType.CALCULATION_PROCESSOR_PRINT ) );
this.engProcessorPrint = new DamagedItemDefinition( "material.print.processor.engineering", materials
.createMaterial( MaterialType.ENGINEERING_PROCESSOR_PRINT ) );
this.logicProcessorPrint = new DamagedItemDefinition( "material.print.processor.logic", materials
.createMaterial( MaterialType.LOGIC_PROCESSOR_PRINT ) );
this.siliconPrint = new DamagedItemDefinition( "material.print.silicon", materials.createMaterial( MaterialType.SILICON_PRINT ) );
this.logicProcessor = new DamagedItemDefinition( "material.processor.logic", materials.createMaterial( MaterialType.LOGIC_PROCESSOR ) );
@@ -155,9 +161,12 @@ public final class ApiMaterials implements IMaterials
this.basicCard = new DamagedItemDefinition( "material.card.basic", materials.createMaterial( MaterialType.BASIC_CARD ) );
this.advCard = new DamagedItemDefinition( "material.card.advanced", materials.createMaterial( MaterialType.ADVANCED_CARD ) );
this.purifiedCertusQuartzCrystal = new DamagedItemDefinition( "material.crystal.quartz.certus.purified", materials.createMaterial( MaterialType.PURIFIED_CERTUS_QUARTZ_CRYSTAL ) );
this.purifiedNetherQuartzCrystal = new DamagedItemDefinition( "material.crystal.quartz.nether.purified", materials.createMaterial( MaterialType.PURIFIED_NETHER_QUARTZ_CRYSTAL ) );
this.purifiedFluixCrystal = new DamagedItemDefinition( "material.crystal.fluix.purified", materials.createMaterial( MaterialType.PURIFIED_FLUIX_CRYSTAL ) );
this.purifiedCertusQuartzCrystal = new DamagedItemDefinition( "material.crystal.quartz.certus.purified", materials
.createMaterial( MaterialType.PURIFIED_CERTUS_QUARTZ_CRYSTAL ) );
this.purifiedNetherQuartzCrystal = new DamagedItemDefinition( "material.crystal.quartz.nether.purified", materials
.createMaterial( MaterialType.PURIFIED_NETHER_QUARTZ_CRYSTAL ) );
this.purifiedFluixCrystal = new DamagedItemDefinition( "material.crystal.fluix.purified", materials
.createMaterial( MaterialType.PURIFIED_FLUIX_CRYSTAL ) );
this.cell1kPart = new DamagedItemDefinition( "material.cell.storage.1k", materials.createMaterial( MaterialType.CELL1K_PART ) );
this.cell4kPart = new DamagedItemDefinition( "material.cell.storage.4k", materials.createMaterial( MaterialType.CELL4K_PART ) );
@@ -182,8 +191,10 @@ public final class ApiMaterials implements IMaterials
this.matterBall = new DamagedItemDefinition( "material.ammo.matter_ball", materials.createMaterial( MaterialType.MATTER_BALL ) );
this.certusQuartzCrystal = new DamagedItemDefinition( "material.crystal.quartz.certus", materials.createMaterial( MaterialType.CERTUS_QUARTZ_CRYSTAL ) );
this.certusQuartzCrystalCharged = new DamagedItemDefinition( "material.crystal.quartz.certus.charged", materials.createMaterial( MaterialType.CERTUS_QUARTZ_CRYSTAL_CHARGED ) );
this.certusQuartzCrystal = new DamagedItemDefinition( "material.crystal.quartz.certus", materials
.createMaterial( MaterialType.CERTUS_QUARTZ_CRYSTAL ) );
this.certusQuartzCrystalCharged = new DamagedItemDefinition( "material.crystal.quartz.certus.charged", materials
.createMaterial( MaterialType.CERTUS_QUARTZ_CRYSTAL_CHARGED ) );
this.fluixCrystal = new DamagedItemDefinition( "material.crystal.fluix", materials.createMaterial( MaterialType.FLUIX_CRYSTAL ) );
this.fluixPearl = new DamagedItemDefinition( "material.pearl.fluix", materials.createMaterial( MaterialType.FLUIX_PEARL ) );
@@ -196,7 +207,8 @@ public final class ApiMaterials implements IMaterials
this.formationCore = new DamagedItemDefinition( "material.core.formation", materials.createMaterial( MaterialType.FORMATION_CORE ) );
this.singularity = new DamagedItemDefinition( "material.singularity", materials.createMaterial( MaterialType.SINGULARITY ) );
this.qESingularity = new DamagedItemDefinition( "material.singularity.entangled.quantum", materials.createMaterial( MaterialType.QUANTUM_ENTANGLED_SINGULARITY ) );
this.qESingularity = new DamagedItemDefinition( "material.singularity.entangled.quantum", materials
.createMaterial( MaterialType.QUANTUM_ENTANGLED_SINGULARITY ) );
this.blankPattern = new DamagedItemDefinition( "material.pattern.blank", materials.createMaterial( MaterialType.BLANK_PATTERN ) );
}
@@ -108,7 +108,8 @@ public final class ApiParts implements IParts
this.iface = new DamagedItemDefinition( "part.interface", itemPart.createPart( PartType.INTERFACE ) );
this.levelEmitter = new DamagedItemDefinition( "part.level_emitter", itemPart.createPart( PartType.LEVEL_EMITTER ) );
this.annihilationPlane = new DamagedItemDefinition( "part.plane.annihilation", itemPart.createPart( PartType.ANNIHILATION_PLANE ) );
this.identityAnnihilationPlane = new DamagedItemDefinition( "part.plane.annihiliation.identity", itemPart.createPart( PartType.IDENTITY_ANNIHILATION_PLANE ) );
this.identityAnnihilationPlane = new DamagedItemDefinition( "part.plane.annihiliation.identity", itemPart
.createPart( PartType.IDENTITY_ANNIHILATION_PLANE ) );
this.formationPlane = new DamagedItemDefinition( "part.plane.formation", itemPart.createPart( PartType.FORMATION_PLANE ) );
this.p2PTunnelME = new DamagedItemDefinition( "part.tunnel.me", itemPart.createPart( PartType.P2P_TUNNEL_ME ) );
this.p2PTunnelRedstone = new DamagedItemDefinition( "part.tunnel.redstone", itemPart.createPart( PartType.P2P_TUNNEL_REDSTONE ) );