本文整理汇总了Java中ethanjones.cubes.item.inv.Inventory类的典型用法代码示例。如果您正苦于以下问题:Java Inventory类的具体用法?Java Inventory怎么用?Java Inventory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Inventory类属于ethanjones.cubes.item.inv包,在下文中一共展示了Inventory类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doTransfer
import ethanjones.cubes.item.inv.Inventory; //导入依赖的package包/类
private static boolean doTransfer(SlotActor slotActor) {
Inventory targetInv = slotActor.getInventory();
int targetNum = slotActor.getNum();
transferIf1(targetInv, targetNum);
transferIf2(targetInv, targetNum);
if (itemActor.itemStack.count == 0) {
itemActor.itemStack = null;
itemActor.remove();
itemActor = null;
}
targetInv.sync();
return true;
}
示例2: SlotActor
import ethanjones.cubes.item.inv.Inventory; //导入依赖的package包/类
public SlotActor(Inventory inventory, int num) {
super(new ButtonStyle());
Image image = new Image();
image.setScaling(Scaling.fit);
image.setDrawable(new SlotDrawable());
image.setTouchable(Touchable.disabled);
add(image);
setSize(getPrefWidth(), getPrefHeight());
this.inventory = inventory;
this.num = num;
InventoryManager.newSlot(this);
addListener(new SlotTooltipListener(this));
}
示例3: ScrollInventoryActor
import ethanjones.cubes.item.inv.Inventory; //导入依赖的package包/类
public ScrollInventoryActor(Inventory inventory, int slots) {
defaults().space(4f);
add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE)));
row();
inner = new Table();
inner.defaults().space(4f);
for (int i = 0; i < inventory.itemStacks.length; i++) {
SlotActor slotActor = new SlotActor(inventory, i);
inner.add(slotActor);
if ((i + 1) % inventory.width == 0) {
inner.row();
}
}
inner.pack();
scrollPane = new ScrollPane(inner);
scrollPane.setScrollingDisabled(true, false);
add(scrollPane).height(slots * CALIBRATION_PER_ROW).fill();
row();
pack();
}
示例4: InventoryActor
import ethanjones.cubes.item.inv.Inventory; //导入依赖的package包/类
public InventoryActor(Inventory inventory) {
defaults().space(4f);
add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE))).colspan(inventory.width);
row();
SlotActor slotActor;
for (int i = 0; i < inventory.itemStacks.length; i++) {
slotActor = new SlotActor(inventory, i);
add(slotActor);
if ((i + 1) % inventory.width == 0) {
row();
}
}
pack();
}
示例5: ScrollInventoryActor
import ethanjones.cubes.item.inv.Inventory; //导入依赖的package包/类
public ScrollInventoryActor(Inventory inventory, int slots) {
defaults().space(4f);
add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE)));
row();
inner = new Table();
inner.defaults().space(4f);
for (int i = 0; i < inventory.itemStacks.length; i++) {
SlotActor slotActor = new SlotActor(inventory, i);
inner.add(slotActor);
if ((i + 1) % inventory.width == 0) {
inner.row();
}
}
inner.pack();
scrollPane = new ScrollPane(inner);
scrollPane.setScrollingDisabled(true, false);
add(scrollPane).height(slots * CALIBRATION_PER_ROW).fill();
row();
pack();
}
示例6: InventoryActor
import ethanjones.cubes.item.inv.Inventory; //导入依赖的package包/类
public InventoryActor(Inventory inventory) {
defaults().space(4f);
add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE))).colspan(inventory.width);
row();
for (int i = 0; i < inventory.itemStacks.length; i++) {
SlotActor slotActor = new SlotActor(inventory, i);
add(slotActor);
if ((i + 1) % inventory.width == 0) {
row();
}
}
pack();
}
示例7: transferIf1
import ethanjones.cubes.item.inv.Inventory; //导入依赖的package包/类
private static boolean transferIf1(Inventory targetInv, int targetNum){
if (targetInv.outputOnly && InventoryHelper.sameItem(itemActor.itemStack, targetInv.itemStacks[targetNum])) {
if (itemActor.itemStack.count + targetInv.itemStacks[targetNum].count < itemActor.itemStack.item
.getStackCountMax()) {
itemActor.itemStack.count += targetInv.itemStacks[targetNum].count;
targetInv.itemStacks[targetNum] = null;
targetInv.sync();
return true;
}
}
}
示例8: transferIf2
import ethanjones.cubes.item.inv.Inventory; //导入依赖的package包/类
private static boolean transferIf2(Inventory targetInv, int targetNum){
if (targetInv.cancelInputItems) {
return true;
} else if (targetInv.fixed) {
if (targetInv.voidInputItems) {
itemActor.itemStack.count = 0;
} else {
return true;
}
} else if (targetInv.itemStacks[targetNum] == null) {
ItemStack copy = itemActor.itemStack.copy();
if (m.modifier()) {
copy.count = 1;
targetInv.itemStacks[targetNum] = copy;
itemActor.itemStack.count--;
} else {
targetInv.itemStacks[targetNum] = copy;
itemActor.itemStack.count = 0;
}
} else if (InventoryHelper.sameItem(targetInv.itemStacks[targetNum], itemActor.itemStack)) {
int transferAmount = Math.min(m.modifier() ? 1 : itemActor.itemStack.count,
itemActor.itemStack.item.getStackCountMax() - targetInv.itemStacks[targetNum].count);
targetInv.itemStacks[targetNum].count += transferAmount;
itemActor.itemStack.count -= transferAmount;
} else {
ItemStack i = itemActor.itemStack;
itemActor.itemStack = targetInv.itemStacks[targetNum];
targetInv.itemStacks[targetNum] = i;
}
}
示例9: ItemActor
import ethanjones.cubes.item.inv.Inventory; //导入依赖的package包/类
public ItemActor(final ItemStack itemStack, Inventory inventory, final int num) {
super(new ItemDrawable(false));
this.itemStack = itemStack;
this.inventory = inventory;
this.num = num;
setSize(32f, 32f);
setTouchable(Touchable.disabled);
setVisible(!Compatibility.get().isTouchScreen());
}
示例10: BlockDataChest
import ethanjones.cubes.item.inv.Inventory; //导入依赖的package包/类
public BlockDataChest(Area area, int x, int y, int z) {
super(area, x, y, z);
inventory = new Inventory("core:chest", 27) {
@Override
public void sync() {
BlockDataChest.this.sync();
}
};
}
示例11: ItemActor
import ethanjones.cubes.item.inv.Inventory; //导入依赖的package包/类
public ItemActor(final ItemStack itemStack, Inventory inventory, final int num) {
super(new ItemDrawable(false));
this.itemStack = itemStack;
this.inventory = inventory;
this.num = num;
setSize(32f, 32f);
setTouchable(Touchable.disabled);
setVisible(!Compatibility.get().isTouchScreen());
}
示例12: getInventory
import ethanjones.cubes.item.inv.Inventory; //导入依赖的package包/类
public Inventory getInventory() {
return inventory;
}
示例13: doTransfer
import ethanjones.cubes.item.inv.Inventory; //导入依赖的package包/类
private static boolean doTransfer(SlotActor slotActor) {
Inventory targetInv = slotActor.getInventory();
int targetNum = slotActor.getNum();
if (targetInv.outputOnly && InventoryHelper.sameItem(itemActor.itemStack, targetInv.itemStacks[targetNum])) {
if (itemActor.itemStack.count + targetInv.itemStacks[targetNum].count < itemActor.itemStack.item.getStackCountMax()) {
itemActor.itemStack.count += targetInv.itemStacks[targetNum].count;
targetInv.itemStacks[targetNum] = null;
targetInv.sync();
return true;
}
}
if (targetInv.cancelInputItems) {
return true;
} else if (targetInv.fixed) {
if (targetInv.voidInputItems) {
itemActor.itemStack.count = 0;
} else {
return true;
}
} else if (targetInv.itemStacks[targetNum] == null) {
ItemStack copy = itemActor.itemStack.copy();
if (m.modifier()) {
copy.count = 1;
targetInv.itemStacks[targetNum] = copy;
itemActor.itemStack.count--;
} else {
targetInv.itemStacks[targetNum] = copy;
itemActor.itemStack.count = 0;
}
} else if (InventoryHelper.sameItem(targetInv.itemStacks[targetNum], itemActor.itemStack)) {
int transferAmount = Math.min(m.modifier() ? 1 : itemActor.itemStack.count, itemActor.itemStack.item.getStackCountMax() - targetInv.itemStacks[targetNum].count);
targetInv.itemStacks[targetNum].count += transferAmount;
itemActor.itemStack.count -= transferAmount;
} else {
ItemStack i = itemActor.itemStack;
itemActor.itemStack = targetInv.itemStacks[targetNum];
targetInv.itemStacks[targetNum] = i;
}
if (itemActor.itemStack.count == 0) {
itemActor.itemStack = null;
itemActor.remove();
itemActor = null;
}
targetInv.sync();
return true;
}