public static void writeToNBT(Shape shape, ItemStack stack) { NBTTagCompound compound = new NBTTagCompound(); compound.setString("name", shape.getName()); if (stack.getTagCompound() == null) { stack.setTagCompound(new NBTTagCompound()); } stack.getTagCompound().setTag("shape", compound); }