本文整理汇总了Java中appeng.api.me.util.IMEInventoryHandler.getAvailableItems方法的典型用法代码示例。如果您正苦于以下问题:Java IMEInventoryHandler.getAvailableItems方法的具体用法?Java IMEInventoryHandler.getAvailableItems怎么用?Java IMEInventoryHandler.getAvailableItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类appeng.api.me.util.IMEInventoryHandler
的用法示例。
在下文中一共展示了IMEInventoryHandler.getAvailableItems方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTankInfo
import appeng.api.me.util.IMEInventoryHandler; //导入方法依赖的package包/类
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection from)
{
if (getGrid() != null && from.ordinal() == this.blockMetadata)
{
List<FluidTankInfo> tankInfo = new ArrayList<FluidTankInfo>();
FluidTankInfo[] tankArray = new FluidTankInfo[1];
IMEInventoryHandler cellArray = grid.getCellArray();
if (cellArray != null)
{
for (IAEItemStack item : cellArray.getAvailableItems())
{
if (item.getItem() == FLUIDDISPLAY.getItemInstance())
tankInfo.add(new FluidTankInfo(new FluidStack(FluidRegistry.getFluid(item.getItemDamage()), (int) item.getStackSize()), (int) getGrid().getCellArray().freeBytes()));
}
if (tankInfo.isEmpty())
tankInfo.add(new FluidTankInfo(null, (int) cellArray.freeBytes()));
tankArray = tankInfo.toArray(tankArray);
return tankArray;
}
}
return null;
}
示例2: onNetworkPatternChange
import appeng.api.me.util.IMEInventoryHandler; //导入方法依赖的package包/类
@ForgeSubscribe
public void onNetworkPatternChange(GridPatternUpdateEvent e)
{
if (grid != null)
{
IMEInventoryHandler inventoryHandler = grid.getCraftableArray();
if (inventoryHandler != null)
{
craftableFluidsInNetwork = new ArrayList<Fluid>();
for (IAEItemStack stack : inventoryHandler.getAvailableItems())
{
if (stack.getItem() == FLUIDDISPLAY.getItemInstance())
{
craftableFluidsInNetwork.add(FluidRegistry.getFluid(stack.getItemDamage()));
}
}
}
}
PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
}
示例3: drainFluid
import appeng.api.me.util.IMEInventoryHandler; //导入方法依赖的package包/类
public boolean drainFluid(FluidStack toExport)
{
IAEItemStack toDrain = Util.createItemStack(new ItemStack(FLUIDDISPLAY.getItemInstance(), 0, toExport.fluidID));
toDrain.setStackSize(toExport.amount);
if (grid != null)
{
IMEInventoryHandler cellArray = grid.getCellArray();
if (cellArray != null)
{
for (IAEItemStack fluidstack : cellArray.getAvailableItems())
{
if (fluidstack != null && fluidstack.getItem() instanceof ItemFluidDisplay && fluidstack.getItemDamage() == toExport.fluidID && fluidstack.getStackSize() >= toExport.amount)
{
IAEItemStack takenStack = cellArray.extractItems(Util.createItemStack(new ItemStack(toDrain.getItem(), (int) (toDrain.getStackSize()), toDrain.getItemDamage())));
if (takenStack == null)
{
return false;
} else if (takenStack.getStackSize() != (int) toDrain.getStackSize())
{
cellArray.addItems(takenStack);
return false;
} else
{
return true;
}
}
}
}
}
return false;
}