本文整理汇总了Java中org.rev317.min.accessors.Interface.getStackSizes方法的典型用法代码示例。如果您正苦于以下问题:Java Interface.getStackSizes方法的具体用法?Java Interface.getStackSizes怎么用?Java Interface.getStackSizes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.rev317.min.accessors.Interface
的用法示例。
在下文中一共展示了Interface.getStackSizes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCount
import org.rev317.min.accessors.Interface; //导入方法依赖的package包/类
/**
* Gets the amount of items in inventory
*
* @param includeStack - true for including stack sizes to the counting
*
* @return amount of items
*/
public static int getCount(final boolean includeStack) {
final Interface inventory = getInterface();
if (inventory == null) {
return -1;
}
int count = 0;
final int[] items = inventory.getItems();
final int[] stackSizes = includeStack ? inventory.getStackSizes() : null;
for (int i = 0; i < items.length; i++) {
if (items[i] > 0) {
count += includeStack ? stackSizes[i] : 1;
}
}
return count;
}
示例2: getItems
import org.rev317.min.accessors.Interface; //导入方法依赖的package包/类
/**
* Gets all items accepted by filter
*
* @param filter
*
* @return items
*/
public static Item[] getItems(final Filter<Item> filter) {
final Interface inventory = getInterface();
if (inventory == null) {
return null;
}
final int[] items = inventory.getItems();
final int[] stackSizes = inventory.getStackSizes();
final ArrayList<Item> invItems = new ArrayList<>(28);
for (int i = 0; i < items.length; i++) {
final int itemId = items[i];
if (itemId < 1) {
continue;
}
final int stackSize = stackSizes[i];
final Item item = new Item(itemId, stackSize, i);
if (filter.accept(item)) {
invItems.add(item);
}
}
return invItems.toArray(new Item[invItems.size()]);
}
示例3: getItemStacks
import org.rev317.min.accessors.Interface; //导入方法依赖的package包/类
private static int[] getItemStacks(int interfaceID) {
Interface i;
if ((i = Interfaces.getInterfaces()[interfaceID]) != null) {
int[] stacks;
if ((stacks = i.getStackSizes()) != null && stacks.length > 0) {
return stacks;
}
}
return new int[0];
}