Rename RSAPI to RSAPIInject

This commit is contained in:
Raoul Van den Berge
2016-10-09 16:03:54 +02:00
parent fab1b00dea
commit aded4c9408
4 changed files with 10 additions and 7 deletions

2
src/main/java/refinedstorage/api/IRSAPI.java Normal file → Executable file
View File

@@ -12,7 +12,7 @@ import javax.annotation.Nonnull;
/**
* Represents a Refined Storage API implementation.
* Delivered by the {@link RSAPI} annotation
* Delivered by the {@link RSAPIInject} annotation.
*/
public interface IRSAPI {
/**

View File

@@ -4,8 +4,8 @@ import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
/**
* Needs to implemented on a public static {@link IRSAPI} field
* Needs to be implemented on a public static {@link IRSAPI} field.
*/
@Target(ElementType.FIELD)
public @interface RSAPI {
public @interface RSAPIInject {
}

View File

@@ -4,7 +4,7 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.discovery.ASMDataTable;
import refinedstorage.api.IRSAPI;
import refinedstorage.api.RSAPI;
import refinedstorage.api.RSAPIInject;
import refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElementRegistry;
import refinedstorage.api.autocrafting.registry.ICraftingTaskRegistry;
import refinedstorage.api.solderer.ISoldererRegistry;
@@ -73,14 +73,18 @@ public class API implements IRSAPI {
}
public static void deliver(ASMDataTable asmDataTable) {
String annotationClassName = RSAPI.class.getCanonicalName();
String annotationClassName = RSAPIInject.class.getCanonicalName();
Set<ASMDataTable.ASMData> asmDataSet = asmDataTable.getAll(annotationClassName);
for (ASMDataTable.ASMData asmData : asmDataSet) {
try {
Class clazz = Class.forName(asmData.getClassName());
Field field = clazz.getField(asmData.getObjectName());
if (field.getType() == IRSAPI.class)
if (field.getType() == IRSAPI.class) {
field.set(null, INSTANCE);
}
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
throw new RuntimeException("Failed to set: {}" + asmData.getClassName() + "." + asmData.getObjectName(), e);
}

View File

@@ -1,7 +1,6 @@
package refinedstorage.tile;
import net.minecraft.item.ItemStack;
import refinedstorage.api.RSAPI;
import refinedstorage.apiimpl.API;
public class ClientNode {