当前位置: 首页>>代码示例>>Java>>正文


Java Inventory类代码示例

本文整理汇总了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;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:19,代码来源:InventoryTransferManager.java

示例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));
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:17,代码来源:SlotActor.java

示例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();
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:25,代码来源:ScrollInventoryActor.java

示例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();
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:19,代码来源:InventoryActor.java

示例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();
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:25,代码来源:ScrollInventoryActor.java

示例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();
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:18,代码来源:InventoryActor.java

示例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;
		}
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:12,代码来源:InventoryTransferManager.java

示例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;
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:31,代码来源:InventoryTransferManager.java

示例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());
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:10,代码来源:InventoryTransferManager.java

示例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();
    }
  };
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:11,代码来源:BlockDataChest.java

示例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());
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:10,代码来源:InventoryTransferManager.java

示例12: getInventory

import ethanjones.cubes.item.inv.Inventory; //导入依赖的package包/类
public Inventory getInventory() {
  return inventory;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:4,代码来源:SlotActor.java

示例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;
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:47,代码来源:InventoryTransferManager.java


注:本文中的ethanjones.cubes.item.inv.Inventory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。