本文整理汇总了Java中me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItemSerializer.ItemFlag类的典型用法代码示例。如果您正苦于以下问题:Java ItemFlag类的具体用法?Java ItemFlag怎么用?Java ItemFlag使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ItemFlag类属于me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItemSerializer包,在下文中一共展示了ItemFlag类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tick
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItemSerializer.ItemFlag; //导入依赖的package包/类
protected void tick(Block b) {
if (BlockStorage.getBlockInfo(b, "enabled").equals("false")) return;
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
BlockMenu menu = BlockStorage.getInventory(b);
StringBuilder builder = new StringBuilder();
int i = 0;
for (int j = 0; j < 9; j++) {
if (i > 0) {
builder.append(" </slot> ");
}
ItemStack item = menu.getItemInSlot(getInputSlots()[j]);
if (item != null && item.getAmount() == 1) return;
builder.append(CustomItemSerializer.serialize(item, ItemFlag.DATA, ItemFlag.ITEMMETA_DISPLAY_NAME, ItemFlag.ITEMMETA_LORE, ItemFlag.MATERIAL));
i++;
}
String input = builder.toString();
if (recipes.containsKey(input)) {
ItemStack output = recipes.get(input).clone();
if (fits(b, new ItemStack[] {output})) {
pushItems(b, new ItemStack[] {output});
ChargableBlock.addCharge(b, -getEnergyConsumption());
for (int j = 0; j < 9; j++) {
if (menu.getItemInSlot(getInputSlots()[j]) != null) menu.replaceExistingItem(getInputSlots()[j], InvUtils.decreaseItem(menu.getItemInSlot(getInputSlots()[j]), 1));
}
}
}
}
示例2: compare
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItemSerializer.ItemFlag; //导入依赖的package包/类
@Override
public int compare(ItemFlag flag1, ItemFlag flag2) {
return flag1.getWeight() - flag2.getWeight();
}