当前位置: 首页>>代码示例>>Java>>正文


Java IAEItemStack.isCraftable方法代码示例

本文整理汇总了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;
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:22,代码来源:TileEntityMEBridge.java

示例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;
		}
	}
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:44,代码来源:GuiArcaneCraftingTerminal.java

示例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;
		}
	}
}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:14,代码来源:CraftingAspect_ItemWatcher.java

示例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);
}
 
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:4,代码来源:AdapterGridBase.java

示例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 );
	}

}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:59,代码来源:GridEssentiaCache.java


注:本文中的appeng.api.storage.data.IAEItemStack.isCraftable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。