本文整理汇总了Java中appeng.api.storage.data.IAEItemStack.isCraftable方法的典型用法代码示例。如果您正苦于以下问题:Java IAEItemStack.isCraftable方法的具体用法?Java IAEItemStack.isCraftable怎么用?Java IAEItemStack.isCraftable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类appeng.api.storage.data.IAEItemStack
的用法示例。
在下文中一共展示了IAEItemStack.isCraftable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getObjectFromStack
import appeng.api.storage.data.IAEItemStack; //导入方法依赖的package包/类
private Object getObjectFromStack(IAEItemStack stack, int flag) {
HashMap<String, Object> map = new HashMap<String, Object>();
String itemName = Item.itemRegistry.getNameForObject(stack.getItem());
int meta = stack.getItemDamage();
long amount = stack.getStackSize();
String displayName = stack.getItemStack().getDisplayName();
map.put("name", itemName);
map.put("meta", meta);
map.put("amount", amount);
map.put("displayName", displayName);
if (flag == 0) {
return map;
} else if (flag == 1) {
if (stack.getStackSize() > 0)
return map;
} else if (flag == 2) {
if (stack.isCraftable())
return map;
}
return null;
}
示例2: sendItemWidgetClicked
import appeng.api.storage.data.IAEItemStack; //导入方法依赖的package包/类
/**
* If the user has clicked on an item widget this will inform the server
* so that the item can be extracted from the AE network.
*
* @param mouseX
* @param mouseY
* @param mouseButton
*/
private void sendItemWidgetClicked( final int mouseX, final int mouseY, final int mouseButton )
{
for( int index = 0; index < this.widgetCount; ++index )
{
// Get the widget
WidgetAEItem currentWidget = this.itemWidgets.get( index );
// Is the mouse over this widget
if( currentWidget.isMouseOverWidget( mouseX, mouseY ) )
{
// Get the AE itemstack this widget represents
IAEItemStack widgetStack = currentWidget.getItemStack();
// Did we get an item?
if( widgetStack != null )
{
// Should the item be crafted?
if( ( widgetStack.getStackSize() == 0 ) || ( mouseButton == ThEGuiHelper.MOUSE_BUTTON_WHEEL ) )
{
if( ( widgetStack.isCraftable() ) && ( mouseButton != ThEGuiHelper.MOUSE_BUTTON_RIGHT ) )
{
Packet_S_ArcaneCraftingTerminal.sendAutoCraft( this.player, widgetStack );
return;
}
}
// Let the server know the user is requesting an itemstack.
Packet_S_ArcaneCraftingTerminal.sendExtract( this.player, widgetStack, mouseButton, GuiScreen.isShiftKeyDown() );
}
// Stop searching
return;
}
}
}
示例3: postChange
import appeng.api.storage.data.IAEItemStack; //导入方法依赖的package包/类
@Override
public void postChange( final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change, final BaseActionSource actionSource )
{
for( IAEItemStack stack : change )
{
// Is the stack craftable, has NBT tag, and is a crafting aspect?
if( stack.isCraftable() && stack.hasTagCompound() && ( stack.getItem() instanceof ItemCraftingAspect ) )
{
this.gridCache.markForUpdate();
break;
}
}
}
示例4: compareToAEStack
import appeng.api.storage.data.IAEItemStack; //导入方法依赖的package包/类
protected static boolean compareToAEStack(ItemFingerprint needle, IAEItemStack hayStack, boolean craftable) {
return (hayStack.isCraftable() == craftable) && compareToAEStack(needle, hayStack);
}
示例5: updateCacheToMatchNetwork
import appeng.api.storage.data.IAEItemStack; //导入方法依赖的package包/类
/**
* Add in any craftable aspects
*/
@Override
protected void updateCacheToMatchNetwork()
{
// Call super
super.updateCacheToMatchNetwork();
// Is the network powered?
if( !this.energyGrid.isNetworkPowered() )
{
return;
}
// Get the item monitor
IStorageGrid storage = (IStorageGrid)this.internalGrid.getCache( IStorageGrid.class );
IMEMonitor<IAEItemStack> itemMonitor = storage.getItemInventory();
// Get stored items
IItemList<IAEItemStack> storedItems = itemMonitor.getStorageList();
if( ( storedItems == null ) || ( storedItems.size() == 0 ) )
{
return;
}
// Create the aspect list
HashSet<Aspect> craftableAspects = new HashSet<Aspect>();
// Check each item for craftability and type
for( IAEItemStack stack : storedItems )
{
if( stack == null )
{
continue;
}
// Is the stack craftable, has NBT tag, and is a crafting aspect?
if( stack.isCraftable() && stack.hasTagCompound() && ( stack.getItem() instanceof ItemCraftingAspect ) )
{
// Get the aspect
Aspect aspect = ItemCraftingAspect.getAspect( stack.getTagCompound().getNBTTagCompoundCopy() );
if( aspect != null )
{
// Add the aspect
craftableAspects.add( aspect );
}
}
}
// Anything added?
if( craftableAspects.size() > 0 )
{
this.setCraftableAspects( craftableAspects );
}
}