Compare commits

...

7 Commits

Author SHA1 Message Date
thatsIch 5c908c7404 Merge pull request #1130 from yueh/fix-1125
Prevent matrix frames from explosions.
2015-03-30 10:38:24 +02:00
thatsIch 65aceeffa8 Merge pull request #1134 from yueh/fix-newapi-nei-facade-handler
Fixes NEI recipe handler
2015-03-29 21:31:11 +02:00
thatsIch 08505e1fa3 Merge pull request #1065 from thatsIch/e-api-access
instance() does not return null anymore, since else it would represent catching a major bug
2015-03-29 21:02:41 +02:00
yueh b75e8d5824 Fixes NEI recipe handler
.get() is used as it is safe to assert facades are present at this point.
If not there should be an exception being thrown.
2015-03-29 15:51:22 +02:00
yueh fbda2c571b Prevent matrix frames from explosions.
Fixes #1125
2015-03-29 14:29:54 +02:00
thatsIch 67d9a48d75 API jars contain now classes and source files
Updated dependencies also use those
2015-03-29 09:40:27 +02:00
thatsIch 371588ed79 instance() does not return null anymore, since else it would represent catching a major bug
also does not catch any throwable anymore
2015-03-28 17:11:19 +01:00
7 changed files with 54 additions and 37 deletions
+4 -4
View File
@@ -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 {
+1 -1
View File
@@ -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"
}
+31 -21
View File
@@ -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();
}