Removed AEApi
Moved all internal access to the internal `Api` class using a new static getter.
This commit is contained in:
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013 AlgorithmX2
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package appeng.api;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import appeng.api.exceptions.CoreInaccessibleException;
|
||||
|
||||
/**
|
||||
* Entry point for api.
|
||||
*/
|
||||
public enum AEApi {
|
||||
;
|
||||
|
||||
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 (final ClassNotFoundException e) {
|
||||
throw new CoreInaccessibleException(
|
||||
"AE2 API tried to access the " + CORE_API_FQN + " class, without it being declared.");
|
||||
} catch (final NoSuchFieldException e) {
|
||||
throw new CoreInaccessibleException("AE2 API tried to access the " + CORE_API_FIELD + " field in "
|
||||
+ CORE_API_FQN + " without it being declared.");
|
||||
} catch (final 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}
|
||||
*/
|
||||
public static IAppEngApi instance() {
|
||||
return HELD_API;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.api;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Marks interfaces that can be used as injectable constructor arguments for an
|
||||
* {@link AEAddon}.
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface AEInjectable {
|
||||
}
|
||||
@@ -31,7 +31,6 @@ import appeng.api.parts.IPartHelper;
|
||||
import appeng.api.storage.IStorageHelper;
|
||||
import appeng.api.util.IClientHelper;
|
||||
|
||||
@AEInjectable
|
||||
public interface IAppEngApi {
|
||||
/**
|
||||
* @return Registry Container for the numerous registries in AE2.
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
package appeng.api.features;
|
||||
|
||||
import appeng.api.AEInjectable;
|
||||
import appeng.api.movable.IMovableRegistry;
|
||||
import appeng.api.networking.IGridCacheRegistry;
|
||||
import appeng.api.parts.IPartModels;
|
||||
@@ -36,7 +35,6 @@ import appeng.api.storage.ICellRegistry;
|
||||
* @version 7
|
||||
* @since rv0
|
||||
*/
|
||||
@AEInjectable
|
||||
public interface IRegistryContainer {
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,13 +23,10 @@ import java.util.Collection;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import appeng.api.AEInjectable;
|
||||
|
||||
/**
|
||||
* Allows registration of part models that can then be used in
|
||||
* {@link IPart#getStaticModels()}.
|
||||
*/
|
||||
@AEInjectable
|
||||
public interface IPartModels {
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user