f745e84d31
Final build for 1.4.7. *Cleaned up imports. *Added javadocs and cleaned up code. *API improvements and fixes. *Changed around packages and finalized API. *Fixed auto-download feature. *Removed UE implementation of multiblock, added my own. *Better Obsidian TNT code. *Better Atomic Assembler efficiency modes. *Made gas storage tanks more CPU efficient. *Better version control. *Added RecipeHelper for reflective implementations of recipes. *Reduced Osmium generation. *Fixed upgrade bug. *Pressurized Tube doesn't function when receiving a redstone signal. *Better Advanced Solar Generator code. *HP information for hoes. *Lowered chance of mobs spawning with armor. *InfuseRegistry for adding new infuse objects. *GasTransmission for external gas transmission.
32 lines
1.2 KiB
Java
32 lines
1.2 KiB
Java
package mekanism.api;
|
|
|
|
import java.lang.reflect.Field;
|
|
import java.util.HashMap;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
public class InfuseRegistry
|
|
{
|
|
/**
|
|
* Registers a block or item that serves as an infuse object. An infuse object will store a certain type and amount of infuse,
|
|
* and will deliver this amount to the Metallurgic Infuser's buffer of infuse. The item's stack size will be decremented when
|
|
* it is placed in the Metallurgic Infuser's infuse slot, and the machine can accept the type and amount of infuse stored in the
|
|
* object.
|
|
* @param itemStack - stack the infuse object is linked to -- stack size is ignored
|
|
* @param infuseObject - the infuse object with the type and amount data
|
|
* @return whether or not the registration was successful
|
|
*/
|
|
public boolean registerInfuseObject(ItemStack itemStack, InfuseObject infuseObject)
|
|
{
|
|
try {
|
|
Class c = Class.forName("mekanism.common.Mekanism");
|
|
Field field = c.getField("infusions");
|
|
HashMap<ItemStack, InfuseObject> map = (HashMap<ItemStack, InfuseObject>)field.get(null);
|
|
map.put(itemStack, infuseObject);
|
|
return true;
|
|
} catch(Exception e) {
|
|
System.err.println("[Mekanism] Error while adding infuse object: " + e.getMessage());
|
|
return false;
|
|
}
|
|
}
|
|
}
|