本文整理汇总了Java中appeng.api.storage.data.IAEItemStack类的典型用法代码示例。如果您正苦于以下问题:Java IAEItemStack类的具体用法?Java IAEItemStack怎么用?Java IAEItemStack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IAEItemStack类属于appeng.api.storage.data包,在下文中一共展示了IAEItemStack类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onRequestChange
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
@Optional.Method(modid = ModIds.AE2)
public void onRequestChange(ICraftingGrid grid, IAEItemStack aeStack){
craftingGrid = grid;
int freeSlot = -1;
for(int i = 0; i < getFilters().getSlots(); i++) {
ItemStack s = getFilters().getStackInSlot(i);
if(!s.isEmpty()) {
if(aeStack.isSameType(s)) {
s.setCount( (int) aeStack.getStackSize() );
return;
}
} else if(freeSlot == -1) {
freeSlot = i;
}
}
if(freeSlot >= 0) {
getFilters().setStackInSlot(freeSlot, aeStack.createItemStack());
}
}
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:21,代码来源:SemiBlockRequester.java
示例2: getAvailableItems
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@ScriptCallable(description = "Get a list of the stored and craftable items in the network.", returnTypes = ReturnType.TABLE)
public List<?> getAvailableItems(IGridHost host,
@Env(Constants.ARG_CONVERTER) IConverter converter,
@Optionals @Arg(name = "details", description = "Format of stored items details (defalt: none)") ItemDetails format) {
IStorageGrid storageGrid = getStorageGrid(host);
final IItemList<IAEItemStack> storageList = storageGrid.getItemInventory().getStorageList();
List<Object> result = Lists.newArrayList();
for (IAEItemStack stack : storageList) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>)converter.fromJava(stack);
if (format != null && format != ItemDetails.NONE) {
final ItemStack itemStack = stack.getItemStack();
if (format == ItemDetails.PROXY) map.put("item", OpcAccess.itemStackMetaBuilder.createProxy(itemStack));
else if (format == ItemDetails.ALL) map.put("item", itemStack);
}
result.add(map);
}
return result;
}
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:22,代码来源:AdapterNetwork.java
示例3: extractStack
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
/**
* Extracts items from the network.
*
* @param target
* @return Extracted stack.
*/
public ItemStack extractStack( final ItemStack target )
{
// Get the item monitor
IMEMonitor<IAEItemStack> monitor = this.getItemInventory();
if( monitor == null )
{
return null;
}
// Create the AE stack
IAEItemStack aeRequest = AEApi.instance().storage().createItemStack( target );
// Set size
aeRequest.setStackSize( Math.min( target.stackSize, this.maxItemRate ) );
// Extract
IAEItemStack extracted = AEApi.instance().storage().poweredExtraction( this.getEnergyGrid(), monitor, aeRequest, this.actionSource );
if( extracted == null )
{
return null;
}
return extracted.getItemStack();
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:31,代码来源:AIAENetworkGolem.java
示例4: sendExtract
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
/**
* Creates a packet letting the server know the user would like to
* extract the specified itemstack from the ME network.
*
* @param player
* @param itemStack
* @param mouseButton
* @return
*/
public static void sendExtract( final EntityPlayer player, final IAEItemStack itemStack, final int mouseButton,
final boolean isShiftHeld )
{
Packet_S_ArcaneCraftingTerminal packet = newPacket( player, MODE_REQUEST_EXTRACTION );
// Set stack
packet.itemStack = itemStack;
// Set mouse button
packet.mouseButton = mouseButton;
// Set shift
packet.isShiftHeld = isShiftHeld;
// Send it
NetworkHandler.sendPacketToServer( packet );
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:27,代码来源:Packet_S_ArcaneCraftingTerminal.java
示例5: 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
示例6: getCondensedInputs
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
public IAEItemStack[] getCondensedInputs()
{
// Create a temp array
ArrayList<IAEItemStack> cond = new ArrayList<IAEItemStack>();
if( this.ingredientsAE == null )
{
this.setupAEIngredientList();
}
// Add non-null ingredients
for( int index = 0; index < this.ingredientsAE.length; index++ )
{
if( this.ingredientsAE[index] != null )
{
cond.add( this.ingredientsAE[index] );
}
}
// Return the ingredients
return cond.toArray( new IAEItemStack[cond.size()] );
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:24,代码来源:ArcaneCraftingPattern.java
示例7: writeAEItemStack
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
/**
* Writes an AE itemstack to the stream.
*
* @param itemStack
* @param stream
*/
protected static void writeAEItemStack( final IAEItemStack itemStack, final ByteBuf stream )
{
// Do we have a valid stack?
if( itemStack != null )
{
// Write into the stream
try
{
itemStack.writeToPacket( stream );
}
catch( IOException e )
{
}
}
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:22,代码来源:ThEBasePacket.java
示例8: getItemInventory
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
public IMEMonitor<IAEItemStack> getItemInventory()
{
// Check connectivity
if( ( this.accessPoint == null ) || !this.isConnected() )
{
return null;
}
try
{
// Get the storage grid
IStorageGrid storageGrid = this.accessPoint.getActionableNode().getGrid().getCache( IStorageGrid.class );
// Return the monitor
return storageGrid.getItemInventory();
}
catch( Exception e )
{
// Ignored
}
return null;
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:25,代码来源:WirelessAELink.java
示例9: getStacksInItem
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
public void getStacksInItem(ItemStack stack, List<ItemStack> curStacks){
IMEInventoryHandler<IAEItemStack> cellInventoryHandler = cellRegistry.getCellInventory(stack, null, itemChannel);
if (cellInventoryHandler != null) {
IItemList<IAEItemStack> cellItemList = itemChannel.createList();
cellInventoryHandler.getAvailableItems(cellItemList);
for (IAEItemStack aeStack : cellItemList) {
ItemStack st = aeStack.createItemStack();
st.setCount((int) aeStack.getStackSize());
curStacks.add(st);
}
}
}
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:14,代码来源:AE2DiskInventoryItemHandler.java
示例10: updateProvidingItems
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Optional.Method(modid = ModIds.AE2)
private void updateProvidingItems(ICraftingProviderHelper cHelper){
IStackWatcher sWatcher = (IStackWatcher)stackWatcher;
ICraftingWatcher cWatcher = (ICraftingWatcher)craftingWatcher;
if(sWatcher != null) sWatcher.reset();
if(cWatcher != null) cWatcher.reset();
for(IAEItemStack stack : getProvidingItems()) {
if(sWatcher != null) sWatcher.add(stack);
if(cWatcher != null) cWatcher.add(stack);
if(cHelper != null) cHelper.setEmitable(stack);
}
}
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:13,代码来源:SemiBlockRequester.java
示例11: getProvidingItems
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Optional.Method(modid = ModIds.AE2)
public List<IAEItemStack> getProvidingItems(){
List<IAEItemStack> stacks = new ArrayList<IAEItemStack>();
for(TileEntity te : providingInventories.keySet()) {
IItemHandler inv = IOHelper.getInventoryForTE(te);
if(inv != null) {
for(int i = 0; i < inv.getSlots(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if(!stack.isEmpty()) stacks.add(AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack(stack));
}
}
}
return stacks;
}
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:15,代码来源:SemiBlockRequester.java
示例12: getAvailableItems
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
@Optional.Method(modid = ModIds.AE2)
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> arg0){
for(IAEItemStack stack : getProvidingItems()) {
stack.setCountRequestable(stack.getStackSize());
arg0.addRequestable(stack);
}
return arg0;
}
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:10,代码来源:SemiBlockRequester.java
示例13: isAltarRecipe
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
public static boolean isAltarRecipe(IAEItemStack[] AEStacks, ItemStack output, TileEntity te){
List<ItemStack> stacks = new ArrayList<ItemStack>();
for (IAEItemStack stack : AEStacks){
if (stack != null) {
stacks.add(stack.getItemStack());
}
}
return isAltarRecipe(stacks.toArray(), output, te);
}
开发者ID:ParadoxCodersTeam,项目名称:Botanic-Energistics,代码行数:10,代码来源:RecipeChecker.java
示例14: getInputs
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
public IAEItemStack[] getInputs() {
//return new IAEItemStack[9];
IAEItemStack[] AEStack = new IAEItemStack[9];
if (input == null) return AEStack;
for (int i = 0, inputLength = input.length; i < inputLength; i++) {
ItemStack stack = input[i];
AEStack[i] = AEApi.instance().storage().createItemStack(stack);
}
return AEStack;
}
开发者ID:ParadoxCodersTeam,项目名称:Botanic-Energistics,代码行数:12,代码来源:RuneAssemblerCraftingPattern.java
示例15: getCondensedInputs
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
public IAEItemStack[] getCondensedInputs() {
List<IAEItemStack> AEStack = new ArrayList<IAEItemStack>();
if (input == null) return (IAEItemStack[]) AEStack.toArray();
for (int i = 0, inputLength = input.length; i < inputLength; i++) {
ItemStack stack = input[i];
AEStack.add(AEApi.instance().storage().createItemStack(stack));
}
//return (IAEItemStack[]) AEStack.toArray();
return AEStack.toArray(new IAEItemStack[AEStack.size()]);
}
开发者ID:ParadoxCodersTeam,项目名称:Botanic-Energistics,代码行数:13,代码来源:RuneAssemblerCraftingPattern.java
示例16: getCondensedOutputs
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
public IAEItemStack[] getCondensedOutputs() {
if (!isCraftable()){
return null;
}
List<IAEItemStack> stack = new ArrayList<IAEItemStack>();
stack.add(AEApi.instance().storage().createItemStack(output));
IAEItemStack result = AEApi.instance().storage().createItemStack(output);
//return (IAEItemStack[]) stack.toArray();
return new IAEItemStack[] {result};
}
开发者ID:ParadoxCodersTeam,项目名称:Botanic-Energistics,代码行数:12,代码来源:RuneAssemblerCraftingPattern.java
示例17: getOutputs
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
public IAEItemStack[] getOutputs() {
if (!isCraftable()){
return null;
}
IAEItemStack[] stack = new IAEItemStack[1];
stack[0] = AEApi.instance().storage().createItemStack(output);
return stack;
}
开发者ID:ParadoxCodersTeam,项目名称:Botanic-Energistics,代码行数:10,代码来源:RuneAssemblerCraftingPattern.java
示例18: onClientRequestAutoCraft
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
/**
* Called when a client has clicked on a craftable item.
*
* @param player
* @param result
*/
public void onClientRequestAutoCraft( final EntityPlayer player, final IAEItemStack result )
{
// Get the host tile
TileEntity te = this.terminal.getHostTile();
// Launch the GUI
ThEGuiHandler.launchGui( ThEGuiHandler.AUTO_CRAFTING_AMOUNT, player, te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord );
// Setup the amount container
if( player.openContainer instanceof ContainerCraftAmount )
{
// Get the container
ContainerCraftAmount cca = (ContainerCraftAmount)this.player.openContainer;
// Create the open context
cca.setOpenContext( new ContainerOpenContext( te ) );
cca.getOpenContext().setWorld( te.getWorldObj() );
cca.getOpenContext().setX( te.xCoord );
cca.getOpenContext().setY( te.yCoord );
cca.getOpenContext().setZ( te.zCoord );
cca.getOpenContext().setSide( this.terminal.getSide() );
// Set the item
cca.getCraftingItem().putStack( result.getItemStack() );
cca.setItemToCraft( result );
// Issue update
if( player instanceof EntityPlayerMP )
{
( (EntityPlayerMP)player ).isChangingQuantityOnly = false;
}
cca.detectAndSendChanges();
}
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:41,代码来源:ContainerPartArcaneCraftingTerminal.java
示例19: onClientRequestAutoCraft
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
public void onClientRequestAutoCraft( final EntityPlayer player, final Aspect aspect )
{
// Get the host tile
TileEntity te = this.terminal.getHostTile();
// Launch the GUI
ThEGuiHandler.launchGui( ThEGuiHandler.AUTO_CRAFTING_AMOUNT, player, te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord );
// Setup the amount container
if( player.openContainer instanceof ContainerCraftAmount )
{
// Get the container
ContainerCraftAmount cca = (ContainerCraftAmount)this.player.openContainer;
// Create the open context
cca.setOpenContext( new ContainerOpenContext( te ) );
cca.getOpenContext().setWorld( te.getWorldObj() );
cca.getOpenContext().setX( te.xCoord );
cca.getOpenContext().setY( te.yCoord );
cca.getOpenContext().setZ( te.zCoord );
cca.getOpenContext().setSide( this.terminal.getSide() );
// Create the result item
IAEItemStack result = AEApi.instance().storage().createItemStack( ItemCraftingAspect.createStackForAspect( aspect, 1 ) );
// Set the item
cca.getCraftingItem().putStack( result.getItemStack() );
cca.setItemToCraft( result );
// Issue update
if( player instanceof EntityPlayerMP )
{
( (EntityPlayerMP)player ).isChangingQuantityOnly = false;
}
cca.detectAndSendChanges();
}
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:39,代码来源:ContainerEssentiaTerminal.java
示例20: requestCrafting
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@ScriptCallable(description = "Requests the specified item to get crafted.")
public void requestCrafting(IActionHost host,
@Env(Constants.ARG_ACCESS) IArchitectureAccess access,
@Env(Constants.ARG_CONVERTER) IConverter converter,
@Arg(name = "fingerprint", description = "Details of the item you want to craft. Can be found with .getStackInSlot on inventory and .getAvailableItems on AE network") ItemFingerprint needle,
@Optionals @Arg(name = "qty", description = "The quantity of items you want to craft") Long quantity,
@Arg(name = "cpu", description = "The name of the CPU you want to use") String wantedCpuName) {
ICraftingGrid craftingGrid = getCraftingGrid(host);
if (quantity == null) quantity = 1L;
ICraftingCPU wantedCpu = findCpu(craftingGrid, wantedCpuName);
IStorageGrid storageGrid = getStorageGrid(host);
IMEMonitor<IAEItemStack> monitor = storageGrid.getItemInventory();
IAEItemStack stack = findCraftableStack(storageGrid.getItemInventory().getStorageList(), needle);
Preconditions.checkArgument(stack != null, "Can't find craftable item fingerprint %s", needle);
final IAEItemStack toCraft = stack.copy();
toCraft.setStackSize(quantity);
// Create a new CraftingCallback. This callback is called when
// the network finished calculating the required items. It can do two things for us:
// a) It sends an event when items are missing to complete the request
// b) Otherwise it starts the crafting job, which itself is a CraftingRequester OSsending more events to the computer.
final CraftingCallback craftingCallback = new CraftingCallback(access, converter, craftingGrid, monitor, host, wantedCpu, toCraft);
// We will need access to the worldObj of the ME Interface -> cast to TileEntity
final TileEntity tileEntity = (TileEntity)host;
// Tell the craftingGrid to begin calculating and to report everything to the CraftingCallback
craftingGrid.beginCraftingJob(tileEntity.getWorldObj(), getGrid(host), new MachineSource(host), toCraft, craftingCallback);
}
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:35,代码来源:AdapterInterface.java
注:本文中的appeng.api.storage.data.IAEItemStack类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论