本文整理汇总了Java中appeng.api.definitions.IItemDefinition类的典型用法代码示例。如果您正苦于以下问题:Java IItemDefinition类的具体用法?Java IItemDefinition怎么用?Java IItemDefinition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IItemDefinition类属于appeng.api.definitions包,在下文中一共展示了IItemDefinition类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initRecipes
import appeng.api.definitions.IItemDefinition; //导入依赖的package包/类
public static void initRecipes() {
int recipeCount = 0;
final IDefinitions definitions = AEApi.instance().definitions();
final ItemFacade facade = (ItemFacade) definitions.items().facade().maybeItem().get();
final IItemDefinition anchorDefinition = definitions.parts().cableAnchor();
final List<ItemStack> facades = facade.getFacades();
for (ItemStack anchorStack : anchorDefinition.maybeStack(1).asSet()) {
for (ItemStack is : facades) {
recipeCount++;
addItem(facade, anchorStack, is);
}
}
AELog.info("Told EE3 about " + recipeCount + " facade recipes...");
}
示例2: getAEItem
import appeng.api.definitions.IItemDefinition; //导入依赖的package包/类
/**
* Attempts to get the specified AE item.
* Returns a stack of size 1, or null.
*
* @param def
* @return
*/
private ItemStack getAEItem( final IItemDefinition def )
{
// Ensure there is a definition
if( def == null )
{
return null;
}
// Attempt to get a stack
Optional<ItemStack> item = def.maybeStack( 1 );
// Was a stack retrieved?
if( item.isPresent() )
{
// Return the stack
return item.get();
}
// Stack was not retrieved
return null;
}
示例3: getItemOrAlt
import appeng.api.definitions.IItemDefinition; //导入依赖的package包/类
/**
* Gets an AE item, or if unavailable sets the item to the specified
* alternative.
*
* @param def
* @param alt
* @return
*/
private Object getItemOrAlt( final IItemDefinition def, final Object alt )
{
ItemStack defItem = this.getAEItem( def );
return( defItem == null ? alt : defItem );
}