Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c908c7404 | |||
| 65aceeffa8 | |||
| 08505e1fa3 | |||
| b75e8d5824 | |||
| fbda2c571b | |||
| 67d9a48d75 | |||
| 371588ed79 |
@@ -27,13 +27,13 @@ task devJar(type: Jar) {
|
||||
}
|
||||
|
||||
task apiJar(type: Jar) {
|
||||
from sourceSets.api.java
|
||||
include "appeng/api/**"
|
||||
|
||||
from(sourceSets.api.java) {
|
||||
include "appeng/api/**"
|
||||
}
|
||||
from sourceSets.main.output
|
||||
include "appeng/api/**"
|
||||
|
||||
classifier = 'api'
|
||||
|
||||
}
|
||||
|
||||
artifacts {
|
||||
|
||||
@@ -52,13 +52,13 @@ dependencies {
|
||||
compile(group: 'api', name: 'ic2', version: "${config.api_ic2_version}")
|
||||
compile(group: 'api', name: 'immibis', version: "${config.api_immibis_version}")
|
||||
compile(group: 'api', name: 'invtweaks', version: "${config.api_invtweaks_version}")
|
||||
compile(group: 'api', name: 'mekanism', version: "${config.api_mekansim_version}", classifier: 'api')
|
||||
compile(group: 'api', name: 'mfr', version: "${config.api_mfr_version}")
|
||||
compile(group: 'api', name: 'railcraft', version: "${config.api_railcraft_version}")
|
||||
compile(group: 'api', name: 'rblocks', version: "${config.api_rblocks_version}")
|
||||
compile(group: 'api', name: 'rf', version: "${config.api_rf_version}")
|
||||
compile "appeng:Waila:${config.api_waila_version}:api"
|
||||
compile "appeng:RotaryCraft:${config.api_rotarycraft_version}:api"
|
||||
compile "appeng:mekanism:${config.api_mekansim_version}:api"
|
||||
|
||||
testCompile "junit:junit:4.11"
|
||||
}
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
package appeng.api;
|
||||
|
||||
|
||||
import appeng.api.exceptions.CouldNotAccessCoreAPI;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import appeng.api.exceptions.CoreInaccessibleException;
|
||||
|
||||
|
||||
/**
|
||||
@@ -35,34 +37,42 @@ import appeng.api.exceptions.CouldNotAccessCoreAPI;
|
||||
public enum AEApi
|
||||
{
|
||||
;
|
||||
private static final String CORE_API_PATH = "appeng.core.Api";
|
||||
private static final String API_INSTANCE_NAME = "INSTANCE";
|
||||
|
||||
private static IAppEngApi instance = null;
|
||||
private static final String CORE_API_FQN = "appeng.core.Api";
|
||||
private static final String CORE_API_FIELD = "INSTANCE";
|
||||
private static final IAppEngApi HELD_API;
|
||||
|
||||
static
|
||||
{
|
||||
try
|
||||
{
|
||||
final Class<?> apiClass = Class.forName( CORE_API_FQN );
|
||||
final Field apiField = apiClass.getField( CORE_API_FIELD );
|
||||
|
||||
HELD_API = (IAppEngApi) apiField.get( apiClass );
|
||||
}
|
||||
catch ( ClassNotFoundException e )
|
||||
{
|
||||
throw new CoreInaccessibleException( "AE2 API tried to access the " + CORE_API_FQN + " class, without it being declared." );
|
||||
}
|
||||
catch ( NoSuchFieldException e )
|
||||
{
|
||||
throw new CoreInaccessibleException( "AE2 API tried to access the " + CORE_API_FIELD + " field in " + CORE_API_FQN + " without it being declared." );
|
||||
}
|
||||
catch ( IllegalAccessException e )
|
||||
{
|
||||
throw new CoreInaccessibleException( "AE2 API tried to access the " + CORE_API_FIELD + " field in " + CORE_API_FQN + " without enough access permissions.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API Entry Point.
|
||||
*
|
||||
* @return the {@link IAppEngApi}
|
||||
*
|
||||
* @throws CouldNotAccessCoreAPI if the INSTANCE could not be retrieved
|
||||
*/
|
||||
public static IAppEngApi instance()
|
||||
|
||||
{
|
||||
if ( instance == null )
|
||||
{
|
||||
try
|
||||
{
|
||||
Class<?> c = Class.forName( CORE_API_PATH );
|
||||
instance = (IAppEngApi) c.getField( API_INSTANCE_NAME ).get( c );
|
||||
}
|
||||
catch ( Throwable e )
|
||||
{
|
||||
throw new CouldNotAccessCoreAPI( "Either core API was not in " + CORE_API_PATH + " or " + API_INSTANCE_NAME + " was not accessible" );
|
||||
}
|
||||
}
|
||||
|
||||
return instance;
|
||||
return HELD_API;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package appeng.api.exceptions;
|
||||
|
||||
|
||||
public class CoreInaccessibleException extends RuntimeException
|
||||
{
|
||||
public CoreInaccessibleException( String message )
|
||||
{
|
||||
super( message );
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package appeng.api.exceptions;
|
||||
|
||||
|
||||
public class CouldNotAccessCoreAPI extends RuntimeException
|
||||
{
|
||||
public CouldNotAccessCoreAPI( String message )
|
||||
{
|
||||
super( message );
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -79,6 +80,12 @@ public class BlockMatrixFrame extends AEBaseBlock implements ICustomCollision
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockExploded(World world, int x, int y, int z, Explosion explosion)
|
||||
{
|
||||
// Don't explode.
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
|
||||
this.facade = (ItemFacade) definitions.items().facade();
|
||||
this.facade = (ItemFacade) definitions.items().facade().maybeItem().get();
|
||||
this.anchorDefinition = definitions.parts().cableAnchor();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user