Пример #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);
   }
 }