예제 #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);
   }
 }