blob: 842c1b33bce86456d438ee50c5c7bc9910846e2c [file] [log] [blame] [raw]
package li.cil.oc.api.driver;
import net.minecraft.item.ItemStack;
/**
* Environment providers allow OpenComputers to resolve item stacks to the
* environments generated by the block or item component of the stack.
* <p/>
* This is mainly used in OpenComputers' NEI usage handler for displaying
* a component's API.
*/
public interface EnvironmentProvider {
/**
* Get the environment provided by the specified stack.
* <p/>
* For blocks this will usually be the tile entity. In particular, for
* {@link li.cil.oc.api.network.SimpleComponent}s this allows returning
* an arbitrary class type instead of an environment type, since the
* {@link li.cil.oc.api.network.Environment} interface will be injected
* by the class transformer at runtime.
* <p/>
* For items this will be the type of the environment returned by the
* item driver's {@link Item#createEnvironment} method.
*
* @param stack the stack to get the environment type for.
* @return the environment type for the specified stack.
*/
Class<?> getEnvironment(ItemStack stack);
}