示例#1
0
  public void setItemType(ItemStack stack) {
    if (stack == null) {
      ItemDataUtils.removeData(bin, "storedItem");
      return;
    }

    ItemDataUtils.setCompound(
        bin, "storedItem", StackUtils.size(stack, 1).writeToNBT(new NBTTagCompound()));
  }
示例#2
0
  public ItemStack getItemType() {
    if (getItemCount() == 0) {
      return null;
    }

    return ItemStack.loadItemStackFromNBT(ItemDataUtils.getCompound(bin, "storedItem"));
  }
示例#3
0
  public void setItemCount(int count) {
    ItemDataUtils.setInt(bin, "itemCount", Math.max(0, count));

    if (getItemCount() == 0) {
      setItemType(null);
    }
  }
示例#4
0
  @Override
  public NBTTagList getInventory(Object... data) {
    if (data[0] instanceof ItemStack) {
      return ItemDataUtils.getList((ItemStack) data[0], "Items");
    }

    return null;
  }
示例#5
0
 public int getItemCount() {
   return ItemDataUtils.getInt(bin, "itemCount");
 }
示例#6
0
  public String getName(ItemStack itemstack) {
    String name = ItemDataUtils.getString(itemstack, "name");

    return name.isEmpty() ? "Robit" : name;
  }
示例#7
0
 public void setName(ItemStack itemstack, String name) {
   ItemDataUtils.setString(itemstack, "name", name);
 }
示例#8
0
 @Override
 public void setInventory(NBTTagList nbtTags, Object... data) {
   if (data[0] instanceof ItemStack) {
     ItemDataUtils.setList((ItemStack) data[0], "Items", nbtTags);
   }
 }