本文整理汇总了Java中li.cil.oc.api.driver.Item类的典型用法代码示例。如果您正苦于以下问题:Java Item类的具体用法?Java Item怎么用?Java Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Item类属于li.cil.oc.api.driver包,在下文中一共展示了Item类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: recomputeMemory
import li.cil.oc.api.driver.Item; //导入依赖的package包/类
public boolean recomputeMemory(Iterable<ItemStack> components) {
numMappedRamBanks = 0;
ramTier = 3;
for(ItemStack stack : components) {
Item driver = Driver.driverFor(stack);
if(driver instanceof li.cil.oc.api.driver.item.Memory) {
double amount = ((li.cil.oc.api.driver.item.Memory)driver).amount(stack);
int tier = (int)Math.floor(amount);
if(tier < 0) tier = 0;
else if(tier > 2) tier = 2;
if(tier < ramTier) ramTier = tier;
numMappedRamBanks += MainClass.instance.getMemoryModuleBankCount(amount);
}
else if(driver instanceof Processor) {
cpuTier = driver.tier(stack);
parent.cpuCyclesPerTick = MainClass.instance.getCPUCyclesPerTick(cpuTier);
}
}
if(numMappedRamBanks > 0x1FFF) numMappedRamBanks = 0x1FFF;
remapMemory();
return true;
}
示例2: add
import li.cil.oc.api.driver.Item; //导入依赖的package包/类
/**
* Registers a new item driver.
* <p/>
* Item components can inserted into a computers component slots. They have
* to specify their type, to determine into which slots they can fit.
* <p/>
* This must be called in the init phase, <em>not</em> the pre- or post-init
* phases.
*
* @param driver the driver to register.
*/
public static void add(final Item driver) {
if (API.driver != null)
API.driver.add(driver);
}
示例3: driverFor
import li.cil.oc.api.driver.Item; //导入依赖的package包/类
/**
* Looks up a driver for the specified item stack.
* <p/>
* Note that unlike for blocks, there can always only be one item driver
* per item. If there are multiple ones, the first one that was registered
* will be used.
*
* @param stack the item stack to get a driver for.
* @param host the type that will host the environment created by returned driver.
* @return a driver for the item, or <tt>null</tt> if there is none.
*/
public static Item driverFor(ItemStack stack, Class<? extends EnvironmentHost> host) {
if (API.driver != null)
return API.driver.driverFor(stack, host);
return null;
}
示例4: itemDrivers
import li.cil.oc.api.driver.Item; //导入依赖的package包/类
/**
* Get a list of all registered item drivers.
* <p/>
* This is intended to allow checking for particular drivers using more
* customized logic.
* <p/>
* The returned collection is read-only.
*
* @return the list of all registered item drivers.
*/
public static Collection<Item> itemDrivers() {
if (API.driver != null)
return API.driver.itemDrivers();
return null;
}
示例5: add
import li.cil.oc.api.driver.Item; //导入依赖的package包/类
/**
* Registers a new driver for an item component.
* <p/>
* Item components can inserted into a computers component slots. They have
* to specify their type, to determine into which slots they can fit.
* <p/>
* This must be called in the init phase, <em>not</em> the pre- or post-init
* phases.
*
* @param driver the driver for an item component.
*/
void add(Item driver);
示例6: driverFor
import li.cil.oc.api.driver.Item; //导入依赖的package包/类
/**
* Looks up a driver for the specified item stack.
* <p/>
* Note that unlike for blocks, there can always only be one item driver
* per item. If there are multiple ones, the first one that was registered
* will be used.
*
* @param stack the item stack to get a driver for.
* @param host the type that will host the environment created by returned driver.
* @return a driver for the item, or <tt>null</tt> if there is none.
*/
Item driverFor(ItemStack stack, Class<? extends EnvironmentHost> host);
示例7: itemDrivers
import li.cil.oc.api.driver.Item; //导入依赖的package包/类
/**
* Get a list of all registered item drivers.
* <p/>
* This is intended to allow checking for particular drivers using more
* customized logic.
* <p/>
* The returned collection is read-only.
*
* @return the list of all registered item drivers.
*/
Collection<Item> itemDrivers();
示例8: itemDrivers
import li.cil.oc.api.driver.Item; //导入依赖的package包/类
/**
* Get a list of all registered item drivers.
* <p/>
* This is intended to allow checking for particular drivers using more
* customized logic, and in particular to check for drivers with the
* {@link li.cil.oc.api.driver.EnvironmentAware} interface.
* <p/>
* The returned collection is read-only.
*
* @return the list of all registered item drivers.
*/
public static Collection<Item> itemDrivers() {
if (API.driver != null)
return API.driver.itemDrivers();
return null;
}
示例9: itemDrivers
import li.cil.oc.api.driver.Item; //导入依赖的package包/类
/**
* Get a list of all registered item drivers.
* <p/>
* This is intended to allow checking for particular drivers using more
* customized logic, and in particular to check for drivers with the
* {@link li.cil.oc.api.driver.EnvironmentAware} interface.
*
* @return the list of all registered item drivers.
*/
Collection<Item> itemDrivers();