本文整理匯總了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 );
}