public void setItemType(ItemStack stack) { if (stack == null) { ItemDataUtils.removeData(bin, "storedItem"); return; } ItemDataUtils.setCompound( bin, "storedItem", StackUtils.size(stack, 1).writeToNBT(new NBTTagCompound())); }
public ItemStack getItemType() { if (getItemCount() == 0) { return null; } return ItemStack.loadItemStackFromNBT(ItemDataUtils.getCompound(bin, "storedItem")); }
public void setItemCount(int count) { ItemDataUtils.setInt(bin, "itemCount", Math.max(0, count)); if (getItemCount() == 0) { setItemType(null); } }
@Override public NBTTagList getInventory(Object... data) { if (data[0] instanceof ItemStack) { return ItemDataUtils.getList((ItemStack) data[0], "Items"); } return null; }
public int getItemCount() { return ItemDataUtils.getInt(bin, "itemCount"); }
public String getName(ItemStack itemstack) { String name = ItemDataUtils.getString(itemstack, "name"); return name.isEmpty() ? "Robit" : name; }
public void setName(ItemStack itemstack, String name) { ItemDataUtils.setString(itemstack, "name", name); }
@Override public void setInventory(NBTTagList nbtTags, Object... data) { if (data[0] instanceof ItemStack) { ItemDataUtils.setList((ItemStack) data[0], "Items", nbtTags); } }